Skip to content

Parameters#88

Merged
ocots merged 29 commits intodevelopfrom
parameters
Mar 4, 2026
Merged

Parameters#88
ocots merged 29 commits intodevelopfrom
parameters

Conversation

@ocots
Copy link
Copy Markdown
Member

@ocots ocots commented Mar 3, 2026

No description provided.

ocots added 2 commits March 3, 2026 14:17
- Add AbstractStrategyParameter framework with CPU/GPU parameters
- Implement parameterized MadNLP and MadNCL solvers
- GPU solvers automatically use MadNLPGPU.CUDSSSolver by default
- CPU solvers use MadNLP.MumpsSolver by default
- Add registry support for parameterized strategies
- Add builder functions for parameterized strategy construction
- Remove duplicate metadata fallbacks (clean architecture)
- Add comprehensive tests for parameterized strategies
- Update documentation for GPU linear solver behavior

Resolves #83: MadNLP/MadNCL GPU linear solver defaults
Fixes compatibility issues with GPU backends and CPU-only solvers
- Replace 'using' statements with 'import' in all test files
- Qualify all module references (Test.@testset, Test.@test, etc.)
- Remove unnecessary CTSolvers imports where submodules are imported directly
- Fix struct definitions to be at module level (not inside testsets)
- Ensure consistent import style across all test files
- Maintain compatibility with test runner expectations

This change standardizes the import style across the entire test suite
following the pattern established in test_validation_permissive.jl.
ocots added 27 commits March 3, 2026 15:56
- Add Options. prefix to all OptionDefinition references in test_configuration.jl and test_utilities.jl
- Add Strategies. prefix to AbstractStrategyParameter, CPU, GPU in test_integration_parameters.jl
- Add Test. prefix to all @test, @test_nowarn, @inferred in test_madnlp_gpu_linear_solver.jl
- Add CTBase.Exceptions import to test_parameters.jl
- Change FakeFamily from struct to abstract type in test_registry_parameters.jl
- Fix all Options references to use correct module paths (Strategies.Options or Options)

These fixes resolve the 16 test errors from the previous commit.
- Fix CTBase.Exceptions reference in parameters.jl (use Exceptions. prefix)
- Fix NotImplemented exception arguments to match CTBase API
- Fix duplicate ID test in test_backward_compatibility.jl
- Add missing description parameter to OptionDefinition in test_integration_parameters.jl
- Fix module name reference in test_madnlp_gpu_linear_solver.jl
- Use proper multi-line format for OptionDefinition calls
- Fix invalid tests that tried to parameterize non-parameterized FakeStratA
- Correct test expectations for strategy_ids with only parameterized strategies

Remaining issues (3 errors) are source code validation bugs, not test qualification issues:
1. test_integration_parameters.jl:194 - Missing validation for unsupported GPU parameter
2. test_integration_parameters.jl:214 - Type instability in extract_parameter_from_method
3. test_registry_parameters.jl:96 - Missing validation for duplicate parameter IDs
Store parameter map directly in StrategyRegistry instead of rebuilding
it with hardcoded CPU/GPU entries in _parameter_id_map.

Changes:
- Add parameters field to StrategyRegistry to store discovered parameter types
- Remove _parameter_id_map function (replaced by registry.parameters)
- Update create_registry to populate parameters from registered strategies
- Update show(registry) to display parameters
- Fix test_builders_parameters.jl to reflect new behavior:
  * registry.parameters is empty when no parameterized strategies
  * registry.parameters contains discovered parameters from registered strategies

Contract: Registry is the source of truth for parameters, discovered
only from registered parameterized strategies. No global hardcoded list.

All tests pass (1505 tests: strategies, orchestration, integration).
…d extensions

- Harmonize file headers and section comments to English-only, consistent style
- Align all # Throws sections to CTBase.Exceptions.* (ExtensionError, NotImplemented)
- Convert all examples to conceptual style (remove line-by-line # comments)
- Add See also cross-references to main docstrings
- Correct factual errors in extract_solver_infos docstrings (objective sign, status codes)
- Add missing docstrings (_default_parameter functions)
- Ensure all docstrings follow docstrings.md standards

Files modified:
- src/Solvers/{abstract_solver.jl, Solvers.jl, common_solve_api.jl, ipopt.jl, madnlp.jl, madncl.jl, knitro.jl}
- ext/{CTSolversIpopt.jl, CTSolversMadNLP.jl, CTSolversMadNCL.jl, CTSolversKnitro.jl}
- Add test_helpers.jl to test extension helper functions
- Test base_type() extraction for MadNCL NCLOptions
- Test __madncl_default_linear_solver() for CPU/GPU
- Test __madnlp_default_linear_solver() for CPU/GPU
- Test ExtensionError when MadNLPGPU not loaded
- Test type stability of helper functions

Bug fixes:
- Remove unsupported 'suggestion' parameter from ExtensionError calls in MadNLP/MadNCL helpers
- ExtensionError only supports: message, feature, context (not suggestion)

All tests pass (9/9)
…onError

- Remove 'suggestion' parameter from __get_cuda_backend() ExtensionError call
- ExtensionError only supports: message, feature, context (not suggestion)
- Add unit test for __get_cuda_backend() ExtensionError path

Test coverage:
- Test ExtensionError when CUDA not loaded
- Skip functional test when CUDA is loaded (requires CUDA.functional())

All tests pass (13/13)
- Fix architecture.md: clarify AbstractDiscretizer is external (CTDirect.jl)
- Add Solvers.MadNCL to index.md module list
- Create comprehensive Strategy Parameters guide (CPU/GPU specialization)
- Add strategy parameters section to architecture.md with Mermaid diagram
- Update documentation build system to include new guide
- Add missing files to API reference (orchestration/builders.jl, strategies/contract/parameters.jl, strategies/api/bypass.jl)

This resolves documentation inconsistencies and introduces the previously undocumented
strategy parameters system for type-based specialization of strategy behavior.
- Make fallback _supported_parameters and _default_parameter throw NotImplemented
- Add comprehensive docstrings to all strategy parameter overloads
- Add parameter validation in stub metadata functions before ExtensionError
- Disallow non-parameterized strategies with IncorrectArgument
- Fix all tests to use Strategies._default_parameter and Strategies._supported_parameters
- Add comprehensive tests for parameter contract enforcement
- Ensure 100% test pass rate (3078/3078 tests)

All tests now pass with proper contract enforcement:
- Parameterized strategies must explicitly implement the contract
- Non-parameterized strategies are properly rejected
- Clear error messages guide users to correct implementation
- Full API documentation for all parameter-related functions
- Change KernelAbstractions.CUDABackend() to CUDA.CUDABackend()
- Update docstring to reflect correct CUDA module usage
- Ensure proper CUDA backend access for GPU execution
@ocots ocots merged commit c0a1d48 into develop Mar 4, 2026
7 checks passed
@ocots ocots deleted the parameters branch March 4, 2026 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant