Isolate TwoPuncture from ABE OMP settings
This commit is contained in:
@@ -16,8 +16,8 @@ import numpy
|
||||
File_directory = "GW150914" ## output file directory
|
||||
Output_directory = "binary_output" ## binary data file directory
|
||||
## The file directory name should not be too long
|
||||
MPI_processes = 8 ## number of mpi processes used in the simulation
|
||||
OMP_Threads = 16 ## number of OpenMP threads used by each MPI process
|
||||
MPI_processes = 64 ## number of mpi processes used in the simulation
|
||||
OMP_Threads = 3 ## number of OpenMP threads used by each MPI process
|
||||
|
||||
GPU_Calculation = "no" ## Use GPU or not
|
||||
## (prefer "no" in the current version, because the GPU part may have bugs when integrated in this Python interface)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user