Source: h5py
Followup-For: Bug #944769
It might not be so simple. Some of the code is cython, so the obvious
runtime tests don't work, not via os.getenv at least.
For instance, the instance of "if MPI:" in api_types_ext.pxd can be
patched to
from os import getenv as os_getenv
OPENMPI_MULTIPROC = os_getenv('OMPI_COMM_WORLD_SIZE') and
int(os_getenv('OMPI_COMM_WORLD_SIZE')) > 1
MPICH_MULTIPROC = os_getenv('MPI_LOCALNRANKS') and
int(os_getenv('MPI_LOCALNRANKS'))>1
MPI_ACTIVE = MPI and ( OPENMPI_MULTIPROC or MPICH_MULTIPROC )
IF MPI_ACTIVE:
from mpi4py.MPI cimport MPI_Comm, MPI_Info, Comm, Info
But then during configuration cython fails:
Error compiling Cython file:
------------------------------------------------------------
...
from os import getenv as os_getenv
OPENMPI_MULTIPROC = os_getenv('OMPI_COMM_WORLD_SIZE') and
int(os_getenv('OMPI_COMM_WORLD_SIZE')) > 1
MPICH_MULTIPROC = os_getenv('MPI_LOCALNRANKS') and
int(os_getenv('MPI_LOCALNRANKS'))>1
MPI_ACTIVE = MPI and ( OPENMPI_MULTIPROC or MPICH_MULTIPROC )
IF MPI_ACTIVE:
^
------------------------------------------------------------
h5py/api_types_ext.pxd:22:3: Compile-time name 'MPI_ACTIVE' not defined
even though MPI_ACTIVE is defined in code right there.
I haven't coded in cython before, perhaps it needs a different syntax?