Skip to content

Commit fcae4f7

Browse files
committed
Fixing the base interface _run_interface function for NiftyRegCommand for setting the OMP default value.
1 parent 8398de7 commit fcae4f7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

nipype/interfaces/niftyreg/base.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,11 @@ def exists(self):
105105
def _run_interface(self, runtime):
106106
# Update num threads estimate from OMP_NUM_THREADS env var
107107
# Default to 1 if not set
108-
if not isdefined(self.inputs.environ['OMP_NUM_THREADS']):
109-
self.inputs.environ['OMP_NUM_THREADS'] = self.num_threads
108+
omp_key = 'OMP_NUM_THREADS'
109+
if omp_key in os.environ:
110+
self.inputs.environ[omp_key] = os.environ[omp_key]
111+
else:
112+
self.inputs.environ[omp_key] = str(self.num_threads)
110113
return super(NiftyRegCommand, self)._run_interface(runtime)
111114

112115
def _format_arg(self, name, spec, value):

0 commit comments

Comments
 (0)