[petsc-users] Scraping MPI information from PETSc conf

Jed Brown jed at jedbrown.org
Thu Feb 27 20:08:40 CST 2020


If determining mpicc is sufficient, this will work

  pkg-config --var=ccompiler PETSc

We also define

$ grep NUMVERSION mpich-optg/include/petscconf.h 
#define PETSC_HAVE_MPICH_NUMVERSION 30302300

or

$ grep OMPI_ ompi-optg/include/petscconf.h 
#define PETSC_HAVE_OMPI_MAJOR_VERSION 4
#define PETSC_HAVE_OMPI_MINOR_VERSION 0
#define PETSC_HAVE_OMPI_RELEASE_VERSION 2

which PETSc uses to raise a compile-time error if it believes you're
compiling PETSc code using an incompatible MPI.

Note that some of this is hidden in the environment on Cray systems, for
example, where CC=cc regardless of what compiler you're actually using.

Alexander Lindsay <alexlindsay239 at gmail.com> writes:

> What's the cleanest way to determine the MPI install used to build PETSc?
> We are configuring a an MPI-based C++ library with autotools  that will
> eventually be used by libMesh, and we'd like to make sure that this library
> (as well as libMesh) uses the same MPI that PETSc used or at worst detect
> our own and then error/warn the user if its an MPI that differs from the
> one used to build PETc. It seems like the only path info that shows up is
> in MPICXX_SHOW, PETSC_EXTERNAL_LIB_BASIC, and PETSC_WITH_EXTERNAL_LIB (I'm
> looking in petscvariables). I'm willing to learn the m4/portable shell
> built-ins necessary to parse those variables and come out with an mpi-dir,
> but before doing that figured I'd ask here and see if I'm missing something
> easier.
>
> Alex


More information about the petsc-users mailing list