Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CIs for MSMPI #590

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/windows_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ jobs:
with:
activate-environment: test
python-version: ${{ matrix.python-version }}
- name: Setup MPI
uses: mpi4py/setup-mpi@v1
with:
mpi: msmpi
- name: Install Neuron on Windows separately
shell: cmd
run: |
Expand All @@ -39,7 +43,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install flake8 pytest pytest-cov
pip install psutil joblib
pip install psutil joblib mpi4py
pip install --verbose .[gui]
- name: Test with pytest
shell: cmd
Expand Down
37 changes: 19 additions & 18 deletions hnn_core/parallel_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
# Mainak Jas <[email protected]>

import os
import platform
import os.path as op

import sys
import re
import multiprocessing
Expand Down Expand Up @@ -110,6 +113,8 @@ def run_subprocess(command, obj, timeout, proc_queue=None, *args, **kwargs):
child_data : object
The data returned by the child process.
"""
for cm in command:
print(cm)
proc_data_bytes = b''
# each loop while waiting will involve two Queue.get() timeouts, each
# 0.01s. This caclulation will error on the side of a longer timeout
Expand Down Expand Up @@ -631,27 +636,23 @@ def __init__(self, n_procs=None, mpi_cmd='mpiexec'):
warn(f'{packages} not installed. Will run on single processor')
self.n_procs = 1

self.mpi_cmd = mpi_cmd

if hyperthreading:
self.mpi_cmd += ' --use-hwthread-cpus'

if oversubscribe:
self.mpi_cmd += ' --oversubscribe'
# Split the command into shell arguments for passing to Popen
use_posix = True if platform.system() == 'Windows' else False
self.mpi_cmd = shlex.split(mpi_cmd, posix=use_posix)

self.mpi_cmd += ' -np ' + str(self.n_procs)
if platform.system() == 'Windows':
self.mpi_cmd.extend([r'/np', f'{self.n_procs}'])
else:
if hyperthreading:
self.mpi_cmd.append('--use-hwthread-cpus')
if oversubscribe:
self.mpi_cmd.append('--oversubscribe')

self.mpi_cmd += ' nrniv -python -mpi -nobanner ' + \
sys.executable + ' ' + \
os.path.join(os.path.dirname(sys.modules[__name__].__file__),
'mpi_child.py')
self.mpi_cmd.extend(['-np', f'{self.n_procs}'])

# 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)
mpi_child_fname = op.join(op.dirname(__file__), 'mpi_child.py')
self.mpi_cmd.extend(['nrniv', '-python', '-mpi', '-nobanner',
sys.executable, rf'{mpi_child_fname}'])

def __enter__(self):
global _BACKEND
Expand Down