Say that /path/to/mpi/bin is in my PATH. I can then invoke e.g. mpicc and mpiexec. If I now want to programmatically determine which MPI implementation I am dealing with (e.g. OpenMPI, MPICH), how could I do this?
The solution I got so far is to grep for some more og less arbitrary string in the output of e.g. mpiexec --version.
Specifically I need to distinguish between OpenMPI and MPICH, but a general solution would of course be nice.
You can do that with MPI_Get_library_version