[Darshan-commits] [Git][darshan/darshan][master] 8 commits: disable hdf module if version not specified

Shane Snyder xgitlab at cels.anl.gov
Fri Jan 27 15:31:53 CST 2017


Shane Snyder pushed to branch master at darshan / darshan


Commits:
b4569fcb by Phil Carns at 2017-01-22T21:06:18-05:00
disable hdf module if version not specified

- - - - -
0b434339 by Phil Carns at 2017-01-23T21:29:13-06:00
add configure option for older HDF5 API

- also rename option for newer API
- make the two options mutually exclusive

- - - - -
ff338b08 by Phil Carns at 2017-01-25T20:18:36-08:00
runtime safety check for HDF5 library version

- untested

- - - - -
7819ebd1 by Phil Carns at 2017-01-25T20:29:48-08:00
wrap get_libversion

- - - - -
c9b803c9 by Phil Carns at 2017-01-25T21:15:48-08:00
bug fix

- - - - -
201a8f9a by Phil Carns at 2017-01-25T21:39:46-08:00
update docs and changelog

- - - - -
72750511 by Shane Snyder at 2017-01-27T15:20:33-06:00
correct version numbers in config help text

- - - - -
a1637f82 by Shane Snyder at 2017-01-27T15:30:58-06:00
Merge branch 'issue-217-hdf5-abi-switch'

- - - - -


10 changed files:

- ChangeLog
- darshan-runtime/Makefile.in
- darshan-runtime/configure
- darshan-runtime/configure.in
- darshan-runtime/darshan-runtime-config.h.in
- darshan-runtime/doc/darshan-runtime.txt
- darshan-runtime/lib/darshan-hdf5-stubs.c
- darshan-runtime/lib/darshan-hdf5.c
- darshan-runtime/share/ld-opts/darshan-base-ld-opts.in
- darshan-runtime/share/ld-opts/darshan-hdf5-ld-opts


Changes:

=====================================
ChangeLog
=====================================
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,15 +4,17 @@ Darshan Release Change Log
 
 Darshan-3.1.3-pre1
 =============
-* add --enable-HDF5_1.10 configure option to explicitly enable HDF5 1.10+
-  support, needed on some platforms for API compatibility 
-  - contributed by Karl-Ulrich Bamberg
 * skip instrumentation attempts for anonymous mmap() calls; this avoids a
   potentential deadlock condition when used with hugepages on Cray systems.
   Reported by Glenn Lockwood and Cristian Simarro.
 * fix segmentation fault in statistics collection for applications that issue
   operations with a large number of distince access sizes or strides on the
   same file.  Reported by Glenn Lockwood.
+* disable HDF5 module by default unless enabled using --enable-HDF5-post-1.10
+  or --enable-HDF5-pre-1.10 configure arguments.  These options
+  vary the wrapper prototypes to match the corresponding HDF5 library ABI.
+  The initial patch for HDF5 1.10 compatibility was contributed by 
+  Karl-Ulrich Bamberg.
 
 Darshan-3.1.2
 =============


=====================================
darshan-runtime/Makefile.in
=====================================
--- a/darshan-runtime/Makefile.in
+++ b/darshan-runtime/Makefile.in
@@ -35,8 +35,15 @@ CFLAGS_SHARED = -DDARSHAN_CONFIG_H=\"darshan-runtime-config.h\" -I . -I$(srcdir)
 
 LIBS = -lz @LIBBZ2@
 
-DARSHAN_STATIC_MOD_OBJS = lib/darshan-posix.o lib/darshan-mpiio.o lib/darshan-hdf5.o lib/darshan-pnetcdf.o lib/darshan-stdio.o lib/darshan-dxt.o
-DARSHAN_DYNAMIC_MOD_OBJS = lib/darshan-posix.po lib/darshan-mpiio.po lib/darshan-hdf5.po lib/darshan-pnetcdf.po lib/darshan-stdio.po lib/darshan-dxt.po
+BUILD_HDF5_MODULE = @BUILD_HDF5_MODULE@
+
+DARSHAN_STATIC_MOD_OBJS = lib/darshan-posix.o lib/darshan-mpiio.o lib/darshan-pnetcdf.o lib/darshan-stdio.o lib/darshan-dxt.o
+DARSHAN_DYNAMIC_MOD_OBJS = lib/darshan-posix.po lib/darshan-mpiio.po lib/darshan-pnetcdf.po lib/darshan-stdio.po lib/darshan-dxt.po
+
+ifdef BUILD_HDF5_MODULE
+DARSHAN_STATIC_MOD_OBJS += lib/darshan-hdf5.o
+DARSHAN_DYNAMIC_MOD_OBJS += lib/darshan-hdf5.po
+endif
 
 ifdef DARSHAN_USE_BGQ
 DARSHAN_STATIC_MOD_OBJS += lib/darshan-bgq.o
@@ -151,8 +158,13 @@ lib/libdarshan.a: lib/darshan-core-init-finalize.o lib/darshan-core.o lib/darsha
 lib/libdarshan.so: lib/darshan-core-init-finalize.po lib/darshan-core.po lib/darshan-common.po $(DARSHAN_DYNAMIC_MOD_OBJS) lib/lookup3.po lib/lookup8.po
 	$(CC) $(CFLAGS_SHARED) $(LDFLAGS) -o $@ $^ -lpthread -lrt -lz -ldl
 
+ifdef BUILD_HDF5_MODULE
 lib/libdarshan-stubs.a: lib/darshan-hdf5-stubs.o lib/darshan-pnetcdf-stubs.o
 	ar rcs $@ $^
+else
+lib/libdarshan-stubs.a: lib/darshan-pnetcdf-stubs.o
+	ar rcs $@ $^
+endif
 
 
 install:: all
@@ -182,7 +194,9 @@ endif
 	install -d $(datarootdir)/ld-opts
 	install -m 644 share/ld-opts/darshan-base-ld-opts $(datarootdir)/ld-opts/darshan-base-ld-opts
 	install -m 644 $(srcdir)/share/ld-opts/darshan-posix-ld-opts $(datarootdir)/ld-opts/darshan-posix-ld-opts
+ifdef BUILD_HDF5_MODULE
 	install -m 644 $(srcdir)/share/ld-opts/darshan-hdf5-ld-opts $(datarootdir)/ld-opts/darshan-hdf5-ld-opts
+endif
 	install -m 644 $(srcdir)/share/ld-opts/darshan-pnetcdf-ld-opts $(datarootdir)/ld-opts/darshan-pnetcdf-ld-opts
 	install -m 644 $(srcdir)/share/ld-opts/darshan-stdio-ld-opts $(datarootdir)/ld-opts/darshan-stdio-ld-opts
 ifdef ENABLE_MMAP_LOGS


=====================================
darshan-runtime/configure
=====================================
--- a/darshan-runtime/configure
+++ b/darshan-runtime/configure
@@ -621,6 +621,8 @@ ac_includes_default="\
 
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
+DARSHAN_HDF5_LD_OPTS
+BUILD_HDF5_MODULE
 DARSHAN_USE_LUSTRE
 DARSHAN_USE_BGQ
 MPICH_LIB_OLD
@@ -690,7 +692,6 @@ with_zlib
 enable_ld_preload
 enable_cuserid
 enable_group_readable_logs
-enable_HDF5_1_10
 enable_bgq_mod
 enable_lustre_mod
 enable_mmap_logs
@@ -700,6 +701,8 @@ with_log_hints
 with_log_path
 with_jobid_env
 with_mod_mem
+enable_HDF5_post_1_10
+enable_HDF5_pre_1_10
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1334,10 +1337,13 @@ Optional Features:
   --disable-cuserid       Disables attempted use of cuserid() at run time
   --enable-group-readable-logs
                           Set log files to be group readable
-  --enable-HDF5_1.10       Compile for use with HDF5 1.10.x
   --disable-bgq-mod       Disables compilation and use of BG/Q module (for BG/Q systems)
   --disable-lustre-mod    Disables compilation and use of the Lustre module
   --enable-mmap-logs      Enables ability to mmap I/O data to log file
+  --enable-HDF5-post-1.10
+                          Enable HDF5 module for HDF5 version 1.10 or later
+  --enable-HDF5-pre-1.10
+                          Enable HDF5 module for HDF5 version 1.8 or earlier
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -3583,17 +3589,6 @@ fi
 fi
 
 
-# Check whether --enable-HDF5_1.10 was given.
-if test "${enable_HDF5_1_10+set}" = set; then :
-  enableval=$enable_HDF5_1_10; if test "x$enableval" = "xyes" ; then
-
-$as_echo "#define __DARSHAN_ENABLE_HDF5110 1" >>confdefs.h
-
-fi
-
-fi
-
-
 # Check whether --enable-bgq-mod was given.
 if test "${enable_bgq_mod+set}" = set; then :
   enableval=$enable_bgq_mod;
@@ -4208,6 +4203,38 @@ eval darshan_share_path=$datarootdir
 prefix=$savePrefix
 exec_prefix=$saveExecprefix
 
+BUILD_HDF5_MODULE=
+DARSHAN_HDF5_LD_OPTS=
+
+# see if user explicitly enabled support for an HDF5 API
+# Check whether --enable-HDF5-post-1.10 was given.
+if test "${enable_HDF5_post_1_10+set}" = set; then :
+  enableval=$enable_HDF5_post_1_10; if test "x$enableval" = "xyes" ; then
+
+$as_echo "#define __DARSHAN_ENABLE_HDF5110 1" >>confdefs.h
+
+    if test "x$BUILD_HDF5_MODULE" = "x1"; then
+        as_fn_error $? "Cannot set both --enable-HDF5-post-1.10 and --enable-HDF5-pre-1.10" "$LINENO" 5
+    fi
+    BUILD_HDF5_MODULE=1
+    DARSHAN_HDF5_LD_OPTS="${darshan_share_path}/ld-opts/darshan-hdf5-ld-opts"
+fi
+
+fi
+
+# Check whether --enable-HDF5-pre-1.10 was given.
+if test "${enable_HDF5_pre_1_10+set}" = set; then :
+  enableval=$enable_HDF5_pre_1_10; if test "x$enableval" = "xyes" ; then
+    if test "x$BUILD_HDF5_MODULE" = "x1"; then
+        as_fn_error $? "Cannot set both --enable-HDF5-post-1.10 and --enable-HDF5-pre-1.10" "$LINENO" 5
+    fi
+    BUILD_HDF5_MODULE=1
+    DARSHAN_HDF5_LD_OPTS="${darshan_share_path}/ld-opts/darshan-hdf5-ld-opts"
+fi
+
+fi
+
+
 # determine if the MPI library includes MPI-IO functions or not
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPI-IO support in MPI" >&5
 $as_echo_n "checking for MPI-IO support in MPI... " >&6; }
@@ -4384,6 +4411,8 @@ DARSHAN_VERSION="3.1.2"
 
 
 
+
+
 ac_config_files="$ac_config_files Makefile darshan-mk-log-dirs.pl darshan-gen-cc.pl darshan-gen-cxx.pl darshan-gen-fortran.pl darshan-config share/craype-1.x/darshan-module share/craype-2.x/darshan-module lib/pkgconfig/darshan-runtime.pc share/mpi-profile/darshan-cc.conf share/mpi-profile/darshan-cxx.conf share/mpi-profile/darshan-f.conf share/mpi-profile/darshan-bg-cc.conf share/mpi-profile/darshan-bg-cxx.conf share/mpi-profile/darshan-bg-f.conf share/ld-opts/darshan-base-ld-opts"
 
 cat >confcache <<\_ACEOF


=====================================
darshan-runtime/configure.in
=====================================
--- a/darshan-runtime/configure.in
+++ b/darshan-runtime/configure.in
@@ -46,13 +46,6 @@ AC_ARG_ENABLE(group-readable-logs,
 fi]
 ,)
 
-AC_ARG_ENABLE(HDF5_1.10,
-[  --enable-HDF5_1.10       Compile for use with HDF5 1.10.x],
-[if test "x$enableval" = "xyes" ; then
-    AC_DEFINE(__DARSHAN_ENABLE_HDF5110, 1, Set for compatibility with HDF5_1.10.x, breaks use with 1.8.x)
-fi]
-,)
-
 AC_ARG_ENABLE(
     [bgq-mod],
     [  --disable-bgq-mod       Disables compilation and use of BG/Q module (for BG/Q systems)],
@@ -262,6 +255,34 @@ eval darshan_share_path=$datarootdir
 prefix=$savePrefix
 exec_prefix=$saveExecprefix
 
+BUILD_HDF5_MODULE=
+DARSHAN_HDF5_LD_OPTS=
+
+# see if user explicitly enabled support for an HDF5 API
+AC_ARG_ENABLE(HDF5-post-1.10,
+[  --enable-HDF5-post-1.10
+                          Enable HDF5 module for HDF5 version 1.10 or later],
+[if test "x$enableval" = "xyes" ; then
+    AC_DEFINE(__DARSHAN_ENABLE_HDF5110, 1, Set for compatibility with HDF5 1.10.x, breaks use with versions earlier than 1.10)
+    if test "x$BUILD_HDF5_MODULE" = "x1"; then
+        AC_MSG_ERROR([Cannot set both --enable-HDF5-post-1.10 and --enable-HDF5-pre-1.10])
+    fi
+    BUILD_HDF5_MODULE=1
+    DARSHAN_HDF5_LD_OPTS="${darshan_share_path}/ld-opts/darshan-hdf5-ld-opts"
+fi]
+,)
+AC_ARG_ENABLE(HDF5-pre-1.10,
+[  --enable-HDF5-pre-1.10
+                          Enable HDF5 module for HDF5 versions earlier than 1.10],
+[if test "x$enableval" = "xyes" ; then
+    if test "x$BUILD_HDF5_MODULE" = "x1"; then
+        AC_MSG_ERROR([Cannot set both --enable-HDF5-post-1.10 and --enable-HDF5-pre-1.10])
+    fi
+    BUILD_HDF5_MODULE=1
+    DARSHAN_HDF5_LD_OPTS="${darshan_share_path}/ld-opts/darshan-hdf5-ld-opts"
+fi]
+,)
+
 # determine if the MPI library includes MPI-IO functions or not
 AC_MSG_CHECKING(for MPI-IO support in MPI)
 AC_TRY_LINK([#include <mpi.h>], [
@@ -359,6 +380,8 @@ AC_SUBST(DARSHAN_VERSION)
 AC_SUBST(MPICH_LIB_OLD)
 AC_SUBST(DARSHAN_USE_BGQ)
 AC_SUBST(DARSHAN_USE_LUSTRE)
+AC_SUBST(BUILD_HDF5_MODULE)
+AC_SUBST(DARSHAN_HDF5_LD_OPTS)
 AC_OUTPUT(Makefile
 darshan-mk-log-dirs.pl
 darshan-gen-cc.pl


=====================================
darshan-runtime/darshan-runtime-config.h.in
=====================================
--- a/darshan-runtime/darshan-runtime-config.h.in
+++ b/darshan-runtime/darshan-runtime-config.h.in
@@ -87,7 +87,7 @@
 /* Define if cuserid() should be disabled */
 #undef __DARSHAN_DISABLE_CUSERID
 
-/* Set for compatibility with HDF5_1.10.x */
+/* Set for compatibility with HDF5 1.10.x */
 #undef __DARSHAN_ENABLE_HDF5110
 
 /* Define if Darshan should mmap data structures to log file */


=====================================
darshan-runtime/doc/darshan-runtime.txt
=====================================
--- a/darshan-runtime/doc/darshan-runtime.txt
+++ b/darshan-runtime/doc/darshan-runtime.txt
@@ -76,6 +76,10 @@ header and library.
 and only builds if BG/Q environment detected).
 * `--enable-group-readable-logs`: sets darshan log file permissions to allow
 group read access.
+* `--enable-HDF5-pre-1.10`: enables the Darshan HDF5 instrumentation module,
+with support for HDF5 versions prior to 1.10
+* `--enable-HDF5-post-1.10`: enables the Darshan HDF5 instrumentation module,
+with support for HDF5 versions 1.10 or higher
 
 === Cross compilation
 


=====================================
darshan-runtime/lib/darshan-hdf5-stubs.c
=====================================
--- a/darshan-runtime/lib/darshan-hdf5-stubs.c
+++ b/darshan-runtime/lib/darshan-hdf5-stubs.c
@@ -70,6 +70,21 @@ herr_t H5Fclose(hid_t file_id)
     return(-1);
 }
 
+herr_t H5get_libversion(unsigned *majnum, unsigned *minnum, unsigned *relnum) __attribute__((weak));
+
+herr_t H5get_libversion(unsigned *majnum, unsigned *minnum, unsigned *relnum)
+{
+    int rank;
+
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+    if(rank == 0)
+    {
+        fprintf(stderr, "WARNING: Darshan H5get_libversion() stub called; this is probably the result of a link-time problem.\n");
+    }
+
+    return(-1);
+}
+
 /*
  * Local variables:
  *  c-indent-level: 4


=====================================
darshan-runtime/lib/darshan-hdf5.c
=====================================
--- a/darshan-runtime/lib/darshan-hdf5.c
+++ b/darshan-runtime/lib/darshan-hdf5.c
@@ -36,6 +36,7 @@ typedef int herr_t;     //hf5-1.10.0p1: H5public.h:126
 DARSHAN_FORWARD_DECL(H5Fcreate, hid_t, (const char *filename, unsigned flags, hid_t create_plist, hid_t access_plist));
 DARSHAN_FORWARD_DECL(H5Fopen, hid_t, (const char *filename, unsigned flags, hid_t access_plist));
 DARSHAN_FORWARD_DECL(H5Fclose, herr_t, (hid_t file_id));
+DARSHAN_FORWARD_DECL(H5get_libversion, herr_t, (unsigned *majnum, unsigned *minnum, unsigned *relnum));
 
 /* structure that can track i/o stats for a given HDF5 file record at runtime */
 struct hdf5_file_record_ref
@@ -120,6 +121,24 @@ hid_t DARSHAN_DECL(H5Fcreate)(const char *filename, unsigned flags,
     hid_t ret;
     char* tmp;
     double tm1;
+    unsigned majnum, minnum, relnum;
+
+    MAP_OR_FAIL(H5get_libversion);
+    __real_H5get_libversion(&majnum, &minnum, &relnum);
+#ifdef __DARSHAN_ENABLE_HDF5110
+    if(majnum < 1 || (majnum == 1 && minnum < 10))
+#else
+    if(majnum > 1 || (majnum == 1 && minnum >= 10))
+#endif
+    {
+        if(my_rank < 0)
+            MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
+        if(my_rank == 0)
+        {
+            fprintf(stderr, "Darshan HDF5 module error: runtime library version does not match Darshan module.\n");
+        }
+        return(-1);
+    }
 
     MAP_OR_FAIL(H5Fcreate);
 
@@ -151,6 +170,24 @@ hid_t DARSHAN_DECL(H5Fopen)(const char *filename, unsigned flags,
     hid_t ret;
     char* tmp;
     double tm1;
+    unsigned majnum, minnum, relnum;
+
+    MAP_OR_FAIL(H5get_libversion);
+    __real_H5get_libversion(&majnum, &minnum, &relnum);
+#ifdef __DARSHAN_ENABLE_HDF5110
+    if(majnum < 1 || (majnum == 1 && minnum < 10))
+#else
+    if(majnum > 1 || (majnum == 1 && minnum >= 10))
+#endif
+    {
+        if(my_rank < 0)
+            MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
+        if(my_rank == 0)
+        {
+            fprintf(stderr, "Darshan HDF5 module error: runtime library version does not match Darshan module.\n");
+        }
+        return(-1);
+    }
 
     MAP_OR_FAIL(H5Fopen);
 


=====================================
darshan-runtime/share/ld-opts/darshan-base-ld-opts.in
=====================================
--- a/darshan-runtime/share/ld-opts/darshan-base-ld-opts.in
+++ b/darshan-runtime/share/ld-opts/darshan-base-ld-opts.in
@@ -1,6 +1,6 @@
 --undefined=MPI_Init
 --undefined=MPI_Wtime
 @@darshan_share_path@/ld-opts/darshan-posix-ld-opts
-@@darshan_share_path@/ld-opts/darshan-hdf5-ld-opts
 @@darshan_share_path@/ld-opts/darshan-pnetcdf-ld-opts
 @@darshan_share_path@/ld-opts/darshan-stdio-ld-opts
+@@DARSHAN_HDF5_LD_OPTS@


=====================================
darshan-runtime/share/ld-opts/darshan-hdf5-ld-opts
=====================================
--- a/darshan-runtime/share/ld-opts/darshan-hdf5-ld-opts
+++ b/darshan-runtime/share/ld-opts/darshan-hdf5-ld-opts
@@ -2,3 +2,4 @@
 --wrap=H5Fcreate
 --wrap=H5Fopen
 --wrap=H5Fclose
+--wrap=H5get_libversion



View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/compare/c49c9a1e8a8eb4d3dd108855bf012806acef1e40...a1637f8237fdfdc2ba3c28f9bc23d660a19b6f9e
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/darshan-commits/attachments/20170127/87fc95ff/attachment-0001.html>


More information about the Darshan-commits mailing list