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

Support mpi4py > 2.0 #382

Merged
merged 4 commits into from Nov 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions dependencies.py
Expand Up @@ -15,8 +15,8 @@ def _pyside(rev, marker=True):
_QT_COMMENT = 'solution visualization for builtin discretizations'
_PYTEST = 'pytest>=3.2'
tests_require = [_PYTEST, 'pytest-cov', 'envparse', 'docker']
install_requires = ['cython>=0.20.1', 'numpy>=1.8.1', 'scipy>=0.13.3', 'Sphinx>=1.4.0', 'docopt', 'Qt.py>=1.0.0b3']
setup_requires = ['pytest-runner>=2.9', 'cython>=0.20.1', 'numpy>=1.8.1']
install_requires = ['cython>=0.20.1', 'numpy>=1.8.1', 'scipy>=0.13.3', 'Sphinx>=1.4.0', 'docopt', 'Qt.py>=1.0.0b3', 'packaging']
setup_requires = ['pytest-runner>=2.9', 'cython>=0.20.1', 'numpy>=1.8.1', 'packaging']
install_suggests = {'ipython>=3.0': 'an enhanced interactive python shell',
'ipyparallel': 'required for pymor.parallel.ipython',
'matplotlib': 'needed for error plots in demo scipts',
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Expand Up @@ -4,5 +4,6 @@ Sphinx>=1.4.0
cython>=0.20.1
docopt
numpy>=1.8.1
packaging
pytest-runner>=2.9
scipy>=0.13.3
10 changes: 6 additions & 4 deletions src/pymor/tools/mpi.py
Expand Up @@ -53,6 +53,8 @@

import sys

from packaging.version import Version

from pymor.core.config import config
from pymor.core.defaults import defaults
from pymor.core.pickle import dumps, loads
Expand All @@ -64,14 +66,14 @@
rank = comm.Get_rank()
size = comm.Get_size()
finished = False
mpi4py_version = list(map(int, mpi4py.__version__.split('.')))
if mpi4py_version >= [2, 0]:
mpi4py_version = Version(mpi4py.__version__)
if mpi4py_version == Version('2.0'):
import pymor.core.pickle
MPI.pickle.PROTOCOL = pymor.core.pickle.PROTOCOL
MPI.pickle.loads = pymor.core.pickle.loads
MPI.pickle.dumps = pymor.core.pickle.dumps
else:
mpi4py_version = []
mpi4py_version = Version('0.0')
rank = 0
size = 1
finished = True
Expand Down Expand Up @@ -99,7 +101,7 @@ def event_loop_settings(auto_launch=True):
return {'auto_launch': auto_launch}


if mpi4py_version >= [2, 0]:
if mpi4py_version == Version('2.0'):
def event_loop():
"""Launches an MPI-based event loop.

Expand Down