Mpi4py v3

Hi - we’ve recently noticed that lammps.py is not compatible with mpi4py v3, apparently only because it explicitly tests for the major version being equal to ‘2’. It also gives no error if you pass a communicator and the mpi4py version it finds doesn’t allow it to use the communicator, so the communicator is silently ignored. What do you think about this patch to address both of these behaviors:

— lammps.py.orig 2018-03-06 22:21:12.424167429 +0000
+++ lammps.py 2018-03-06 22:23:54.587395109 +0000
@@ -48,7 +48,7 @@
try:
from mpi4py import MPI
from mpi4py import version as mpi4py_version

  • if mpi4py_version.split(’.’)[0] == ‘2’:
  • if mpi4py_version.split(’.’)[0] in [‘2’,‘3’]:
    has_mpi4py_v2 = True
    except:
    pass
    @@ -104,7 +104,10 @@

need to adjust for type of MPI communicator object

allow for int (like MPICH) or void* (like OpenMPI)

  • if lammps.has_mpi4py_v2 and comm != None:
  • if comm is not None:
  • if not lammps.has_mpi4py_v2:
  • raise Exception(‘passed comm but do not know what to do with it given mpi4py version’)

Hi - we’ve recently noticed that lammps.py is not compatible with mpi4py
v3, apparently only because it explicitly tests for the major version being
equal to ‘2’. It also gives no error if you pass a communicator and the
mpi4py version it finds doesn’t allow it to use the communicator, so the
communicator is silently ignored. What do you think about this patch to
address both of these behaviors:

​thanks for your suggestion.
this is now - with some minor edits - a pending pull request on github: ​
https://github.com/lammps/lammps/pull/831

axel.

We’re about to release a patch and then a stable release in the next week or so.

Will include this change.

Thanks,

Steve