[Darshan-commits] [Git][darshan/darshan][dev-detailed-hdf5-mod] more build/runtime logic for H5 version changes

Shane Snyder xgitlab at cels.anl.gov
Fri Apr 10 17:16:33 CDT 2020



Shane Snyder pushed to branch dev-detailed-hdf5-mod at darshan / darshan


Commits:
91949d47 by Shane Snyder at 2020-04-10T17:15:38-05:00
more build/runtime logic for H5 version changes

- - - - -


6 changed files:

- darshan-runtime/Makefile.in
- darshan-runtime/configure
- darshan-runtime/configure.in
- darshan-runtime/darshan-runtime-config.h.in
- darshan-runtime/lib/darshan-hdf5.c
- darshan-runtime/share/ld-opts/darshan-hdf5-ld-opts → darshan-runtime/share/ld-opts/darshan-hdf5-ld-opts.in


Changes:

=====================================
darshan-runtime/Makefile.in
=====================================
@@ -245,7 +245,7 @@ ifdef BUILD_PNETCDF_MODULE
 	install -m 644 $(srcdir)/share/ld-opts/darshan-pnetcdf-ld-opts $(DESTDIR)$(datarootdir)/ld-opts/darshan-pnetcdf-ld-opts
 endif
 ifdef BUILD_HDF5_MODULE
-	install -m 644 $(srcdir)/share/ld-opts/darshan-hdf5-ld-opts $(DESTDIR)$(datarootdir)/ld-opts/darshan-hdf5-ld-opts
+	install -m 644 share/ld-opts/darshan-hdf5-ld-opts $(DESTDIR)$(datarootdir)/ld-opts/darshan-hdf5-ld-opts
 endif
 ifdef BUILD_MDHIM_MODULE
 	install -m 644 $(srcdir)/share/ld-opts/darshan-mdhim-ld-opts $(DESTDIR)$(datarootdir)/ld-opts/darshan-mdhim-ld-opts


=====================================
darshan-runtime/configure
=====================================
@@ -625,6 +625,7 @@ DARSHAN_MDHIM_LD_OPTS
 BUILD_MDHIM_MODULE
 BUILD_LUSTRE_MODULE
 BUILD_BGQ_MODULE
+DARSHAN_HDF5_ADD_DFLUSH_LD_OPTS
 DARSHAN_HDF5_LD_OPTS
 BUILD_HDF5_MODULE
 DARSHAN_PNETCDF_LD_OPTS
@@ -4117,6 +4118,34 @@ fi
 if test "x$enable_hdf5_mod" = "xyes"; then :
   BUILD_HDF5_MODULE=1
     DARSHAN_HDF5_LD_OPTS="@${darshan_share_path}/ld-opts/darshan-hdf5-ld-opts"
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+        #include <hdf5.h>
+
+int
+main ()
+{
+
+        #if (H5_VERS_MAJOR > 1) || ((H5_VERS_MAJOR == 1) && (H5_VERS_MINOR >= 10))
+        #error H5_VERS 1.10+
+        #endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  DARSHAN_HDF5_ADD_DFLUSH_LD_OPTS=""
+else
+
+$as_echo "#define DARSHAN_HDF5_VERS_1_10_PLUS 1" >>confdefs.h
+
+        DARSHAN_HDF5_ADD_DFLUSH_LD_OPTS="--undefined=H5Dflush --wrap=H5Dflush"
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
 fi
 
 # PNETCDF module
@@ -4868,7 +4897,8 @@ DARSHAN_VERSION="3.2.0-pre1"
 
 
 
-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-cc-static.conf share/mpi-profile/darshan-cxx-static.conf share/mpi-profile/darshan-f-static.conf share/ld-opts/darshan-base-ld-opts share/ld-opts/darshan-stdio-ld-opts"
+
+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-cc-static.conf share/mpi-profile/darshan-cxx-static.conf share/mpi-profile/darshan-f-static.conf share/ld-opts/darshan-base-ld-opts share/ld-opts/darshan-stdio-ld-opts share/ld-opts/darshan-hdf5-ld-opts"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -5580,6 +5610,7 @@ do
     "share/mpi-profile/darshan-f-static.conf") CONFIG_FILES="$CONFIG_FILES share/mpi-profile/darshan-f-static.conf" ;;
     "share/ld-opts/darshan-base-ld-opts") CONFIG_FILES="$CONFIG_FILES share/ld-opts/darshan-base-ld-opts" ;;
     "share/ld-opts/darshan-stdio-ld-opts") CONFIG_FILES="$CONFIG_FILES share/ld-opts/darshan-stdio-ld-opts" ;;
+    "share/ld-opts/darshan-hdf5-ld-opts") CONFIG_FILES="$CONFIG_FILES share/ld-opts/darshan-hdf5-ld-opts" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac


=====================================
darshan-runtime/configure.in
=====================================
@@ -226,7 +226,21 @@ AC_ARG_ENABLE(hdf5-mod,
               AS_HELP_STRING([--enable-hdf5-mod], [Enables compilation and use of HDF5 module]))
 AS_IF([test "x$enable_hdf5_mod" = "xyes"],
     BUILD_HDF5_MODULE=1
-    DARSHAN_HDF5_LD_OPTS="@${darshan_share_path}/ld-opts/darshan-hdf5-ld-opts")
+    DARSHAN_HDF5_LD_OPTS="@${darshan_share_path}/ld-opts/darshan-hdf5-ld-opts"
+    AC_TRY_COMPILE(
+        [
+        #include <hdf5.h>
+        ],
+        [
+        #if (H5_VERS_MAJOR > 1) || ((H5_VERS_MAJOR == 1) && (H5_VERS_MINOR >= 10))
+        #error H5_VERS 1.10+
+        #endif
+        ],
+        DARSHAN_HDF5_ADD_DFLUSH_LD_OPTS="",
+        AC_DEFINE(DARSHAN_HDF5_VERS_1_10_PLUS, 1, Define if HDF5 module built with version 1.10+)
+        DARSHAN_HDF5_ADD_DFLUSH_LD_OPTS="--undefined=H5Dflush --wrap=H5Dflush"
+    )
+)
 
 # PNETCDF module
 BUILD_PNETCDF_MODULE=1
@@ -496,6 +510,7 @@ AC_SUBST(BUILD_PNETCDF_MODULE)
 AC_SUBST(DARSHAN_PNETCDF_LD_OPTS)
 AC_SUBST(BUILD_HDF5_MODULE)
 AC_SUBST(DARSHAN_HDF5_LD_OPTS)
+AC_SUBST(DARSHAN_HDF5_ADD_DFLUSH_LD_OPTS)
 AC_SUBST(BUILD_BGQ_MODULE)
 AC_SUBST(BUILD_LUSTRE_MODULE)
 AC_SUBST(BUILD_MDHIM_MODULE)
@@ -517,6 +532,7 @@ share/mpi-profile/darshan-cxx-static.conf
 share/mpi-profile/darshan-f-static.conf
 share/ld-opts/darshan-base-ld-opts
 share/ld-opts/darshan-stdio-ld-opts
+share/ld-opts/darshan-hdf5-ld-opts
 )
 
 msg="Building Darshan with CC=$CC and with the following features:"


=====================================
darshan-runtime/darshan-runtime-config.h.in
=====================================
@@ -3,6 +3,9 @@
 /* Define if building universal (internal helper macro) */
 #undef AC_APPLE_UNIVERSAL_BUILD
 
+/* Define if HDF5 module built with version 1.10+ */
+#undef DARSHAN_HDF5_VERS_1_10_PLUS
+
 /* Define if struct aiocb64 type is defined */
 #undef HAVE_AIOCB64
 


=====================================
darshan-runtime/lib/darshan-hdf5.c
=====================================
@@ -39,7 +39,9 @@ DARSHAN_FORWARD_DECL(H5Dopen1, hid_t, (hid_t loc_id, const char *name));
 DARSHAN_FORWARD_DECL(H5Dopen2, hid_t, (hid_t loc_id, const char *name, hid_t dapl_id));
 DARSHAN_FORWARD_DECL(H5Dread, herr_t, (hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t xfer_plist_id, void * buf));
 DARSHAN_FORWARD_DECL(H5Dwrite, herr_t, (hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t xfer_plist_id, const void * buf));
+#ifdef DARSHAN_HDF5_VERS_1_10_PLUS
 DARSHAN_FORWARD_DECL(H5Dflush, herr_t, (hid_t dataset_id));
+#endif
 DARSHAN_FORWARD_DECL(H5Dclose, herr_t, (hid_t dataset_id));
 
 /* structure that can track i/o stats for a given HDF5 file record at runtime */
@@ -587,7 +589,7 @@ herr_t DARSHAN_DECL(H5Dread)(hid_t dataset_id, hid_t mem_type_id, hid_t mem_spac
                 file_sel_npoints = H5Sget_select_npoints(file_space_id);
                 file_sel_type = H5Sget_select_type(file_space_id);
             }
-#if (H5_VERS_MAJOR > 1) || ((H5_VERS_MAJOR == 1) && (H5_VERS_MINOR >= 10))
+#ifdef DARSHAN_HDF5_VERS_1_10_PLUS
             if(file_sel_type == H5S_SEL_ALL)
                 rec_ref->dataset_rec->counters[H5D_REGULAR_HYPERSLAB_SELECTS] += 1;
             else if(file_sel_type == H5S_SEL_POINTS)
@@ -706,7 +708,7 @@ herr_t DARSHAN_DECL(H5Dwrite)(hid_t dataset_id, hid_t mem_type_id, hid_t mem_spa
                 file_sel_npoints = H5Sget_select_npoints(file_space_id);
                 file_sel_type = H5Sget_select_type(file_space_id);
             }
-#if (H5_VERS_MAJOR > 1) || ((H5_VERS_MAJOR == 1) && (H5_VERS_MINOR >= 10))
+#ifdef DARSHAN_HDF5_VERS_1_10_PLUS
             if(file_sel_type == H5S_SEL_ALL)
                 rec_ref->dataset_rec->counters[H5D_REGULAR_HYPERSLAB_SELECTS] += 1;
             else if(file_sel_type == H5S_SEL_POINTS)
@@ -777,6 +779,7 @@ herr_t DARSHAN_DECL(H5Dwrite)(hid_t dataset_id, hid_t mem_type_id, hid_t mem_spa
     return(ret);
 }
 
+#ifdef DARSHAN_HDF5_VERS_1_10_PLUS
 herr_t DARSHAN_DECL(H5Dflush)(hid_t dataset_id)
 {
     struct hdf5_dataset_record_ref *rec_ref;
@@ -806,6 +809,7 @@ herr_t DARSHAN_DECL(H5Dflush)(hid_t dataset_id)
 
     return(ret);
 }
+#endif
 
 herr_t DARSHAN_DECL(H5Dclose)(hid_t dataset_id)
 {
@@ -1016,6 +1020,11 @@ static struct hdf5_dataset_record_ref *hdf5_track_new_dataset_record(
     rec_ref->dataset_rec = dataset_rec;
     hdf5_dataset_runtime->rec_count++;
 
+#ifndef DARSHAN_HDF5_VERS_1_10_PLUS
+    /* flushes weren't introduced until H5 version 1.10+ */
+    rec_ref->dataset_rec->counters[H5D_FLUSHES] = -1;
+#endif
+
     return(rec_ref);
 }
 


=====================================
darshan-runtime/share/ld-opts/darshan-hdf5-ld-opts → darshan-runtime/share/ld-opts/darshan-hdf5-ld-opts.in
=====================================
@@ -9,5 +9,5 @@
 --wrap=H5Dopen2
 --wrap=H5Dread
 --wrap=H5Dwrite
---wrap=H5Dflush
 --wrap=H5Dclose
+ at DARSHAN_HDF5_ADD_DFLUSH_LD_OPTS@



View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/commit/91949d475399aaca0a16aecee062b3839f802f1e

-- 
View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/commit/91949d475399aaca0a16aecee062b3839f802f1e
You're receiving this email because of your account on xgitlab.cels.anl.gov.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/darshan-commits/attachments/20200410/39c736db/attachment-0001.html>


More information about the Darshan-commits mailing list