Skip to content

Commit 7a441d0

Browse files
committed
On Windows use psutil for probing number of available cores in MPI
(Fix for #2351)
1 parent f9603a9 commit 7a441d0

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

tools/Python/mcrun/mccode.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import sys
44
import re
55
import shutil
6+
import psutil
67

78
if not os.name == 'nt':
89
import shlex as lexer
@@ -441,6 +442,7 @@ def runMPI(self, args, pipe=False, override_mpi=None):
441442
LOG.info('Using system default number of mpirun -np processes')
442443
if os.name == 'nt':
443444
mpi_flags = [''] # msmpi mpiexec.exe does not accept --
445+
mpi_flags = ['-np', str(psutil.cpu_count(logical=False))] # probe number of available (non-logical) CPU's
444446
else:
445447
mpi_flags = ['--'] # ... whereas openmpi mpirun does.
446448
elif int(self.options.mpi) >= 1:

0 commit comments

Comments
 (0)