Skip to content

T-aware overloads for collocation/control and PDE problems - #14

Merged
sshin23 merged 4 commits into
mainfrom
ss/T-aware-objectives
Aug 3, 2026
Merged

T-aware overloads for collocation/control and PDE problems#14
sshin23 merged 4 commits into
mainfrom
ss/T-aware-objectives

Conversation

@sshin23

@sshin23 sshin23 commented Aug 3, 2026

Copy link
Copy Markdown
Member

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.

sshin23 and others added 4 commits May 19, 2026 00:14
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>
@sshin23
sshin23 merged commit e6e3d56 into main Aug 3, 2026
3 checks passed
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