Skip to content

Set both cubed sphere test models from the same initial fields - #6148

Merged
glwagner merged 1 commit into
mainfrom
mg/cubed-sphere-same-initial-conditions
Oct 6, 2026
Merged

glwagner merged 1 commit into
mainfrom
mg/cubed-sphere-same-initial-conditions

Conversation

@giordano

@giordano giordano commented Oct 4, 2026

Copy link
Copy Markdown
Member

Fix a test failure observed in #5799: the test is implicitly relying on the tests running with one thread, which (1) isn't necessarily true in general, and (2) is always false even in CI with KernelAbstractions.jl v0.10.

The cubed sphere simulation test compares a model using a split-explicit free surface with extended halos against one without, and expects the same result. It gave both models the same noisy initial conditions by calling Random.seed!(1234) before setting each of them with functions calling rand(). That relies on how set! evaluates functions: in which task, and in which order. It only holds when set! evaluates in the calling task in a fixed order, and breaks as soon as the function is evaluated in spawned tasks, whose random number streams also depend on the tasks spawned before (e.g. by GPU synchronization).

Draw the noisy initial conditions once into fields and set both models from them, so that they start from the same state by construction.

The cubed sphere simulation test compares a model using a split-explicit
free surface with extended halos against one without, and expects the
same result. It gave both models the same noisy initial conditions by
calling `Random.seed!(1234)` before setting each of them with functions
calling `rand()`. That relies on how `set!` evaluates functions: in
which task, and in which order. It only holds when `set!` evaluates in
the calling task in a fixed order, and breaks as soon as the function
is evaluated in spawned tasks, whose random number streams also depend
on the tasks spawned before (e.g. by GPU synchronization).

Draw the noisy initial conditions once into fields and set both models
from them, so that they start from the same state by construction.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs
@giordano
giordano requested a review from tomchor October 4, 2026 12:54
@giordano giordano added the testing 🧪 Tests get priority in case of emergency evacuation label Oct 4, 2026
@codecov

codecov Bot commented Oct 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.42%. Comparing base (0afe53a) to head (e05d11b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #6148       +/-   ##
===========================================
+ Coverage   32.42%   74.42%   +41.99%     
===========================================
  Files         439      439               
  Lines       27305    27538      +233     
===========================================
+ Hits         8855    20494    +11639     
+ Misses      18450     7044    -11406     
Flag Coverage Δ
buildkite 70.07% <ø> (?)
distributed_tripolar 20.20% <ø> (ø)
julia 70.07% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@glwagner
glwagner merged commit c52a3a8 into main Oct 6, 2026
17 checks passed
@glwagner
glwagner deleted the mg/cubed-sphere-same-initial-conditions branch October 6, 2026 03:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing 🧪 Tests get priority in case of emergency evacuation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants