add MPI_INC_DIRS and MPI_LIB_DIRS to HDF5_XXX_DIRS

Issue #1687 closed
Roland Haas created an issue

When using parallel HDF5 then hdf5 depends on MPI and hdf5.h includes mpi.h as well as libhdf5 linking to mpi routines.

The proposed patch adds MPI_INC_DIRS and MPI_LIB_DIRS to the corresponding variables of HDF5. This is the same as what is already done for zlib which is also a prerequisite of HDF5.

Tested to compile Cactus and utilities on stampede with and without parallel hdf5.

Keyword:

Comments (10)

  1. Barry Wardell
    • removed comment

    I haven't tried the patch, but it looks to me like you use ${MPI_LIBS} without it ever being set in the script. Does that really work?

    Also, the ${MPI_LIBS} are being added unconditionally. Would it be better to do something more like what's done for zlib and conditionally add the appropriate libs dependent on whether H5_HAVE_LIBMPI is set in H5pubconf.h?

  2. Erik Schnetter
    • removed comment

    It is not necessary to call the strip functions for the MPI variables since the MPI variables are not defined in this script, and presumably have already been stripped.

  3. Roland Haas reporter
    • removed comment

    Attached please find an updated patch. I have tied the MPI stuff to H5_HAVE_PARALLEL in H5pubconf.h rather than H5_HAVE_LIBMPI since there is also a H5_HAVE_LIBMPICH in the same file and H5_HAVE_PARALLEL is what is actually controlling the #include <mpi.h> statement. I suspect that this actually makes no difference in practise since for static MPI libraries the linker will not pick any object out of libmpi.a (or whatever) if hdf5 does not refer to it, while for dynamic linking the linking happens at runtime anyway. If MPI is not in the thornlist then all the MPI_XXX_DR variables will be empty strings.

    I have remove the stripping of MPI_XXX_DIRS as suggested.

    Note that ZLIB_XXX_DIRS is still passed through the stripping scripts (this was like this before, hence the MPI handling just copied this). ZLIB is handled very differently from MPI right now, it always adds ZLIB_LIBS (but not eg SZLIB_LIBS). HDF5's configure.sh also looks at LIBZ_DIR which is an option of zlib's configure.sh.

    The patch compiles on stampede with both phdf5+petsc and hdf5 (and not petsc) modules. In the later case I checked that HDF5's make.HDF5.defn in its Capabilities directory does not mention MPI.

  4. Log in to comment