Isolate TwoPuncture from ABE OMP settings

This commit is contained in:
2026-03-30 21:00:20 +08:00
parent 087d034ee3
commit 60ad63e8cc
2 changed files with 14 additions and 6 deletions

View File

@@ -55,14 +55,22 @@ NUMACTL_CPU_BIND = get_last_n_cores_per_socket(n=32)
BUILD_JOBS = 64
def build_runtime_env():
"""Inject OpenMP runtime settings from the Python input file."""
def build_abe_runtime_env():
"""Inject OpenMP runtime settings only for the main ABE evolution run."""
runtime_env = os.environ.copy()
omp_threads = max(1, int(getattr(input_data, "OMP_Threads", 1)))
runtime_env["OMP_NUM_THREADS"] = str(omp_threads)
return runtime_env
def build_twopuncture_runtime_env():
"""Let TwoPunctureABE use the runtime default instead of the ABE OMP override."""
runtime_env = os.environ.copy()
runtime_env.pop("OMP_NUM_THREADS", None)
runtime_env.pop("OMP_THREAD_LIMIT", None)
return runtime_env
##################################################################
@@ -172,7 +180,7 @@ def run_ABE():
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
text=True,
env=build_runtime_env(),
env=build_abe_runtime_env(),
)
## Write ABE run output to file while printing to stdout
@@ -219,7 +227,7 @@ def run_TwoPunctureABE():
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
text=True,
env=build_runtime_env(),
env=build_twopuncture_runtime_env(),
)
## Write TwoPunctureABE run output to file while printing to stdout