support checking the size of MPI communicators and fail if LAMMPS and mpi4py have a mismatch
This commit is contained in:
@ -325,6 +325,10 @@ class lammps(object):
|
|||||||
else:
|
else:
|
||||||
MPI_Comm = c_void_p
|
MPI_Comm = c_void_p
|
||||||
|
|
||||||
|
# Detect whether LAMMPS and mpi4py definitely use different MPI libs
|
||||||
|
if sizeof(MPI_Comm) != self.lib.lammps_config_has_mpi_support():
|
||||||
|
raise Exception('Inconsistent MPI library in LAMMPS and mpi4py')
|
||||||
|
|
||||||
narg = 0
|
narg = 0
|
||||||
cargs = None
|
cargs = None
|
||||||
if cmdargs:
|
if cmdargs:
|
||||||
|
|||||||
@ -4128,16 +4128,18 @@ void lammps_get_os_info(char *buffer, int buf_size)
|
|||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
/** This function is used to query whether LAMMPS was compiled with
|
/** This function is used to query whether LAMMPS was compiled with
|
||||||
* a real MPI library or in serial.
|
* a real MPI library or in serial. For the real MPI library it
|
||||||
|
* reports the size of the MPI communicator in bytes (4 or 8),
|
||||||
|
* which allows to check for compatibility with a hosting code.
|
||||||
*
|
*
|
||||||
* \return 0 when compiled with MPI STUBS, otherwise 1 */
|
* \return 0 when compiled with MPI STUBS, otherwise the MPI_Comm size in bytes */
|
||||||
|
|
||||||
int lammps_config_has_mpi_support()
|
int lammps_config_has_mpi_support()
|
||||||
{
|
{
|
||||||
#ifdef MPI_STUBS
|
#ifdef MPI_STUBS
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
return 1;
|
return sizeof(MPI_Comm);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user