T-aware overloads for collocation/control and PDE problems - #14
Merged
Conversation
Patches the 9 COPS problems that fail on Metal/oneAPI fp32 due to Float64
literals leaking into kernels via the ExaModels expression tree:
rocket, glider, steering, robot — physical constants (g, masses, lengths)
catmix, gasoil, marine, methanol, pinene — collocation rho/tau/bc arrays
and tf/nh integer-division for h, plus factorial(k) Int divisor in the
derivative
Pattern applied uniformly:
- Wrap scalar Float64 literals in T(...) at the top of each model builder
- Use T[...] for tabular constants (rho, tau, bc, observations)
- Replace Int/Int divisions like (tf/nh) with T(tf)/T(nh) or precompute as
h = T(tf) / T(nh)
- Replace factorial(k) usages in expressions with T(factorial(k)) so the
derivative's inv() constant stays in T precision
- Bind "derived" scalars (half = T(0.5), inv_nh = T(1)/T(nh), zero_T,
pi_T, etc.) as concrete locals so generator closures stay isbits — Metal
rejects Type{T} captures in kernels
This is the same class of fix as the ExaModelsLuksanVlcek
branch (LV side). PR follow-up planned: Sungho to open PR after review.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
… matching deps/extras The existing [sources] block pinned ExaModels to main of exanauts/ExaModels.jl, but on Julia 1.12 this triggers 'Sources for ExaModels not listed in deps or extras' validation error when Pkg.add fetches this repo. ExaModels is already declared in [weakdeps] for the extension; removing the [sources] entry lets COPSBenchmark use whichever ExaModels the outer environment provides — which is the desired behavior for benchmarks anyway.
The transition_state_model energy expressions leaked Float64 into the GPU AD kernels on fp32 backends (Metal, oneAPI): - scalar a = problem.a is Float64 - 1/(DIMEN+1) and /2 are integer divisions producing Float64 inverses in the derivative kernel Precompute aT = T(a), inv_dim = T(1)/T(DIMEN+1), half = T(1)/T(2) and use those in the expressions. Fixes InvalidIRError (unsupported double) in gpu_kerh2 for dirichlet, henon, and lane_emden under T=Float32.
ExaModels 0.11 exports get_lvar/get_uvar/get_lcon/get_ucon (its block accessors), so with both packages loaded the unqualified names are ambiguous and throw UndefVarError in the callback-comparison testset. Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Upstreams the paper branch: T-aware constants for 9 collocation/control problems and the PDE models (dirichlet/henon/lane_emden), plus removal of a [sources] entry Julia 1.12 rejects. Needed for Float32 GPU runs of the suite.