-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
16 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,9 @@ | |
# Mainak Jas <[email protected]> | ||
|
||
import os | ||
import platform | ||
import os.path as op | ||
|
||
import sys | ||
import re | ||
import multiprocessing | ||
|
@@ -633,24 +636,23 @@ def __init__(self, n_procs=None, mpi_cmd='mpiexec'): | |
|
||
self.mpi_cmd = mpi_cmd | ||
|
||
if hyperthreading: | ||
self.mpi_cmd += ' --use-hwthread-cpus' | ||
|
||
if oversubscribe: | ||
self.mpi_cmd += ' --oversubscribe' | ||
if platform.system() == 'Windows': | ||
self.mpi_cmd += f' /np {self.n_procs}' | ||
use_posix = True | ||
else: | ||
if hyperthreading: | ||
self.mpi_cmd += ' --use-hwthread-cpus' | ||
if oversubscribe: | ||
self.mpi_cmd += ' --oversubscribe' | ||
|
||
self.mpi_cmd += ' -np ' + str(self.n_procs) | ||
self.mpi_cmd += f' -np {self.n_procs}' | ||
use_posix = False | ||
|
||
self.mpi_cmd += ' nrniv -python -mpi -nobanner ' + \ | ||
sys.executable + ' ' + \ | ||
os.path.join(os.path.dirname(sys.modules[__name__].__file__), | ||
'mpi_child.py') | ||
mpi_child_fname = op.join(op.dirname(__file__), 'mpi_child.py') | ||
self.mpi_cmd += (' nrniv -python -mpi -nobanner' | ||
f' python {mpi_child_fname}') | ||
|
||
# Split the command into shell arguments for passing to Popen | ||
if 'win' in sys.platform: | ||
use_posix = True | ||
else: | ||
use_posix = False | ||
self.mpi_cmd = shlex.split(self.mpi_cmd, posix=use_posix) | ||
|
||
def __enter__(self): | ||
|