Re: [netcdfgroup] NetCDF 4.0.1 with --enable-netcdf-4 conflicts with Open MPI by redefining MPI_Comm, etc

  • To: Constantine Khroulev <c.khroulev@xxxxxxxxx>
  • Subject: Re: [netcdfgroup] NetCDF 4.0.1 with --enable-netcdf-4 conflicts with Open MPI by redefining MPI_Comm, etc
  • From: Dennis Heimbigner <dmh@xxxxxxxxxxxxxxxx>
  • Date: Tue, 06 Oct 2009 10:25:01 -0600
The current setup in configure.ac for
netcdf-4 is to check to see if HDF5
was configured with mpi, and if so, then
to use '#include <mpi.h>' in
netcdf.h that is installed.

If hdf5 is not configured for mpi,
then it is necessary to include those
fake declarations (e.g. #define MPI_Comm int)
to allow other procedures in netcdf.h
to be compiled.

If you write a program that includes
mpi.h then indeed you will get conflicts;
so the question is: why are you including
mpi.h in your netcf programs? Does it work
ok if you remove the '#include <mpi.h>' ?

=Dennis Heimbigner



Constantine Khroulev wrote:
Hello,

I have a problem: NetCDF 4.0.1 adds the following lines to netcdf.h (HDF5 is, in fact, built without parallel I/O support.):

===
/* These defs added by netCDF configure because parallel HDF5 is not present. */
#define MPI_Comm int
#define MPI_Info int
#define MPI_COMM_WORLD 0
#define MPI_INFO_NULL 0
===

This (it seems to me) makes it impossible to use MPI (or PETSc) with NetCDF, producing warnings like
===
/opt/local/include/netcdf.h:43:1: warning: "MPI_COMM_WORLD" redefined
In file included from /Users/constantine/Documents/PISM/petsc-3.0.0-p0/include/petsc.h:137, from /Users/constantine/Documents/PISM/petsc-3.0.0-p0/include/petscis.h:7, from /Users/constantine/Documents/PISM/petsc-3.0.0-p0/include/petscvec.h:9, from /Users/constantine/Documents/PISM/petsc-3.0.0-p0/include/petscda.h:7,
                 from ../src/base/grid.cc:20:
===

and errors similar to
===
../src/base/grid.cc:64: error: invalid conversion from ‘int’ to ‘ompi_communicator_t*’
===

NetCDF 4.0.1 built without --enable-netcdf-4 works fine with the same code.

Please let me know if this is the intended behavior, if I'm doing something wrong, etc.

Thank you!



  • 2009 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: