[Darshan-commits] [Git][darshan/darshan][master] 2 commits: properly wrap HDF5 parallel usage

Shane Snyder xgitlab at cels.anl.gov
Wed Oct 21 19:49:48 CDT 2020



Shane Snyder pushed to branch master at darshan / darshan


Commits:
9861c5a1 by Shane Snyder at 2020-10-21T19:47:12-05:00
properly wrap HDF5 parallel usage

fixes 287

- - - - -
efc8c429 by Shane Snyder at 2020-10-21T19:49:45-05:00
Merge branch 'dev-hdf5-mpi-issue287-2' into 'master'

properly wrap HDF5 parallel usage

See merge request darshan/darshan!64
- - - - -


4 changed files:

- darshan-runtime/configure
- darshan-runtime/configure.in
- darshan-runtime/darshan-runtime-config.h.in
- darshan-runtime/lib/darshan-hdf5.c


Changes:

=====================================
darshan-runtime/configure
=====================================
@@ -650,6 +650,7 @@ __DARSHAN_LOG_PATH
 darshan_share_path
 darshan_lib_path
 PRI_MACROS_BROKEN
+H5PCC_CHECK
 EGREP
 GREP
 CPP
@@ -4156,6 +4157,49 @@ $as_echo "#define DARSHAN_HDF5_VERS_1_10_PLUS 1" >>confdefs.h
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+    # Extract the first word of "h5pcc", so it can be a program name with args.
+set dummy h5pcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_H5PCC_CHECK+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$H5PCC_CHECK"; then
+  ac_cv_prog_H5PCC_CHECK="$H5PCC_CHECK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in "${enable_hdf5_mod}/bin"
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_H5PCC_CHECK=""yes""
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_prog_H5PCC_CHECK" && ac_cv_prog_H5PCC_CHECK=""no""
+fi
+fi
+H5PCC_CHECK=$ac_cv_prog_H5PCC_CHECK
+if test -n "$H5PCC_CHECK"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $H5PCC_CHECK" >&5
+$as_echo "$H5PCC_CHECK" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    if test x"$H5PCC_CHECK" = x"yes"; then :
+
+$as_echo "#define DARSHAN_HDF5_PAR_BUILD 1" >>confdefs.h
+
+fi
 
 fi
 


=====================================
darshan-runtime/configure.in
=====================================
@@ -247,6 +247,8 @@ AS_IF([test "x$enable_hdf5_mod" != "xno"],
         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"
     )
+    AC_CHECK_PROG(H5PCC_CHECK, h5pcc, "yes", "no", "${enable_hdf5_mod}/bin")
+    AS_IF([test x"$H5PCC_CHECK" = x"yes"], [AC_DEFINE(DARSHAN_HDF5_PAR_BUILD, 1, Define if HDF5 built with parallel support)])
 )
 
 # PNETCDF module


=====================================
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 built with parallel support */
+#undef DARSHAN_HDF5_PAR_BUILD
+
 /* Define if HDF5 module built with version 1.10+ */
 #undef DARSHAN_HDF5_VERS_1_10_PLUS
 


=====================================
darshan-runtime/lib/darshan-hdf5.c
=====================================
@@ -131,7 +131,7 @@ static int my_rank = -1;
     HDF5_UNLOCK(); \
 } while(0)
 
-#define H5F_RECORD_OPEN(__ret, __path, __fapl, __tm1, __tm2) do { \
+#define H5F_RECORD_OPEN(__ret, __path, __use_mpio, __tm1, __tm2) do { \
     darshan_record_id __rec_id; \
     struct hdf5_file_record_ref *__rec_ref; \
     char *__newpath; \
@@ -148,8 +148,7 @@ static int my_rank = -1;
         if(__newpath != __path) free(__newpath); \
         break; \
     } \
-    if(__fapl != H5P_DEFAULT && H5Pget_fapl_mpio(__fapl, NULL, NULL) >= 0) \
-        __rec_ref->file_rec->counters[H5F_USE_MPIIO] = 1; \
+    __rec_ref->file_rec->counters[H5F_USE_MPIIO] = __use_mpio; \
     __rec_ref->file_rec->counters[H5F_OPENS] += 1; \
     if(__rec_ref->file_rec->fcounters[H5F_F_OPEN_START_TIMESTAMP] == 0 || \
      __rec_ref->file_rec->fcounters[H5F_F_OPEN_START_TIMESTAMP] > __tm1) \
@@ -169,6 +168,7 @@ hid_t DARSHAN_DECL(H5Fcreate)(const char *filename, unsigned flags,
     double tm1, tm2;
     unsigned majnum, minnum, relnum;
     int tmp_rank = my_rank;
+    int use_mpio = 0;
 
     H5get_libversion(&majnum, &minnum, &relnum);
 #ifdef DARSHAN_HDF5_VERS_1_10_PLUS
@@ -223,8 +223,13 @@ hid_t DARSHAN_DECL(H5Fcreate)(const char *filename, unsigned flags,
             filename = tmp + 1;
         }
 
+#ifdef DARSHAN_HDF5_PAR_BUILD
+        if(access_plist != H5P_DEFAULT && H5Pget_fapl_mpio(access_plist, NULL, NULL) >= 0)
+            use_mpio = 1;
+#endif
+
         H5F_PRE_RECORD();
-        H5F_RECORD_OPEN(ret, filename, access_plist, tm1, tm2);
+        H5F_RECORD_OPEN(ret, filename, use_mpio, tm1, tm2);
         H5F_POST_RECORD();
     }
 
@@ -239,6 +244,7 @@ hid_t DARSHAN_DECL(H5Fopen)(const char *filename, unsigned flags,
     double tm1, tm2;
     unsigned majnum, minnum, relnum;
     int tmp_rank = my_rank;
+    int use_mpio = 0;
 
     H5get_libversion(&majnum, &minnum, &relnum);
 #ifdef DARSHAN_HDF5_VERS_1_10_PLUS
@@ -293,8 +299,13 @@ hid_t DARSHAN_DECL(H5Fopen)(const char *filename, unsigned flags,
             filename = tmp + 1;
         }
 
+#ifdef DARSHAN_HDF5_PAR_BUILD
+        if(access_plist != H5P_DEFAULT && H5Pget_fapl_mpio(access_plist, NULL, NULL) >= 0)
+            use_mpio = 1;
+#endif
+
         H5F_PRE_RECORD();
-        H5F_RECORD_OPEN(ret, filename, access_plist, tm1, tm2);
+        H5F_RECORD_OPEN(ret, filename, use_mpio, tm1, tm2);
         H5F_POST_RECORD();
     }
 
@@ -602,7 +613,6 @@ herr_t DARSHAN_DECL(H5Dread)(hid_t dataset_id, hid_t mem_type_id, hid_t mem_spac
     hsize_t count_dims[H5D_MAX_NDIMS] = {0};
     hsize_t block_dims[H5D_MAX_NDIMS] = {0};
     int64_t common_access_vals[H5D_MAX_NDIMS+H5D_MAX_NDIMS+1] = {0};
-    H5FD_mpio_xfer_t xfer_mode;
     struct darshan_common_val_counter *cvc;
     int i;
     double tm1, tm2, elapsed;
@@ -682,12 +692,15 @@ herr_t DARSHAN_DECL(H5Dread)(hid_t dataset_id, hid_t mem_type_id, hid_t mem_spac
                 &(rec_ref->dataset_rec->counters[H5D_ACCESS1_ACCESS]),
                 &(rec_ref->dataset_rec->counters[H5D_ACCESS1_COUNT]),
                 cvc->vals, cvc->nvals, cvc->freq, 0);
+#ifdef DARSHAN_HDF5_PAR_BUILD
             if(xfer_plist_id != H5P_DEFAULT)
             {
+                H5FD_mpio_xfer_t xfer_mode;
                 tmp_ret = H5Pget_dxpl_mpio(xfer_plist_id, &xfer_mode);
                 if(tmp_ret >= 0 && xfer_mode == H5FD_MPIO_COLLECTIVE)
                     rec_ref->dataset_rec->counters[H5D_USE_MPIIO_COLLECTIVE] = 1;
             }
+#endif
             if(rec_ref->dataset_rec->fcounters[H5D_F_READ_START_TIMESTAMP] == 0 ||
              rec_ref->dataset_rec->fcounters[H5D_F_READ_START_TIMESTAMP] > tm1)
                 rec_ref->dataset_rec->fcounters[H5D_F_READ_START_TIMESTAMP] = tm1;
@@ -721,7 +734,6 @@ herr_t DARSHAN_DECL(H5Dwrite)(hid_t dataset_id, hid_t mem_type_id, hid_t mem_spa
     hsize_t count_dims[H5D_MAX_NDIMS] = {0};
     hsize_t block_dims[H5D_MAX_NDIMS] = {0};
     int64_t common_access_vals[H5D_MAX_NDIMS+H5D_MAX_NDIMS+1] = {0};
-    H5FD_mpio_xfer_t xfer_mode;
     struct darshan_common_val_counter *cvc;
     int i;
     double tm1, tm2, elapsed;
@@ -801,12 +813,15 @@ herr_t DARSHAN_DECL(H5Dwrite)(hid_t dataset_id, hid_t mem_type_id, hid_t mem_spa
                 &(rec_ref->dataset_rec->counters[H5D_ACCESS1_ACCESS]),
                 &(rec_ref->dataset_rec->counters[H5D_ACCESS1_COUNT]),
                 cvc->vals, cvc->nvals, cvc->freq, 0);
+#ifdef DARSHAN_HDF5_PAR_BUILD
             if(xfer_plist_id != H5P_DEFAULT)
             {
+                H5FD_mpio_xfer_t xfer_mode;
                 tmp_ret = H5Pget_dxpl_mpio(xfer_plist_id, &xfer_mode);
                 if(tmp_ret >= 0 && xfer_mode == H5FD_MPIO_COLLECTIVE)
                     rec_ref->dataset_rec->counters[H5D_USE_MPIIO_COLLECTIVE] = 1;
             }
+#endif
             if(rec_ref->dataset_rec->fcounters[H5D_F_WRITE_START_TIMESTAMP] == 0 ||
              rec_ref->dataset_rec->fcounters[H5D_F_WRITE_START_TIMESTAMP] > tm1)
                 rec_ref->dataset_rec->fcounters[H5D_F_WRITE_START_TIMESTAMP] = tm1;



View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/-/compare/1e11e8f5ff996aea13720ad9d1288139e883a749...efc8c4298cc97bc0a710062ad4743278c93c7fd8

-- 
View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/-/compare/1e11e8f5ff996aea13720ad9d1288139e883a749...efc8c4298cc97bc0a710062ad4743278c93c7fd8
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/20201021/1f6d4c38/attachment-0001.html>


More information about the Darshan-commits mailing list