[petsc-dev] detecting the wrong mpi.h

William Gropp wgropp at illinois.edu
Sat Jul 12 08:29:05 CDT 2014

Yes, with MPI-3 there is even a portable (sort of) way to do this.

The MPI-3 function MPI_Get_library_version gives you a string describing the library.  You can check this if you want exact correspondence to the one that you found at configure time.  This routine can be called without calling MPI_Init.  There are implementation-specific definitions that you could also look for and might allow you to check for compatible version - MPICH now keeps track of binary compatibility, so there is an MPICH ABI version value that can be checked if you found an MPICH version.


William Gropp
Director, Parallel Computing Institute
Thomas M. Siebel Chair in Computer Science
University of Illinois Urbana-Champaign

On Jul 11, 2014, at 10:36 PM, Barry Smith wrote:

>   Can at configure time we determine some information about the mpi.h that is being included and then store it in petscconf.h and have petscsys.h check it for all compiles so that that the difficult to debug problem of “wrong mpi.h” included is easier to deal with?
>   For example in petscsys.h
> #if defined(PETSC_MPICH_VERSION)   /* means PETSc was configured with MPICH */
> #if !defined(MPICH_VERSION) 
>   error the mpi.h included is not that which PETSc was configured with
> #else
>   error the mpi.h included is a different version then PETSc was configured with 
> #endif
> #endif
> and some similar check for other MPI implementations that contain some identifying information
>   Barry

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20140712/9582795e/attachment.html>

More information about the petsc-dev mailing list