On Wed, Sep 12, 2007 at 02:55:42PM -0500, Quincey Koziol wrote:
> This should probably be "H5Pget_fapl_mpio" instead.
Indeed it should. A little search and replace on configure got us
past that issue. Now USE_PARALLEL_MPIO gets defined, but that's not
the true cause of the build errors I was seeing.
On Wed, Sep 12, 2007 at 01:55:54PM -0600, Ed Hartnett wrote:
> Try commenting out the two lines that redefine MPI_Comm and
> MPI_Info...
Ed is the winner!
It turns out libsrc4/netcdf.h has some incorrect checks with regards
to MPI: the '#ifndef MPI_Comm' and '#ifndef MPI_Info' checks just
won't work with MPICH2.
I've bludgeoned the code into compiling, and attached the patch. Some
things to note:
- conditionally include mpi.h in libsrc4/netcdf.h
- include config.h in libsrc4/netcdf.h, so as to correctly
conditionally redefine MPI_Comm and MPI_Info. Leave Comm and Info
alone if USE_PARALLEL_MPIO defined.
- rearrange header files to work around brokenness in MPI-2 C++
standard. The standard wants SEEK_SET SEEK_CUR and SEEK_END in
MPI's namespace, but those values collide with those in stdio.h and
iostream. Yeah, it's gross. I had nothing to do with MPI's C++
interface!
I'm not suggesting you apply the attached patch. Just wanted to
document what I had to do to get things building. There might be a
more "netcdf4" way to accomplish the same things and if so, fantastic.
Thanks much for all your help. In the end, I don't think I really
need h5pcc as long as I use mpicc, and --enable-parallel happens
automatically as long as --with-hdf5 and --enable-netcdf4 are given.
==rob
--
Rob Latham
Mathematics and Computer Science Division A215 0178 EA2D B059 8CDF
Argonne National Lab, IL USA B29D F333 664A 4280 315B
diff -burpN -x build -x autom4te.cache -x 'cscope*' -x '*~'
netcdf-4.0-beta1.dist/configure netcdf-4.0-beta1/configure
--- netcdf-4.0-beta1.dist/configure 2007-04-23 07:37:00.000000000 -0500
+++ netcdf-4.0-beta1/configure 2007-09-12 15:06:22.000000000 -0500
@@ -29104,9 +29104,9 @@ _ACEOF
fi
# The user may have parallel HDF5 based on MPI mumble mumble.
- { echo "$as_me:$LINENO: checking for H5Pget_fapl_mpipo in -lhdf5" >&5
-echo $ECHO_N "checking for H5Pget_fapl_mpipo in -lhdf5... $ECHO_C" >&6; }
-if test "${ac_cv_lib_hdf5_H5Pget_fapl_mpipo+set}" = set; then
+ { echo "$as_me:$LINENO: checking for H5Pget_fapl_mpio in -lhdf5" >&5
+echo $ECHO_N "checking for H5Pget_fapl_mpio in -lhdf5... $ECHO_C" >&6; }
+if test "${ac_cv_lib_hdf5_H5Pget_fapl_mpio+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -29124,11 +29124,11 @@ cat >>conftest.$ac_ext <<_ACEOF
#ifdef __cplusplus
extern "C"
#endif
-char H5Pget_fapl_mpipo ();
+char H5Pget_fapl_mpio ();
int
main ()
{
-return H5Pget_fapl_mpipo ();
+return H5Pget_fapl_mpio ();
;
return 0;
}
@@ -29151,21 +29151,21 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
- ac_cv_lib_hdf5_H5Pget_fapl_mpipo=yes
+ ac_cv_lib_hdf5_H5Pget_fapl_mpio=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_cv_lib_hdf5_H5Pget_fapl_mpipo=no
+ ac_cv_lib_hdf5_H5Pget_fapl_mpio=no
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_hdf5_H5Pget_fapl_mpipo" >&5
-echo "${ECHO_T}$ac_cv_lib_hdf5_H5Pget_fapl_mpipo" >&6; }
-if test $ac_cv_lib_hdf5_H5Pget_fapl_mpipo = yes; then
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_hdf5_H5Pget_fapl_mpio" >&5
+echo "${ECHO_T}$ac_cv_lib_hdf5_H5Pget_fapl_mpio" >&6; }
+if test $ac_cv_lib_hdf5_H5Pget_fapl_mpio = yes; then
enable_parallel_mpio=yes
fi
diff -burpN -x build -x autom4te.cache -x 'cscope*' -x '*~'
netcdf-4.0-beta1.dist/configure.ac netcdf-4.0-beta1/configure.ac
--- netcdf-4.0-beta1.dist/configure.ac 2007-04-23 07:36:04.000000000 -0500
+++ netcdf-4.0-beta1/configure.ac 2007-09-12 16:00:49.000000000 -0500
@@ -859,7 +859,7 @@ if test "x$enable_netcdf_4" = xyes; then
fi
# The user may have parallel HDF5 based on MPI mumble mumble.
- AC_CHECK_LIB([hdf5], [H5Pget_fapl_mpipo], [enable_parallel_mpio=yes], [])
+ AC_CHECK_LIB([hdf5], [H5Pget_fapl_mpio], [enable_parallel_mpio=yes], [])
if test "x$enable_parallel_mpio" = xyes; then
AC_DEFINE([USE_PARALLEL_MPIO], [1], [if true, compile in parallel
netCDF-4 based on MPI/IO])
fi
diff -burpN -x build -x autom4te.cache -x 'cscope*' -x '*~'
netcdf-4.0-beta1.dist/cxx/ncvalues.cpp netcdf-4.0-beta1/cxx/ncvalues.cpp
--- netcdf-4.0-beta1.dist/cxx/ncvalues.cpp 2006-12-29 10:38:56.000000000
-0600
+++ netcdf-4.0-beta1/cxx/ncvalues.cpp 2007-09-12 15:55:03.000000000 -0500
@@ -8,10 +8,10 @@
*********************************************************************/
#include <config.h>
+#include "ncvalues.h"
#include <iostream>
#include <string>
-#include "ncvalues.h"
NcValues::NcValues( void ) : the_type(ncNoType), the_number(0)
{}
diff -burpN -x build -x autom4te.cache -x 'cscope*' -x '*~'
netcdf-4.0-beta1.dist/cxx/ncvalues.h netcdf-4.0-beta1/cxx/ncvalues.h
--- netcdf-4.0-beta1.dist/cxx/ncvalues.h 2006-07-26 16:12:06.000000000
-0500
+++ netcdf-4.0-beta1/cxx/ncvalues.h 2007-09-12 15:54:17.000000000 -0500
@@ -10,10 +10,10 @@
#ifndef Ncvalues_def
#define Ncvalues_def
+#include "netcdf.h"
#include <iostream>
#include <sstream>
#include <limits.h>
-#include "netcdf.h"
// Documentation warned this might change and now it has, for
// consistency with C interface
diff -burpN -x build -x autom4te.cache -x 'cscope*' -x '*~'
netcdf-4.0-beta1.dist/cxx/netcdf.cpp netcdf-4.0-beta1/cxx/netcdf.cpp
--- netcdf-4.0-beta1.dist/cxx/netcdf.cpp 2007-04-02 15:55:02.000000000
-0500
+++ netcdf-4.0-beta1/cxx/netcdf.cpp 2007-09-12 15:50:51.000000000 -0500
@@ -10,8 +10,8 @@
#include <config.h>
#include <string.h>
#include <stdlib.h>
-#include <iostream>
#include "netcdfcpp.h"
+#include <iostream> /* SEEK_SET/SEEK_CUR/SEEK_END namespace collisions */
#ifndef TRUE
#define TRUE 1
diff -burpN -x build -x autom4te.cache -x 'cscope*' -x '*~'
netcdf-4.0-beta1.dist/libsrc4/netcdf.h netcdf-4.0-beta1/libsrc4/netcdf.h
--- netcdf-4.0-beta1.dist/libsrc4/netcdf.h 2007-04-10 15:17:10.000000000
-0500
+++ netcdf-4.0-beta1/libsrc4/netcdf.h 2007-09-12 15:48:00.000000000 -0500
@@ -37,6 +37,10 @@
#include <stddef.h> /* size_t, ptrdiff_t */
#include <errno.h> /* netcdf functions sometimes return system errors */
+#include <config.h>
+#ifdef USE_PARALLEL_MPIO
+#include <mpi.h>
+#endif
typedef int nc_type;
@@ -343,12 +347,14 @@ nc_open(const char *path, int mode, int
/* If these aren't defined, then define them as ints, because we must
* be building without parallel. */
+#ifndef USE_PARALLEL_MPIO
#ifndef MPI_Comm
#define MPI_Comm int
#endif
#ifndef MPI_Info
#define MPI_Info int
#endif
+#endif
EXTERNL int
nc_create_par(const char *path, int cmode, MPI_Comm comm, MPI_Info info,