Skip to content

Commit

Permalink
Omit OMP_NUM_THREADS in MPI-only runs
Browse files Browse the repository at this point in the history
  • Loading branch information
amametjanov committed Apr 19, 2019
1 parent 421cc98 commit f184078
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions scripts/lib/CIME/case/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ def initialize_derived_attributes(self):
threads_per_core = 1 if (threads_per_node <= max_mpitasks_per_node) else smt_factor
self.cores_per_task = self.thread_count / threads_per_core

os.environ["OMP_NUM_THREADS"] = str(self.thread_count)
if self.get_build_threaded():
os.environ["OMP_NUM_THREADS"] = str(self.thread_count)

self.srun_binding = smt_factor*max_mpitasks_per_node / self.tasks_per_node

Expand Down Expand Up @@ -1411,7 +1412,8 @@ def load_env(self, reset=False, job=None, verbose=False):
if not self._is_env_loaded or reset:
if job is None:
job = self.get_primary_job()
os.environ["OMP_NUM_THREADS"] = str(self.thread_count)
if self.get_build_threaded():
os.environ["OMP_NUM_THREADS"] = str(self.thread_count)
env_module = self.get_env("mach_specific")
env_module.load_env(self, job=job, verbose=verbose)
self._is_env_loaded = True
Expand Down
3 changes: 2 additions & 1 deletion scripts/lib/CIME/case/case_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ def _run_model_impl(case, lid, skip_pnl=False, da_cycle=0):
model = case.get_value("MODEL")

# Set OMP_NUM_THREADS
os.environ["OMP_NUM_THREADS"] = str(case.thread_count)
if case.get_build_threaded():
os.environ["OMP_NUM_THREADS"] = str(case.thread_count)

# Run the model
cmd = case.get_mpirun_cmd(allow_unresolved_envvars=False)
Expand Down

0 comments on commit f184078

Please sign in to comment.