Skip to content

Add Reactant correctness check for AtmosphereModel.#687

Open
dkytezab wants to merge 9 commits into
mainfrom
dkz/feature-reactant-correctness
Open

Add Reactant correctness check for AtmosphereModel.#687
dkytezab wants to merge 9 commits into
mainfrom
dkz/feature-reactant-correctness

Conversation

@dkytezab
Copy link
Copy Markdown
Collaborator

@dkytezab dkytezab commented May 8, 2026

Closes #683. Checking field equality before and after a single timestep.

Copy link
Copy Markdown
Member

@giordano giordano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't run only on the GPU jobs? Also, it may be easier to move all these tests in a dedicate directory (reactant/?) and then in

if filter_tests!(testsuite, args)
# Reactant compilation tests require --check-bounds=auto (Reactant/Enzyme
# limitation).
if !REACTANT_COMPAT
delete!(testsuite, "reactant_centered_compilation")
delete!(testsuite, "reactant_weno_compilation")
end
end
automatically filter out all the tests starting with reactant/. Edit: I went on and did that.

@giordano giordano added testing 🧪 reactant ☣ towards a differentiable earth labels May 8, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

giordano added 2 commits May 8, 2026 22:34
ParallelTestRunner fixes the seed anyway.
@dkytezab
Copy link
Copy Markdown
Collaborator Author

dkytezab commented May 8, 2026

I believe that the errors here https://github.com/NumericalEarth/Breeze.jl/actions/runs/25581771362/job/75102082127?pr=687#step:11:536 are due primarily to EnzymeAD/Reactant.jl#2870. Basically, when we compile with Reactant, we alias the initial state rather than storing it as a copy, causing the RK3 substeps to be incorrect. This enters here

function store_initial_state!(model)
U⁰ = model.timestepper.U⁰
for (u⁰, u) in zip(U⁰, prognostic_fields(model))
parent(u⁰) .= parent(u)
end
return nothing
end

My workaround was instead to use a kernel to copy each of the prognostic fields, which I can implement now for the time being if that sounds good

There may also be an issue with maybe_prepare_first_time_step! that I need to investigate further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

reactant ☣ towards a differentiable earth testing 🧪

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Reactant correctness check for AtmosphereModel timestepping

2 participants