Skip to content

Copy the ib flag to the device - #1936

Closed
sbryngelson wants to merge 1 commit into
masterfrom
fix-ib-device-flag
Closed

sbryngelson wants to merge 1 commit into
masterfrom
fix-ib-device-flag

Conversation

@sbryngelson

@sbryngelson sbryngelson commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Summary

ib gets a device copy (GPU_DECLARE(create=...) via SIM_GPU_DECL_VARS), but nothing ever copies its value to the GPU, so inside device kernels it stays .false.. #1792 added two device-side reads of it:

  • s_compute_dt (m_time_steppers.fpp): skip IB-interior cells in the adaptive-dt reduction
  • s_write_run_time_information (m_data_output.fpp): skip IB-interior cells in the CFL stability statistics

On GPU builds both checks are silently skipped. GPUs keep including IB-interior cells when choosing dt, while CPU builds exclude them. Any case with ib and cfl_adap_dt = T then runs with a different dt on GPU than on CPU. This adds ib to the existing GPU_UPDATE(device=...) in s_initialize_global_parameters_module.

How it showed up

In #1821, the 2D -> Example -> ibm_reacting_surface test (F52F0D4C) gives the same wrong numbers on every GPU build (Frontier CCE-acc, CCE-omp, AMD-omp, and Phoenix NVHPC-acc: 0.65037 vs. golden 0.6487849), while every CPU build (GNU, CCE, AMD) matches. Before the merge of #1792 into that branch, CPU and GPU agreed. After it, GPU stayed on the old value and only CPU moved. No master test currently triggers the bug.

The other device-declared parameters that are never updated (down_sample, igr_pres_lim, recon_type, weno_order) are case-optimization parameters that are read on the host or baked in at compile time, so this PR leaves them alone.

This PR was prepared with Claude Code (diagnosis from the #1821 CI logs and the fix).

Acknowledgement

  • I confirm this PR meets the above expectations and reflects my own understanding and real-world context.

#1792 added two device-side reads of ib -- skipping immersed-boundary
interior cells in the adaptive-dt reduction (s_compute_dt) and in the
CFL stability statistics (s_write_run_time_information). ib is
GPU_DECLARE'd through SIM_GPU_DECL_VARS but was never GPU_UPDATE'd,
so on the device it stayed .false. and GPU builds kept including IB
interior cells in dt while CPU builds excluded them. With
cfl_adap_dt=T this gives GPU runs a different dt from CPU runs.
Copilot AI balanced review requested due to automatic review settings October 1, 2026 14:39
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-01T14:41:04.143544Z b714f7d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The CPU/GPU synchronization fix lacks an automated regression test.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Synchronizes the immersed-boundary flag to GPU devices so adaptive timestep and CFL calculations match CPU behavior.

Changes:

  • Adds ib to global GPU parameter synchronization.
File Description
src/​simulation/​m_global_parameters.fpp Copies ib to device storage during initialization.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

$:GPU_UPDATE(device='[alt_soundspeed, acoustic_source, num_source]')
$:GPU_UPDATE(device='[dt, sys_size, buff_size, eqn_idx, mpp_lim, bubbles_euler, hypoelasticity, alt_soundspeed, &
& avg_state, model_eqns, mixture_err, grid_geometry, cyl_coord, mp_weno, weno_eps, teno_CT, low_Mach]')
& avg_state, model_eqns, mixture_err, grid_geometry, cyl_coord, mp_weno, weno_eps, teno_CT, low_Mach, ib]')
@sbryngelson

Copy link
Copy Markdown
Member Author

Superseded by #1937 (same commit, opened from a fork per the repo's contribution rules).

@sbryngelson sbryngelson closed this Oct 1, 2026
@sbryngelson
sbryngelson deleted the fix-ib-device-flag branch October 1, 2026 14:57
@codecov

codecov Bot commented Oct 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.80%. Comparing base (ed7a238) to head (b714f7d).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1936      +/-   ##
==========================================
- Coverage   62.82%   62.80%   -0.02%     
==========================================
  Files          86       86              
  Lines       22394    22385       -9     
  Branches     3305     3304       -1     
==========================================
- Hits        14070    14060      -10     
- Misses       6071     6073       +2     
+ Partials     2253     2252       -1     

☔ 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.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants