|
1 | 1 | """ |
2 | 2 | $(TYPEDSIGNATURES) |
3 | 3 |
|
4 | | -Return the tuple of available method triplets for solving optimal control problems. |
| 4 | +Return the tuple of available method quadruplets for solving optimal control problems. |
5 | 5 |
|
6 | | -Each triplet consists of `(discretizer_id, modeler_id, solver_id)` where: |
| 6 | +Each quadruplet consists of `(discretizer_id, modeler_id, solver_id, parameter)` where: |
7 | 7 | - `discretizer_id`: Symbol identifying the discretization strategy |
8 | | -- `modeler_id`: Symbol identifying the NLP modeling strategy |
| 8 | +- `modeler_id`: Symbol identifying the NLP modeling strategy |
9 | 9 | - `solver_id`: Symbol identifying the NLP solver |
| 10 | +- `parameter`: Symbol identifying the parameter (`:cpu` or `:gpu`) |
| 11 | +
|
| 12 | +GPU-capable methods use parameterized strategies that automatically get appropriate defaults: |
| 13 | +- `Exa{GPU}` gets `CUDA.CUDABackend()` by default |
| 14 | +- `MadNLP{GPU}` gets `MadNLPGPU.CUDSSSolver` by default |
| 15 | +- `MadNCL{GPU}` gets `MadNLPGPU.CUDSSSolver` by default |
10 | 16 |
|
11 | 17 | # Returns |
12 | | -- `Tuple{Vararg{Tuple{Symbol, Symbol, Symbol}}}`: Available method combinations |
| 18 | +- `Tuple{Vararg{Tuple{Symbol, Symbol, Symbol, Symbol}}}`: Available method combinations |
13 | 19 |
|
14 | 20 | # Examples |
15 | 21 | ```julia |
16 | 22 | julia> m = methods() |
17 | | -((:collocation, :adnlp, :ipopt), (:collocation, :adnlp, :madnlp), ...) |
| 23 | +((:collocation, :adnlp, :ipopt, :cpu), (:collocation, :adnlp, :madnlp, :cpu), ...) |
18 | 24 |
|
19 | 25 | julia> length(m) |
20 | | -8 |
| 26 | +10 # CPU methods + GPU methods |
| 27 | +
|
| 28 | +julia> # CPU methods (existing behavior maintained) |
| 29 | +julia> methods()[1] |
| 30 | +(:collocation, :adnlp, :ipopt, :cpu) |
| 31 | +
|
| 32 | +julia> # GPU methods (new functionality) |
| 33 | +julia> methods()[9] # First GPU method |
| 34 | +(:collocation, :exa, :madnlp, :gpu) |
21 | 35 | ``` |
22 | 36 |
|
| 37 | +# Notes |
| 38 | +- All existing methods are now explicitly marked with `:cpu` parameter |
| 39 | +- GPU methods are available when CUDA.jl is loaded |
| 40 | +- Parameterized strategies provide smart defaults automatically |
| 41 | +
|
23 | 42 | # See Also |
24 | 43 | - [`solve`](@ref): Main solve function that uses these methods |
25 | 44 | - [`CTBase.complete`](@ref): Completes partial method descriptions |
| 45 | +- [`get_strategy_registry`](@ref): Registry with parameterized strategies |
26 | 46 | """ |
27 | | -function Base.methods()::Tuple{Vararg{Tuple{Symbol, Symbol, Symbol}}} |
| 47 | +function Base.methods()::Tuple{Vararg{Tuple{Symbol, Symbol, Symbol, Symbol}}} |
28 | 48 | return ( |
29 | | - (:collocation, :adnlp, :ipopt ), |
30 | | - (:collocation, :adnlp, :madnlp), |
31 | | - (:collocation, :exa, :ipopt ), |
32 | | - (:collocation, :exa, :madnlp), |
33 | | - (:collocation, :adnlp, :madncl), |
34 | | - (:collocation, :exa, :madncl), |
35 | | - (:collocation, :adnlp, :knitro), |
36 | | - (:collocation, :exa, :knitro), |
| 49 | + # CPU methods (all existing methods now with :cpu parameter) |
| 50 | + (:collocation, :adnlp, :ipopt, :cpu), |
| 51 | + (:collocation, :adnlp, :madnlp, :cpu), |
| 52 | + (:collocation, :exa, :ipopt, :cpu), |
| 53 | + (:collocation, :exa, :madnlp, :cpu), |
| 54 | + (:collocation, :adnlp, :madncl, :cpu), |
| 55 | + (:collocation, :exa, :madncl, :cpu), |
| 56 | + (:collocation, :adnlp, :knitro, :cpu), |
| 57 | + (:collocation, :exa, :knitro, :cpu), |
| 58 | + |
| 59 | + # GPU methods (only combinations that make sense) |
| 60 | + (:collocation, :exa, :madnlp, :gpu), |
| 61 | + (:collocation, :exa, :madncl, :gpu), |
37 | 62 | ) |
38 | 63 | end |
0 commit comments