Skip to content

Use finite differences for GPU Newton tests - #244

Closed
ChrisRackauckas-Claude wants to merge 1 commit into
SciML:mainfrom
ChrisRackauckas-Claude:fix/gpu-newton-autodiff
Closed

ChrisRackauckas-Claude wants to merge 1 commit into
SciML:mainfrom
ChrisRackauckas-Claude:fix/gpu-newton-autodiff

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Aug 27, 2026 •

Copy link
Copy Markdown
Member

What changed

The GPU layer-test matrix now configures NewtonRaphson with AutoFiniteDiff, while the CPU matrix retains its existing AutoForwardDiff(chunksize=12) coverage. Assertions guard both backend choices.

ForwardDiff seeds dual arrays through scalar indexing, which is unsupported for CUDA arrays. NonlinearSolve uses AutoFiniteDiff for the same Newton CUDA coverage. This is intentionally separate from #243 and should be reviewed and landed with or after that prerequisite.

Ignore this PR until it has been reviewed by @ChrisRackauckas.

Failing before

With the old GPU configuration retained, the new regression assertion failed:

Solver autodiff configuration: Test Failed at test/layers_tests.jl:22
  Expression: ((solvers(true))[3]).autodiff isa AutoFiniteDiff
   Evaluated: ADTypes.AutoForwardDiff(chunksize=12) isa ADTypes.AutoFiniteDiff

The runtime symptom is independently visible as 12 GPUArraysCore scalar-indexing errors from ForwardDiff._seed_zero_partials! and SciMLBase.NonlinearFunction in the GPU job for #243:
https://github.com/SciML/DeepEquilibriumNetworks.jl/actions/runs/33104383320/job/98635451731

Passing after

$ GROUP=Core julia +1.11 --project=. -e "using Pkg; Pkg.test()"
Test Summary: | Pass  Total      Time
Layers Tests  | 1540   1540  29m34.8s
Testing DeepEquilibriumNetworks tests passed

$ GROUP=QA julia +1.11 --project=. -e "using Pkg; Pkg.test()"
Test Summary: | Pass  Total     Time
QA            |   20     20  1m34.1s
Testing DeepEquilibriumNetworks tests passed

$ julia +1.11 --project=@runic -e "using Runic; exit(Runic.main([\"--check\", \"test/layers_tests.jl\"]))"
# exit 0

$ git diff --no-ext-diff -- test/layers_tests.jl | typos -
# exit 0

$ git diff --check
# exit 0

Not verified locally

No NVIDIA GPU is available on this host, so the full CUDA matrix was not run locally. GPU CI on this branch may remain blocked by the clean-main SteadyStateAdjoint failure until #243 lands.

The 36 cuDNN execution errors in that job are a separate forward-convolution/runtime problem in an untouched path. A standalone Lux/NNlib/CUDA reproducer was identified, but it cannot be verified on this host without a GPU, so no upstream issue was filed.

🤖 Generated with Codex CLI 0.150.1 (model: unknown; session: local session ID 01a0441e-3d2f-7170-ab6e-58ef72975a9f)

Keep ForwardDiff coverage for CPU tests while selecting the GPU-compatible finite-difference Jacobian backend for NewtonRaphson.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Codex <noreply@openai.com>
Agent-Harness: Codex CLI 0.150.1
Agent-Model: unknown
Agent-Session: local session ID 01a0441e-3d2f-7170-ab6e-58ef72975a9f
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.

2 participants