[mpich-discuss] detect which MPI is installed

Anthony Chan chan at mcs.anl.gov
Tue Oct 11 10:37:18 CDT 2011


Not sure about mpiexec (but mpiexec should have implementation specific flags).

One way to tell what MPI implementation (MPICH2 vs OpenMPI) is through
the header files, e.g. mpicc.  OpenMPI and MPICH2 defines implementation
specific macros in mpi.h, so the following program should work

> cat testmpi.c 
#include "mpi.h"

#if defined(MPICH2)
#error This is MPICH2
#elif defined(OPEN_MPI)
#error This is OpenMPI
#else
#error Unknown MPI implementation
#endif

> $MPICH2_DIR/bin/mpicc -c testmpi.c
testmpi.c(4): catastrophic error: #error directive: This is MPICH2
  #error This is MPICH2
   ^

compilation aborted for testmpi.c (code 4)

> $OPENMPI_DIR/bin/mpicc -c testmpi.c
testmpi.c:6:2: error: #error This is OpenMPI

A.Chan

----- Original Message -----
> Hi all,
> do you know a mechanism to detect which kind of MPI (e.g. MPICH,
> OpenMPI, Win MPI etc.) is the one available via mpiexec?
> I need to pass some mpiexec specific flags to my programme before
> actually calling mpiexec.
> I know some mpiexecs support the --version flag, but not all )-:
> 
> Many TIA,
> -- Jan Hegewald
> _______________________________________________
> mpich-discuss mailing list mpich-discuss at mcs.anl.gov
> To manage subscription options or unsubscribe:
> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss


More information about the mpich-discuss mailing list