Skip to content

Openmp bug fixes#1416

Open
MicroTed wants to merge 2 commits intoMPAS-Dev:developfrom
MicroTed:openmpfixes
Open

Openmp bug fixes#1416
MicroTed wants to merge 2 commits intoMPAS-Dev:developfrom
MicroTed:openmpfixes

Conversation

@MicroTed
Copy link

@MicroTed MicroTed commented Mar 2, 2026

This PR resolves the problems raised in issue #1403. Namely, that one subroutine needed barriers to fix random errors and another subroutine needed to called without threading to fix reproducibility with multiple OMP threads.

Changes:

mpas_atm_time_integration.F :
Bug: Add OMP barriers in atm_rk_integration_setup to keep array use in sync (fixes random bad values at thread bounds). It's not clear to me why barriers are needed at both the beginning and end, but neither by itself resolved the bad value errors.
Efficiency: Turn off OMP parallel for atm_advance_scalars_mono because it slows down with multi-threading (insufficient work in loops) (no change to results). The subroutine could be restructured to push the scalar loop inside the column loop, but would use more memory for local arrays.

mpas_atmphys_driver.F :
Bug: Remove OMP parallel for noahmp because it ignores thread bounds (does all cells). The OMP threading was causing the land surface rates to be accumulated multiple times and thus changed the solution.

Tested on MacOS with gfortran/gcc 12.4 and clang version 17.0.0

…en threaded

  mpas_atm_time_integration.F :
    Add OMP barriers in atm_rk_integration_setup to keep array use in sync (fixes random bad values at thread bounds)
    Turn off OMP parallel for atm_advance_scalars_mono because it slows down (insufficient work in loops)
  mpas_atmphys_driver.F : Remove OMP parallel for noahmp because it ignores thread bounds (does all cells)
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