Skip to content

oasis_weights: run the SCRIP weight-gen worker with an unlimited stack - #52

Merged
JanStreffing merged 1 commit into
masterfrom
fix/weightgen-openmp-stack
Jul 6, 2026
Merged

oasis_weights: run the SCRIP weight-gen worker with an unlimited stack#52
JanStreffing merged 1 commit into
masterfrom
fix/weightgen-openmp-stack

Conversation

@JanStreffing

Copy link
Copy Markdown
Owner

Runtime companion to the OASIS OpenMP-SCRIP build fix (oasis3-mct MR enabling -qopenmp).

Problem. With the parallel SCRIP build, -qopenmp makes ifort place large automatic arrays on the stack. MCT's O(10⁵) sparse-matrix sort in oasis_enddef then overflows the default stack on large-target links (e.g. A096→feom, RnfO→feom on a 208k-node ocean mesh) → SIGSEGV. The small-target link (→A096, 40k) survives, which is the diagnostic tell.

Fix. In generate_weights, launch each per-link worker under bash -c 'ulimit -s unlimited; exec <py> -m ocp_tool.oasis_weights <wdir>' (-c, not -lc, so the passed env dict is preserved) and export a large OMP_STACKSIZE for the OpenMP threads.

Verified. With the OpenMP-rebuilt OASIS, all 4 awiesm3 feom links now succeed and the whole generate_weights drops to ~28 s (was ~16 min serial) at 64 threads, on 2 nodes.

The parallel SCRIP build (-qopenmp) makes ifort place large automatic arrays on
the stack, and MCT's O(10^5) sparse-matrix sort in oasis_enddef overflows the
default stack on large target grids -> SIGSEGV on the big weight links.

Launch each per-link worker under `bash -c 'ulimit -s unlimited; exec ...'` and
export a large OMP_STACKSIZE for the OpenMP threads. Verified: all 4 awiesm3
feom links then succeed and the whole weight-gen drops to ~28 s (was ~16 min
serial) at 64 threads.
@JanStreffing
JanStreffing merged commit 3986241 into master Jul 6, 2026
6 checks passed
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