[Darshan-commits] [Git][darshan/darshan][dev-no-mpi] 4 commits: port null module to new core api

Shane Snyder xgitlab at cels.anl.gov
Fri Dec 6 15:15:40 CST 2019



Shane Snyder pushed to branch dev-no-mpi at darshan / darshan


Commits:
48c149c8 by Shane Snyder at 2019-12-06T18:19:20Z
port null module to new core api

- - - - -
fbd7831f by Shane Snyder at 2019-12-06T18:19:36Z
some autotools sanity checks and cleanup

- - - - -
5fa159a7 by Shane Snyder at 2019-12-06T20:21:35Z
port mdhim module to non-mpi changes

- - - - -
dee86d0c by Shane Snyder at 2019-12-06T21:15:09Z
dup COMM_WORLD rather than using it directly

- - - - -


7 changed files:

- darshan-runtime/Makefile.in
- darshan-runtime/configure
- darshan-runtime/configure.in
- darshan-runtime/darshan-core.h
- darshan-runtime/lib/darshan-core.c
- darshan-runtime/lib/darshan-mdhim.c
- darshan-runtime/lib/darshan-null.c


Changes:

=====================================
darshan-runtime/Makefile.in
=====================================
@@ -1,5 +1,3 @@
-all: lib/libdarshan.a lib/libdarshan-stubs.a
-
 #TODO: each module provides own makefile with module-specific objects, build options, etc.
 
 DESTDIR =
@@ -16,13 +14,15 @@ LDFLAGS = @LDFLAGS@
 CC = @CC@
 LD = @LD@
 
+DISABLE_STATIC_LIB = @DISABLE_STATIC_LIB@
 DISABLE_LDPRELOAD = @DISABLE_LDPRELOAD@
 ENABLE_MMAP_LOGS = @ENABLE_MMAP_LOGS@
-DARSHAN_USE_BGQ = @DARSHAN_USE_BGQ@
-DARSHAN_USE_LUSTRE = @DARSHAN_USE_LUSTRE@
 DARSHAN_LOG_FORMAT = $(srcdir)/../darshan-log-format.h
 DARSHAN_VERSION = @DARSHAN_VERSION@
 
+ifndef DISABLE_STATIC_LIB
+all: lib/libdarshan.a lib/libdarshan-stubs.a
+endif
 ifndef DISABLE_LDPRELOAD
 all: lib/libdarshan.so
 endif
@@ -35,33 +35,30 @@ CFLAGS_SHARED = -DDARSHAN_CONFIG_H=\"darshan-runtime-config.h\" -I . -I$(srcdir)
 
 LIBS = -lz @LIBBZ2@
 
-BUILD_HDF5_MODULE = @BUILD_HDF5_MODULE@
-BUILD_MDHIM_MODULE = @BUILD_MDHIM_MODULE@
+BUILD_NULL_MODULE = @BUILD_NULL_MODULE@
 BUILD_POSIX_MODULE = @BUILD_POSIX_MODULE@
-BUILD_MPIIO_MODULE = @BUILD_MPIIO_MODULE@
-BUILD_PNETCDF_MODULE = @BUILD_PNETCDF_MODULE@
 BUILD_STDIO_MODULE = @BUILD_STDIO_MODULE@
 BUILD_DXT_MODULE = @BUILD_DXT_MODULE@
-BUILD_NULL_MODULE = @BUILD_NULL_MODULE@
+BUILD_MPIIO_MODULE = @BUILD_MPIIO_MODULE@
+BUILD_PNETCDF_MODULE = @BUILD_PNETCDF_MODULE@
+BUILD_HDF5_MODULE = @BUILD_HDF5_MODULE@
+BUILD_BGQ_MODULE = @BUILD_BGQ_MODULE@
+BUILD_LUSTRE_MODULE = @BUILD_LUSTRE_MODULE@
+BUILD_MDHIM_MODULE = @BUILD_MDHIM_MODULE@
 
 DARSHAN_STATIC_MOD_OBJS =
 DARSHAN_DYNAMIC_MOD_OBJS =
 
+ifdef BUILD_NULL_MODULE
+DARSHAN_STATIC_MOD_OBJS += lib/darshan-null.o
+DARSHAN_DYNAMIC_MOD_OBJS += lib/darshan-null.po
+endif
+
 ifdef BUILD_POSIX_MODULE
 DARSHAN_STATIC_MOD_OBJS += lib/darshan-posix.o
 DARSHAN_DYNAMIC_MOD_OBJS += lib/darshan-posix.po
 endif
 
-ifdef BUILD_MPIIO_MODULE
-DARSHAN_STATIC_MOD_OBJS += lib/darshan-mpiio.o
-DARSHAN_DYNAMIC_MOD_OBJS += lib/darshan-mpiio.po
-endif
-
-ifdef BUILD_PNETCDF_MODULE
-DARSHAN_STATIC_MOD_OBJS += lib/darshan-pnetcdf.o
-DARSHAN_DYNAMIC_MOD_OBJS += lib/darshan-pnetcdf.po
-endif
-
 ifdef BUILD_STDIO_MODULE
 DARSHAN_STATIC_MOD_OBJS += lib/darshan-stdio.o
 DARSHAN_DYNAMIC_MOD_OBJS += lib/darshan-stdio.po
@@ -72,24 +69,29 @@ DARSHAN_STATIC_MOD_OBJS += lib/darshan-dxt.o
 DARSHAN_DYNAMIC_MOD_OBJS += lib/darshan-dxt.po
 endif
 
+ifdef BUILD_MPIIO_MODULE
+DARSHAN_STATIC_MOD_OBJS += lib/darshan-mpiio.o
+DARSHAN_DYNAMIC_MOD_OBJS += lib/darshan-mpiio.po
+endif
+
+ifdef BUILD_PNETCDF_MODULE
+DARSHAN_STATIC_MOD_OBJS += lib/darshan-pnetcdf.o
+DARSHAN_DYNAMIC_MOD_OBJS += lib/darshan-pnetcdf.po
+endif
+
 ifdef BUILD_HDF5_MODULE
 DARSHAN_STATIC_MOD_OBJS += lib/darshan-hdf5.o
 DARSHAN_DYNAMIC_MOD_OBJS += lib/darshan-hdf5.po
 endif
 
-ifdef BUILD_NULL_MODULE
-DARSHAN_STATIC_MOD_OBJS += lib/darshan-null.o
-DARSHAN_DYNAMIC_MOD_OBJS += lib/darshan-null.po
-endif
-
-ifdef DARSHAN_USE_BGQ
+ifdef BUILD_BGQ_MODULE
 DARSHAN_STATIC_MOD_OBJS += lib/darshan-bgq.o
 DARSHAN_DYNAMIC_MOD_OBJS += lib/darshan-bgq.po
 CFLAGS += -DDARSHAN_BGQ
 CFLAGS_SHARED += -DDARSHAN_BGQ
 endif
 
-ifdef DARSHAN_USE_LUSTRE
+ifdef BUILD_LUSTRE_MODULE
 DARSHAN_STATIC_MOD_OBJS += lib/darshan-lustre.o
 DARSHAN_DYNAMIC_MOD_OBJS += lib/darshan-lustre.po
 CFLAGS += -DDARSHAN_LUSTRE
@@ -220,8 +222,10 @@ endif
 
 install:: all
 	install -d $(libdir)
+ifndef DISABLE_STATIC_LIB
 	install -m 755 lib/libdarshan.a $(libdir)
 	install -m 755 lib/libdarshan-stubs.a $(libdir)
+endif
 ifndef DISABLE_LDPRELOAD
 	install -m 755 lib/libdarshan.so $(libdir)
 endif


=====================================
darshan-runtime/configure
=====================================
@@ -621,26 +621,27 @@ ac_includes_default="\
 
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
-BUILD_NULL_MODULE
 DARSHAN_MDHIM_LD_OPTS
 BUILD_MDHIM_MODULE
-BUILD_DXT_MODULE
-DARSHAN_STDIO_LD_OPTS
-BUILD_STDIO_MODULE
+BUILD_LUSTRE_MODULE
+BUILD_BGQ_MODULE
+DARSHAN_HDF5_LD_OPTS
+BUILD_HDF5_MODULE
 DARSHAN_PNETCDF_LD_OPTS
 BUILD_PNETCDF_MODULE
 DARSHAN_MPIIO_LD_OPTS
 BUILD_MPIIO_MODULE
+BUILD_DXT_MODULE
+DARSHAN_STDIO_LD_OPTS
+BUILD_STDIO_MODULE
 DARSHAN_POSIX_LD_OPTS
 BUILD_POSIX_MODULE
-DARSHAN_HDF5_LD_OPTS
-BUILD_HDF5_MODULE
-DARSHAN_USE_LUSTRE
-DARSHAN_USE_BGQ
+BUILD_NULL_MODULE
 MPICH_LIB_OLD
 DARSHAN_VERSION
 ENABLE_MMAP_LOGS
 DISABLE_LDPRELOAD
+DISABLE_STATIC_LIB
 __DARSHAN_LOG_PATH
 darshan_share_path
 darshan_lib_path
@@ -707,14 +708,6 @@ with_zlib
 enable_ld_preload
 enable_cuserid
 enable_group_readable_logs
-enable_posix_mod
-enable_mpiio_mod
-enable_stdio_mod
-enable_pnetcdf_mod
-enable_null_mod
-enable_dxt_mod
-enable_bgq_mod
-enable_lustre_mod
 enable_mmap_logs
 with_mem_align
 with_log_path_by_env
@@ -722,8 +715,16 @@ with_log_hints
 with_log_path
 with_jobid_env
 with_mod_mem
+enable_null_mod
+enable_posix_mod
+enable_stdio_mod
+enable_dxt_mod
+enable_mpiio_mod
+enable_pnetcdf_mod
 enable_HDF5_post_1_10
 enable_HDF5_pre_1_10
+enable_bgq_mod
+enable_lustre_mod
 enable_mdhim
 '
       ac_precious_vars='build_alias
@@ -1360,21 +1361,22 @@ Optional Features:
   --disable-cuserid       Disables attempted use of cuserid() at run time
   --enable-group-readable-logs
                           Set log files to be group readable
+  --enable-mmap-logs      Enables ability to mmap I/O data to log file
+  --disable-null-mod      Disables compilation of NULL module
   --disable-posix-mod     Disables compilation and use of POSIX module
+  --disable-stdio-mod     Disables compilation and use of STDIO module
+  --disable-dxt-mod       Disables compilation and use of DXT module
   --disable-mpiio-mod     Disables compilation and use of MPI-IO module
                           (requires MPI)
-  --disable-stdio-mod     Disables compilation and use of STDIO module
   --disable-pnetcdf-mod   Disables compilation and use of PnetCDF module
                           (requires MPI)
-  --disable-null-mod      Disables compilation and use of NULL module
-  --disable-dxt-mod       Disables compilation and use of DXT module
-  --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 versions earlier than 1.10
+  --disable-bgq-mod       Disables compilation and use of BG/Q module (for
+                          BG/Q systems)
+  --disable-lustre-mod    Disables compilation and use of Lustre module
   --enable-mdhim          Enable mdhim module
 
 Optional Packages:
@@ -1394,7 +1396,7 @@ Optional Packages:
   --with-log-path=<path>  Location to store log files at run time
   --with-jobid-env=<name> Name of environment variable that stores the jobid
                           (specify "NONE" if no appropriate environment variable
-                          is available: Darshan will use rank 0's pid instead)
+                          is available: Darshan will use the pid of rank 0)
   --with-mod-mem=<num>    Maximum amount of memory (in MiB) for each Darshan module
 
 Some influential environment variables:
@@ -2307,7 +2309,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 if test "${with_mpi+set}" = set; then :
   withval=$with_mpi;
 else
-  with_mpi=auto
+  with_mpi=check
 fi
 
 
@@ -3351,6 +3353,10 @@ $as_echo "#define HAVE_MPI /**/" >>confdefs.h
 
 fi
 
+if test "x$ENABLE_MPI" = "x"; then :
+  DISABLE_STATIC_LIB=1
+fi
+
 
 # Check whether --with-gcc was given.
 if test "${with_gcc+set}" = set; then :
@@ -3866,6 +3872,9 @@ fi
 # Check whether --enable-ld-preload was given.
 if test "${enable_ld_preload+set}" = set; then :
   enableval=$enable_ld_preload; if test "x$enableval" = "xno" ; then
+    if test "x$ENABLE_MPI" = "x" ; then
+        as_fn_error $? "Can not disable building of LD_PRELOAD library when building Darshan without MPI support." "$LINENO" 5
+    fi
     DISABLE_LDPRELOAD="1"
 fi
 
@@ -3894,101 +3903,6 @@ fi
 fi
 
 
-#
-# Check for specific module enable/disable options
-#
-# POSIX module
-BUILD_POSIX_MODULE=1
-DARSHAN_POSIX_LD_OPTS="@${darshan_share_path}/ld-opts/darshan-posix-ld-opts"
-# Check whether --enable-posix-mod was given.
-if test "${enable_posix_mod+set}" = set; then :
-  enableval=$enable_posix_mod;
-fi
-
-if test "x$enable_posix_mod" = "xno"; then :
-  BUILD_POSIX_MODULE=
-      DARSHAN_POSIX_LD_OPTS=
-fi
-
-# MPI-IO module
-BUILD_MPIIO_MODULE=1
-DARSHAN_MPIIO_LD_OPTS="@${darshan_share_path}/ld-opts/darshan-mpiio-ld-opts"
-# Check whether --enable-mpiio-mod was given.
-if test "${enable_mpiio_mod+set}" = set; then :
-  enableval=$enable_mpiio_mod;
-fi
-
-if test "x$enable_mpiio_mod" = "xno" || test "x$ENABLE_MPI" = "x"; then :
-  BUILD_MPIIO_MODULE=
-      DARSHAN_MPIIO_LD_OPTS=
-fi
-
-# STDIO module
-BUILD_STDIO_MODULE=1
-DARSHAN_STDIO_LD_OPTS="@${darshan_share_path}/ld-opts/darshan-stdio-ld-opts"
-# Check whether --enable-stdio-mod was given.
-if test "${enable_stdio_mod+set}" = set; then :
-  enableval=$enable_stdio_mod;
-fi
-
-if test "x$enable_stdio_mod" = "xno"; then :
-  BUILD_STDIO_MODULE=
-      DARSHAN_STDIO_LD_OPTS=
-fi
-
-# PNETCDF module
-BUILD_PNETCDF_MODULE=1
-DARSHAN_PNETCDF_LD_OPTS="@${darshan_share_path}/ld-opts/darshan-pnetcdf-ld-opts"
-# Check whether --enable-pnetcdf-mod was given.
-if test "${enable_pnetcdf_mod+set}" = set; then :
-  enableval=$enable_pnetcdf_mod;
-fi
-
-if test "x$enable_pnetcdf_mod" = "xno"; then :
-  BUILD_PNETCDF_MODULE=
-      DARSHAN_PNETCDF_LD_OPTS=
-fi
-
-# NULL module
-BUILD_NULL_MODULE=1
-# Check whether --enable-null-mod was given.
-if test "${enable_null_mod+set}" = set; then :
-  enableval=$enable_null_mod;
-fi
-
-if test "x$enable_null_mod" = "xno"; then :
-  BUILD_NULL_MODULE=
-fi
-
-# DXT module
-BUILD_DXT_MODULE=1
-# Check whether --enable-dxt-mod was given.
-if test "${enable_dxt_mod+set}" = set; then :
-  enableval=$enable_dxt_mod;
-fi
-
-if test "x$enable_dxt_mod" = "xno"; then :
-  BUILD_DXT_MODULE=
-fi
-
-# Check whether --enable-bgq-mod was given.
-if test "${enable_bgq_mod+set}" = set; then :
-  enableval=$enable_bgq_mod;
-else
-  enable_bgq_mod=check
-
-fi
-
-
-# Check whether --enable-lustre-mod was given.
-if test "${enable_lustre_mod+set}" = set; then :
-  enableval=$enable_lustre_mod;
-else
-  enable_lustre_mod=check
-
-fi
-
-
 # Check whether --enable-mmap-logs was given.
 if test "${enable_mmap_logs+set}" = set; then :
   enableval=$enable_mmap_logs; if test "x$enableval" = "xyes" ; then
@@ -4108,6 +4022,126 @@ _ACEOF
 fi
 
 
+#
+# Check for specific module enable/disable options
+#
+
+# NULL module
+BUILD_NULL_MODULE=1
+# Check whether --enable-null-mod was given.
+if test "${enable_null_mod+set}" = set; then :
+  enableval=$enable_null_mod;
+fi
+
+if test "x$enable_null_mod" = "xno"; then :
+  BUILD_NULL_MODULE=
+fi
+
+# POSIX module
+BUILD_POSIX_MODULE=1
+DARSHAN_POSIX_LD_OPTS="@${darshan_share_path}/ld-opts/darshan-posix-ld-opts"
+# Check whether --enable-posix-mod was given.
+if test "${enable_posix_mod+set}" = set; then :
+  enableval=$enable_posix_mod;
+fi
+
+if test "x$enable_posix_mod" = "xno"; then :
+  BUILD_POSIX_MODULE=
+      DARSHAN_POSIX_LD_OPTS=
+fi
+
+# STDIO module
+BUILD_STDIO_MODULE=1
+DARSHAN_STDIO_LD_OPTS="@${darshan_share_path}/ld-opts/darshan-stdio-ld-opts"
+# Check whether --enable-stdio-mod was given.
+if test "${enable_stdio_mod+set}" = set; then :
+  enableval=$enable_stdio_mod;
+fi
+
+if test "x$enable_stdio_mod" = "xno"; then :
+  BUILD_STDIO_MODULE=
+      DARSHAN_STDIO_LD_OPTS=
+fi
+
+# DXT module
+BUILD_DXT_MODULE=1
+# Check whether --enable-dxt-mod was given.
+if test "${enable_dxt_mod+set}" = set; then :
+  enableval=$enable_dxt_mod;
+fi
+
+if test "x$enable_dxt_mod" = "xno"; then :
+  BUILD_DXT_MODULE=
+fi
+
+# MPI-IO module
+BUILD_MPIIO_MODULE=1
+DARSHAN_MPIIO_LD_OPTS="@${darshan_share_path}/ld-opts/darshan-mpiio-ld-opts"
+# Check whether --enable-mpiio-mod was given.
+if test "${enable_mpiio_mod+set}" = set; then :
+  enableval=$enable_mpiio_mod;
+fi
+
+if test "x$enable_mpiio_mod" = "xno" || test "x$ENABLE_MPI" = "x"; then :
+  BUILD_MPIIO_MODULE=
+      DARSHAN_MPIIO_LD_OPTS=
+fi
+
+# PNETCDF module
+BUILD_PNETCDF_MODULE=1
+DARSHAN_PNETCDF_LD_OPTS="@${darshan_share_path}/ld-opts/darshan-pnetcdf-ld-opts"
+# Check whether --enable-pnetcdf-mod was given.
+if test "${enable_pnetcdf_mod+set}" = set; then :
+  enableval=$enable_pnetcdf_mod;
+fi
+
+if test "x$enable_pnetcdf_mod" = "xno" || test "x$ENABLE_MPI" = "x"; then :
+  BUILD_PNETCDF_MODULE=
+      DARSHAN_PNETCDF_LD_OPTS=
+fi
+
+# HDF5 module
+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
+
+
+# BG/Q module
+BUILD_BGQ_MODULE=
+# Check whether --enable-bgq-mod was given.
+if test "${enable_bgq_mod+set}" = set; then :
+  enableval=$enable_bgq_mod;
+else
+  enable_bgq_mod=check
+fi
+
 # if bgq module not disabled, check to make sure BG/Q environment available
 if test x$enable_bgq_mod != xno; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BG/Q environment" >&5
@@ -4130,7 +4164,7 @@ _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
-        DARSHAN_USE_BGQ=1
+        BUILD_BGQ_MODULE=1
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
@@ -4141,11 +4175,20 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 
+# Lustre module
+BUILD_LUSTRE_MODULE=
+# Check whether --enable-lustre-mod was given.
+if test "${enable_lustre_mod+set}" = set; then :
+  enableval=$enable_lustre_mod;
+else
+  enable_lustre_mod=check
+fi
+
 # if lustre module not disabled, check for needed Lustre module header
 if test x$enable_lustre_mod != xno; then
     ac_fn_c_check_header_mongrel "$LINENO" "lustre/lustre_user.h" "ac_cv_header_lustre_lustre_user_h" "$ac_includes_default"
 if test "x$ac_cv_header_lustre_lustre_user_h" = xyes; then :
-  DARSHAN_USE_LUSTRE=1
+  BUILD_LUSTRE_MODULE=1
 else
   if test "x$enable_lustre_mod" = xyes; then :
   as_fn_error $? "Cannot find required headers for the Lustre module" "$LINENO" 5
@@ -4155,6 +4198,31 @@ fi
 
 fi
 
+BUILD_MDHIM_MODULE=
+DARSHAN_MDHIM_LD_OPTS=
+# Check whether --enable-mdhim was given.
+if test "${enable_mdhim+set}" = set; then :
+  enableval=$enable_mdhim;
+fi
+
+if test "x$enable_mdhim" = "xyes"; then :
+  BUILD_MDHIM_MODULE=1
+      DARSHAN_MDHIM_LD_OPTS="@${darshan_share_path}/ld-opts/darshan-mdhim-ld-opts"
+      for ac_header in mdhim.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "mdhim.h" "ac_cv_header_mdhim_h" "$ac_includes_default"
+if test "x$ac_cv_header_mdhim_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_MDHIM_H 1
+_ACEOF
+
+else
+  as_fn_error $? "mdhim requested but headers cannot be found" "$LINENO" 5
+fi
+
+done
+
+fi
 
 if test x$GOT_ALIGNMENT != x1; then
     as_fn_error $? "must provide --with-mem-align=<num> argument to configure." "$LINENO" 5
@@ -4586,64 +4654,6 @@ 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
-
-
-BUILD_MDHIM_MODULE=
-DARSHAN_MDHIM_LD_OPTS=
-# Check whether --enable-mdhim was given.
-if test "${enable_mdhim+set}" = set; then :
-  enableval=$enable_mdhim;
-fi
-
-if test "x$enable_mdhim" = "xyes"; then :
-  BUILD_MDHIM_MODULE=1
-      DARSHAN_MDHIM_LD_OPTS="@${darshan_share_path}/ld-opts/darshan-mdhim-ld-opts"
-      for ac_header in mdhim.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "mdhim.h" "ac_cv_header_mdhim_h" "$ac_includes_default"
-if test "x$ac_cv_header_mdhim_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_MDHIM_H 1
-_ACEOF
-
-else
-  as_fn_error $? "mdhim requested but headers cannot be found" "$LINENO" 5
-fi
-
-done
-
-fi
-
 #
 # Begin tests for MPI-enabled builds
 #
@@ -4843,6 +4853,7 @@ DARSHAN_VERSION="3.1.7"
 
 
 
+
 
 
 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"
@@ -6160,13 +6171,6 @@ else
   { $as_echo "$as_me:${as_lineno-$LINENO}: POSIX module support:   yes" >&5
 $as_echo "$as_me: POSIX module support:   yes" >&6;}
 fi
-if test "x$BUILD_MPIIO_MODULE" = "x"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: MPIIO module support:   no" >&5
-$as_echo "$as_me: MPIIO module support:   no" >&6;}
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: MPIIO module support:   yes" >&5
-$as_echo "$as_me: MPIIO module support:   yes" >&6;}
-fi
 if test "x$BUILD_STDIO_MODULE" = "x"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: STDIO module support:   no" >&5
 $as_echo "$as_me: STDIO module support:   no" >&6;}
@@ -6174,6 +6178,20 @@ else
   { $as_echo "$as_me:${as_lineno-$LINENO}: STDIO module support:   yes" >&5
 $as_echo "$as_me: STDIO module support:   yes" >&6;}
 fi
+if test "x$BUILD_DXT_MODULE" = "x"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: DXT module support:     no" >&5
+$as_echo "$as_me: DXT module support:     no" >&6;}
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: DXT module support:     yes" >&5
+$as_echo "$as_me: DXT module support:     yes" >&6;}
+fi
+if test "x$BUILD_MPIIO_MODULE" = "x"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: MPIIO module support:   no" >&5
+$as_echo "$as_me: MPIIO module support:   no" >&6;}
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: MPIIO module support:   yes" >&5
+$as_echo "$as_me: MPIIO module support:   yes" >&6;}
+fi
 if test "x$BUILD_PNETCDF_MODULE" = "x"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: PnetCDF module support: no" >&5
 $as_echo "$as_me: PnetCDF module support: no" >&6;}
@@ -6194,31 +6212,24 @@ $as_echo "$as_me: HDF5 module support:    pre-1.10" >&6;}
 fi; then :
 
 fi
-if test "x$BUILD_DXT_MODULE" = "x"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: DXT module support:     no" >&5
-$as_echo "$as_me: DXT module support:     no" >&6;}
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: DXT module support:     yes" >&5
-$as_echo "$as_me: DXT module support:     yes" >&6;}
-fi
-if test "x$DARSHAN_USE_MDHIM" = "x"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: MDHIM module support:   no" >&5
-$as_echo "$as_me: MDHIM module support:   no" >&6;}
+if test "x$BUILD_BGQ_MODULE" = "x"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: BG/Q module support:    no" >&5
+$as_echo "$as_me: BG/Q module support:    no" >&6;}
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: MDHIM module support:   yes" >&5
-$as_echo "$as_me: MDHIM module support:   yes" >&6;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: BG/Q module support:    yes" >&5
+$as_echo "$as_me: BG/Q module support:    yes" >&6;}
 fi
-if test "x$DARSHAN_USE_LUSTRE" = "x"; then :
+if test "x$BUILD_LUSTRE_MODULE" = "x"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: Lustre module support:  no" >&5
 $as_echo "$as_me: Lustre module support:  no" >&6;}
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: Lustre module support:  yes" >&5
 $as_echo "$as_me: Lustre module support:  yes" >&6;}
 fi
-if test "x$DARSHAN_USE_BGQ" = "x"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: BG/Q module support:    no" >&5
-$as_echo "$as_me: BG/Q module support:    no" >&6;}
+if test "x$BUILD_MDHIM_MODULE" = "x"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: MDHIM module support:   no" >&5
+$as_echo "$as_me: MDHIM module support:   no" >&6;}
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: BG/Q module support:    yes" >&5
-$as_echo "$as_me: BG/Q module support:    yes" >&6;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: MDHIM module support:   yes" >&5
+$as_echo "$as_me: MDHIM module support:   yes" >&6;}
 fi


=====================================
darshan-runtime/configure.in
=====================================
@@ -17,7 +17,7 @@ dnl Check for MPI
 AC_ARG_WITH(mpi,
             [AS_HELP_STRING([--without-mpi], [Build without support for MPI])],
             ,
-            [with_mpi=auto])
+            [with_mpi=check])
 
 AX_PROG_CC_MPI([test x"$with_mpi" != xno],
                [use_mpi=yes],
@@ -31,6 +31,9 @@ AS_IF([test "x$use_mpi" = "xno"],
       [ENABLE_MPI=1
        AC_DEFINE([HAVE_MPI], [], [Define if build is MPI-enabled])])
 
+AS_IF([test "x$ENABLE_MPI" = "x"],
+      DISABLE_STATIC_LIB=1,)  
+
 dnl check for GCC compiler support
 AC_ARG_WITH(gcc,
             [AS_HELP_STRING([--without-gcc], [Build without a GCC-compatible compiler])],
@@ -53,6 +56,9 @@ CHECK_ZLIB
 AC_ARG_ENABLE(ld-preload,
 [  --disable-ld-preload    Disables support for LD_PRELOAD library],
 [if test "x$enableval" = "xno" ; then
+    if test "x$ENABLE_MPI" = "x" ; then
+        AC_MSG_ERROR([Can not disable building of LD_PRELOAD library when building Darshan without MPI support.])
+    fi
     DISABLE_LDPRELOAD="1"
 fi]
 ,)
@@ -72,73 +78,6 @@ AC_ARG_ENABLE(group-readable-logs,
 fi]
 ,)
 
-#
-# Check for specific module enable/disable options
-#
-# POSIX module
-BUILD_POSIX_MODULE=1
-DARSHAN_POSIX_LD_OPTS="@${darshan_share_path}/ld-opts/darshan-posix-ld-opts"
-AC_ARG_ENABLE(posix-mod,
-              AS_HELP_STRING([--disable-posix-mod], [Disables compilation and use of POSIX module]))
-AS_IF([test "x$enable_posix_mod" = "xno"],
-      BUILD_POSIX_MODULE=
-      DARSHAN_POSIX_LD_OPTS=)
-
-# MPI-IO module
-BUILD_MPIIO_MODULE=1
-DARSHAN_MPIIO_LD_OPTS="@${darshan_share_path}/ld-opts/darshan-mpiio-ld-opts"
-AC_ARG_ENABLE(mpiio-mod,
-              AS_HELP_STRING([--disable-mpiio-mod], [Disables compilation and use of MPI-IO module (requires MPI)]))
-AS_IF([test "x$enable_mpiio_mod" = "xno" || test "x$ENABLE_MPI" = "x"],
-      BUILD_MPIIO_MODULE=
-      DARSHAN_MPIIO_LD_OPTS=)
-
-# STDIO module
-BUILD_STDIO_MODULE=1
-DARSHAN_STDIO_LD_OPTS="@${darshan_share_path}/ld-opts/darshan-stdio-ld-opts"
-AC_ARG_ENABLE(stdio-mod,
-              AS_HELP_STRING([--disable-stdio-mod], [Disables compilation and use of STDIO module]))
-AS_IF([test "x$enable_stdio_mod" = "xno"],
-      BUILD_STDIO_MODULE=
-      DARSHAN_STDIO_LD_OPTS=)
-
-# PNETCDF module
-BUILD_PNETCDF_MODULE=1
-DARSHAN_PNETCDF_LD_OPTS="@${darshan_share_path}/ld-opts/darshan-pnetcdf-ld-opts"
-AC_ARG_ENABLE(pnetcdf-mod,
-              AS_HELP_STRING([--disable-pnetcdf-mod], [Disables compilation and use of PnetCDF module (requires MPI)]))
-AS_IF([test "x$enable_pnetcdf_mod" = "xno"],
-      BUILD_PNETCDF_MODULE=
-      DARSHAN_PNETCDF_LD_OPTS=)
-
-# NULL module
-BUILD_NULL_MODULE=1
-AC_ARG_ENABLE(null-mod,
-              AS_HELP_STRING([--disable-null-mod], [Disables compilation and use of NULL module]))
-AS_IF([test "x$enable_null_mod" = "xno"],
-      BUILD_NULL_MODULE=)
-
-# DXT module
-BUILD_DXT_MODULE=1
-AC_ARG_ENABLE(dxt-mod,
-              AS_HELP_STRING([--disable-dxt-mod], [Disables compilation and use of DXT module]))
-AS_IF([test "x$enable_dxt_mod" = "xno"],
-      BUILD_DXT_MODULE=)
-
-AC_ARG_ENABLE(
-    [bgq-mod],
-    [  --disable-bgq-mod       Disables compilation and use of BG/Q module (for BG/Q systems)],
-    [],
-    [enable_bgq_mod=check]
-)
-
-AC_ARG_ENABLE(
-    [lustre-mod],
-    [  --disable-lustre-mod    Disables compilation and use of the Lustre module],
-    [],
-    [enable_lustre_mod=check]
-)
-
 AC_ARG_ENABLE(mmap-logs,
 [  --enable-mmap-logs      Enables ability to mmap I/O data to log file],
 [if test "x$enableval" = "xyes" ; then
@@ -197,7 +136,7 @@ AC_ARG_WITH(log-path,
 AC_ARG_WITH(jobid-env,
 [  --with-jobid-env=<name> Name of environment variable that stores the jobid
                           (specify "NONE" if no appropriate environment variable
-                          is available: Darshan will use rank 0's pid instead)],
+                          is available: Darshan will use the pid of rank 0)],
     if test x$withval = xyes; then
         AC_MSG_ERROR(--with-jobid-env must be given a name)
     else
@@ -216,6 +155,95 @@ AC_ARG_WITH(mod-mem,
     fi
 )
 
+#
+# Check for specific module enable/disable options
+#
+
+# NULL module
+BUILD_NULL_MODULE=1
+AC_ARG_ENABLE(null-mod,
+              AS_HELP_STRING([--disable-null-mod], [Disables compilation of NULL module]))
+AS_IF([test "x$enable_null_mod" = "xno"],
+      BUILD_NULL_MODULE=)
+
+# POSIX module
+BUILD_POSIX_MODULE=1
+DARSHAN_POSIX_LD_OPTS="@${darshan_share_path}/ld-opts/darshan-posix-ld-opts"
+AC_ARG_ENABLE(posix-mod,
+              AS_HELP_STRING([--disable-posix-mod], [Disables compilation and use of POSIX module]))
+AS_IF([test "x$enable_posix_mod" = "xno"],
+      BUILD_POSIX_MODULE=
+      DARSHAN_POSIX_LD_OPTS=)
+
+# STDIO module
+BUILD_STDIO_MODULE=1
+DARSHAN_STDIO_LD_OPTS="@${darshan_share_path}/ld-opts/darshan-stdio-ld-opts"
+AC_ARG_ENABLE(stdio-mod,
+              AS_HELP_STRING([--disable-stdio-mod], [Disables compilation and use of STDIO module]))
+AS_IF([test "x$enable_stdio_mod" = "xno"],
+      BUILD_STDIO_MODULE=
+      DARSHAN_STDIO_LD_OPTS=)
+
+# DXT module
+BUILD_DXT_MODULE=1
+AC_ARG_ENABLE(dxt-mod,
+              AS_HELP_STRING([--disable-dxt-mod], [Disables compilation and use of DXT module]))
+AS_IF([test "x$enable_dxt_mod" = "xno"],
+      BUILD_DXT_MODULE=)
+
+# MPI-IO module
+BUILD_MPIIO_MODULE=1
+DARSHAN_MPIIO_LD_OPTS="@${darshan_share_path}/ld-opts/darshan-mpiio-ld-opts"
+AC_ARG_ENABLE(mpiio-mod,
+              AS_HELP_STRING([--disable-mpiio-mod], [Disables compilation and use of MPI-IO module (requires MPI)]))
+AS_IF([test "x$enable_mpiio_mod" = "xno" || test "x$ENABLE_MPI" = "x"],
+      BUILD_MPIIO_MODULE=
+      DARSHAN_MPIIO_LD_OPTS=)
+
+# PNETCDF module
+BUILD_PNETCDF_MODULE=1
+DARSHAN_PNETCDF_LD_OPTS="@${darshan_share_path}/ld-opts/darshan-pnetcdf-ld-opts"
+AC_ARG_ENABLE(pnetcdf-mod,
+              AS_HELP_STRING([--disable-pnetcdf-mod], [Disables compilation and use of PnetCDF module (requires MPI)]))
+AS_IF([test "x$enable_pnetcdf_mod" = "xno" || test "x$ENABLE_MPI" = "x"],
+      BUILD_PNETCDF_MODULE=
+      DARSHAN_PNETCDF_LD_OPTS=)
+
+# HDF5 module
+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]
+,)
+
+# BG/Q module
+BUILD_BGQ_MODULE=
+AC_ARG_ENABLE(bgq-mod,
+              AS_HELP_STRING([--disable-bgq-mod], [Disables compilation and use of BG/Q module (for BG/Q systems)]),
+              [],
+              [enable_bgq_mod=check])
 # if bgq module not disabled, check to make sure BG/Q environment available
 if test x$enable_bgq_mod != xno; then
     AC_MSG_CHECKING(for BG/Q environment)
@@ -225,23 +253,44 @@ if test x$enable_bgq_mod != xno; then
         #endif
         ], [],
         AC_MSG_RESULT(yes)
-        DARSHAN_USE_BGQ=1,
+        BUILD_BGQ_MODULE=1,
         AC_MSG_RESULT(no)
         AS_IF([test "x$enable_bgq_mod" = xyes],
             AC_MSG_ERROR(BG/Q module enabled in non-BG/Q environment),
             []))
 fi
 
+# Lustre module
+BUILD_LUSTRE_MODULE=
+AC_ARG_ENABLE(lustre-mod,
+              AS_HELP_STRING([--disable-lustre-mod], [Disables compilation and use of Lustre module]),
+              [],
+              [enable_lustre_mod=check])
 # if lustre module not disabled, check for needed Lustre module header
 if test x$enable_lustre_mod != xno; then
     AC_CHECK_HEADER([lustre/lustre_user.h],
-        DARSHAN_USE_LUSTRE=1,
+        BUILD_LUSTRE_MODULE=1,
         AS_IF([test "x$enable_lustre_mod" = xyes],
             AC_MSG_ERROR(Cannot find required headers for the Lustre module),
             []))
 fi
 
+BUILD_MDHIM_MODULE=
+DARSHAN_MDHIM_LD_OPTS=
+AC_ARG_ENABLE([mdhim],
+	      AS_HELP_STRING([--enable-mdhim], [Enable mdhim module]),
+	      [],[] )
+AS_IF([test "x$enable_mdhim" = "xyes"],
+      BUILD_MDHIM_MODULE=1
+      DARSHAN_MDHIM_LD_OPTS="@${darshan_share_path}/ld-opts/darshan-mdhim-ld-opts"
+      AC_CHECK_HEADERS([mdhim.h],
+		       [],
+		       AC_MSG_ERROR([mdhim requested but headers cannot be found]) ),
+      []
+
+      )
 
+dnl sanity check some config parameters
 if test x$GOT_ALIGNMENT != x1; then
     AC_MSG_ERROR(must provide --with-mem-align=<num> argument to configure.)
 fi
@@ -335,49 +384,6 @@ 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]
-,)
-
-BUILD_MDHIM_MODULE=
-DARSHAN_MDHIM_LD_OPTS=
-AC_ARG_ENABLE([mdhim],
-	      AS_HELP_STRING([--enable-mdhim], [Enable mdhim module]),
-	      [],[] )
-AS_IF([test "x$enable_mdhim" = "xyes"],
-      BUILD_MDHIM_MODULE=1
-      DARSHAN_MDHIM_LD_OPTS="@${darshan_share_path}/ld-opts/darshan-mdhim-ld-opts"
-      AC_CHECK_HEADERS([mdhim.h],
-		       [],
-		       AC_MSG_ERROR([mdhim requested but headers cannot be found]) ),
-      []
-
-      )
-
 #
 # Begin tests for MPI-enabled builds
 #
@@ -478,26 +484,27 @@ AC_SUBST(darshan_lib_path)
 AC_SUBST(darshan_share_path)
 AC_SUBST(LDFLAGS)
 AC_SUBST(__DARSHAN_LOG_PATH)
+AC_SUBST(DISABLE_STATIC_LIB)
 AC_SUBST(DISABLE_LDPRELOAD)
 AC_SUBST(ENABLE_MMAP_LOGS)
 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_SUBST(BUILD_NULL_MODULE)
 AC_SUBST(BUILD_POSIX_MODULE)
 AC_SUBST(DARSHAN_POSIX_LD_OPTS)
+AC_SUBST(BUILD_STDIO_MODULE)
+AC_SUBST(DARSHAN_STDIO_LD_OPTS)
+AC_SUBST(BUILD_DXT_MODULE)
 AC_SUBST(BUILD_MPIIO_MODULE)
 AC_SUBST(DARSHAN_MPIIO_LD_OPTS)
 AC_SUBST(BUILD_PNETCDF_MODULE)
 AC_SUBST(DARSHAN_PNETCDF_LD_OPTS)
-AC_SUBST(BUILD_STDIO_MODULE)
-AC_SUBST(DARSHAN_STDIO_LD_OPTS)
-AC_SUBST(BUILD_DXT_MODULE)
+AC_SUBST(BUILD_HDF5_MODULE)
+AC_SUBST(DARSHAN_HDF5_LD_OPTS)
+AC_SUBST(BUILD_BGQ_MODULE)
+AC_SUBST(BUILD_LUSTRE_MODULE)
 AC_SUBST(BUILD_MDHIM_MODULE)
 AC_SUBST(DARSHAN_MDHIM_LD_OPTS)
-AC_SUBST(BUILD_NULL_MODULE)
 AC_OUTPUT(Makefile
 darshan-mk-log-dirs.pl
 darshan-gen-cc.pl
@@ -520,8 +527,9 @@ msg="Building Darshan with CC=$CC and with the following features:"
 AC_MSG_NOTICE($msg)
 AS_IF([test "x$BUILD_NULL_MODULE" = "x"],   [AC_MSG_NOTICE(NULL module support:    no)], [AC_MSG_NOTICE(NULL module support:    yes)])
 AS_IF([test "x$BUILD_POSIX_MODULE" = "x"],   [AC_MSG_NOTICE(POSIX module support:   no)], [AC_MSG_NOTICE(POSIX module support:   yes)])
-AS_IF([test "x$BUILD_MPIIO_MODULE" = "x"],   [AC_MSG_NOTICE(MPIIO module support:   no)], [AC_MSG_NOTICE(MPIIO module support:   yes)])
 AS_IF([test "x$BUILD_STDIO_MODULE" = "x"],   [AC_MSG_NOTICE(STDIO module support:   no)], [AC_MSG_NOTICE(STDIO module support:   yes)])
+AS_IF([test "x$BUILD_DXT_MODULE" = "x"],    [AC_MSG_NOTICE(DXT module support:     no)], [AC_MSG_NOTICE(DXT module support:     yes)])
+AS_IF([test "x$BUILD_MPIIO_MODULE" = "x"],   [AC_MSG_NOTICE(MPIIO module support:   no)], [AC_MSG_NOTICE(MPIIO module support:   yes)])
 AS_IF([test "x$BUILD_PNETCDF_MODULE" = "x"], [AC_MSG_NOTICE(PnetCDF module support: no)], [AC_MSG_NOTICE(PnetCDF module support: yes)])
 AS_IF(
     [test "x$BUILD_HDF5_MODULE" = "x"],
@@ -532,7 +540,6 @@ AS_IF(
         [AC_MSG_NOTICE(HDF5 module support:    pre-1.10)]
     )],
 )
-AS_IF([test "x$BUILD_DXT_MODULE" = "x"],    [AC_MSG_NOTICE(DXT module support:     no)], [AC_MSG_NOTICE(DXT module support:     yes)])
-AS_IF([test "x$DARSHAN_USE_MDHIM" = "x"],   [AC_MSG_NOTICE(MDHIM module support:   no)], [AC_MSG_NOTICE(MDHIM module support:   yes)])
-AS_IF([test "x$DARSHAN_USE_LUSTRE" = "x"],  [AC_MSG_NOTICE(Lustre module support:  no)], [AC_MSG_NOTICE(Lustre module support:  yes)])
-AS_IF([test "x$DARSHAN_USE_BGQ" = "x"],     [AC_MSG_NOTICE(BG/Q module support:    no)], [AC_MSG_NOTICE(BG/Q module support:    yes)])
+AS_IF([test "x$BUILD_BGQ_MODULE" = "x"],     [AC_MSG_NOTICE(BG/Q module support:    no)], [AC_MSG_NOTICE(BG/Q module support:    yes)])
+AS_IF([test "x$BUILD_LUSTRE_MODULE" = "x"],  [AC_MSG_NOTICE(Lustre module support:  no)], [AC_MSG_NOTICE(Lustre module support:  yes)])
+AS_IF([test "x$BUILD_MDHIM_MODULE" = "x"],   [AC_MSG_NOTICE(MDHIM module support:   no)], [AC_MSG_NOTICE(MDHIM module support:   yes)])


=====================================
darshan-runtime/darshan-core.h
=====================================
@@ -115,6 +115,9 @@ struct darshan_core_runtime
 #ifdef __DARSHAN_ENABLE_MMAP_LOGS
     char mmap_log_name[PATH_MAX];
 #endif
+#ifdef HAVE_MPI
+    MPI_Comm mpi_comm;
+#endif
 };
 
 void darshan_core_initialize(int argc, char **argv);


=====================================
darshan-runtime/lib/darshan-core.c
=====================================
@@ -128,9 +128,10 @@ static void darshan_get_shared_records(
     int *shared_rec_cnt);
 #endif
 static void darshan_get_logfile_name(
-    char* logfile_name, int jobid, time_t start_time);
+    char* logfile_name, struct darshan_core_runtime* core);
 static int darshan_log_open(
-    char *logfile_name, darshan_core_log_fh *log_fh);
+    char *logfile_name, struct darshan_core_runtime *core,
+    darshan_core_log_fh *log_fh);
 static int darshan_log_write_job_record(
     darshan_core_log_fh log_fh, struct darshan_core_runtime *core,
     uint64_t *inout_off);
@@ -166,7 +167,7 @@ static double darshan_core_wtime_absolute(void);
 /* MPI variant of darshan logging helpers */
 #define DARSHAN_CHECK_ERR(__ret, __err_str, ...) do { \
     if(using_mpi) \
-        PMPI_Allreduce(MPI_IN_PLACE, &__ret, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD); \
+        PMPI_Allreduce(MPI_IN_PLACE, &__ret, 1, MPI_INT, MPI_LOR, final_core->mpi_comm); \
     if(__ret != 0) { \
         if(my_rank == 0) { \
             DARSHAN_WARN(__err_str); \
@@ -206,176 +207,173 @@ void darshan_core_initialize(int argc, char **argv)
     int tmpval;
     double tmpfloat;
 
-    /* bail out _before_ attempting to [re]set using_mpi */
-    if (darshan_core != NULL)
+    /* setup darshan runtime if darshan is enabled and hasn't been initialized already */
+    if (darshan_core != NULL || getenv("DARSHAN_DISABLE"))
         return;
 
-#ifdef HAVE_MPI
-    PMPI_Initialized(&using_mpi);
-    if(using_mpi)
-    {
-        PMPI_Comm_size(MPI_COMM_WORLD, &nprocs);
-        PMPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
-    }
-#endif
-
     if(getenv("DARSHAN_INTERNAL_TIMING"))
     {
         internal_timing_flag = 1;
         init_start = darshan_core_wtime();
     }
 
-    /* setup darshan runtime if darshan is enabled and hasn't been initialized already */
-    if(!getenv("DARSHAN_DISABLE") && !darshan_core)
+    #if (__DARSHAN_MEM_ALIGNMENT < 1)
+        #error Darshan must be configured with a positive value for --with-mem-align
+    #endif
+    envstr = getenv(DARSHAN_MEM_ALIGNMENT_OVERRIDE);
+    if(envstr)
     {
-        #if (__DARSHAN_MEM_ALIGNMENT < 1)
-            #error Darshan must be configured with a positive value for --with-mem-align
-        #endif
-        envstr = getenv(DARSHAN_MEM_ALIGNMENT_OVERRIDE);
-        if(envstr)
+        ret = sscanf(envstr, "%d", &tmpval);
+        /* silently ignore if the env variable is set poorly */
+        if(ret == 1 && tmpval > 0)
         {
-            ret = sscanf(envstr, "%d", &tmpval);
-            /* silently ignore if the env variable is set poorly */
-            if(ret == 1 && tmpval > 0)
-            {
-                darshan_mem_alignment = tmpval;
-            }
-        }
-        else
-        {
-            darshan_mem_alignment = __DARSHAN_MEM_ALIGNMENT;
+            darshan_mem_alignment = tmpval;
         }
+    }
+    else
+    {
+        darshan_mem_alignment = __DARSHAN_MEM_ALIGNMENT;
+    }
 
-        /* avoid floating point errors on faulty input */
-        if(darshan_mem_alignment < 1)
-        {
-            darshan_mem_alignment = 1;
-        }
+    /* avoid floating point errors on faulty input */
+    if(darshan_mem_alignment < 1)
+    {
+        darshan_mem_alignment = 1;
+    }
 
-        /* Use DARSHAN_JOBID_OVERRIDE for the env var for __DARSHAN_JOBID */
-        envstr = getenv(DARSHAN_JOBID_OVERRIDE);
-        if(!envstr)
-        {
-            envstr = __DARSHAN_JOBID;
-        }
+    /* Use DARSHAN_JOBID_OVERRIDE for the env var for __DARSHAN_JOBID */
+    envstr = getenv(DARSHAN_JOBID_OVERRIDE);
+    if(!envstr)
+    {
+        envstr = __DARSHAN_JOBID;
+    }
 
-        /* find a job id */
-        jobid_str = getenv(envstr);
-        if(jobid_str)
-        {
-            /* in cobalt we can find it in env var */
-            ret = sscanf(jobid_str, "%d", &jobid);
-        }
-        if(!jobid_str || ret != 1)
-        {
-            /* use pid as fall back */
-            jobid = getpid();
-        }
+    /* find a job id */
+    jobid_str = getenv(envstr);
+    if(jobid_str)
+    {
+        /* in cobalt we can find it in env var */
+        ret = sscanf(jobid_str, "%d", &jobid);
+    }
+    if(!jobid_str || ret != 1)
+    {
+        /* use pid as fall back */
+        jobid = getpid();
+    }
 
-        /* set the memory quota for darshan modules' records */
-        envstr = getenv(DARSHAN_MOD_MEM_OVERRIDE);
-        if(envstr)
+    /* set the memory quota for darshan modules' records */
+    envstr = getenv(DARSHAN_MOD_MEM_OVERRIDE);
+    if(envstr)
+    {
+        ret = sscanf(envstr, "%lf", &tmpfloat);
+        /* silently ignore if the env variable is set poorly */
+        if(ret == 1 && tmpfloat > 0)
         {
-            ret = sscanf(envstr, "%lf", &tmpfloat);
-            /* silently ignore if the env variable is set poorly */
-            if(ret == 1 && tmpfloat > 0)
-            {
-                darshan_mod_mem_quota = tmpfloat * 1024 * 1024; /* convert from MiB */
-            }
+            darshan_mod_mem_quota = tmpfloat * 1024 * 1024; /* convert from MiB */
         }
+    }
 
-        /* allocate structure to track darshan core runtime information */
-        init_core = malloc(sizeof(*init_core));
-        if(init_core)
+    /* allocate structure to track darshan core runtime information */
+    init_core = malloc(sizeof(*init_core));
+    if(init_core)
+    {
+        memset(init_core, 0, sizeof(*init_core));
+        /* record absolute start time at startup so that we can later
+         * generate relative times with this as a reference point.
+         */
+        init_core->wtime_offset = darshan_core_wtime_absolute();
+
+#ifdef HAVE_MPI
+        PMPI_Initialized(&using_mpi);
+        if(using_mpi)
         {
-            memset(init_core, 0, sizeof(*init_core));
-            /* record absolute start time at startup so that we can later
-             * generate relative times with this as a reference point.
-             */
-            init_core->wtime_offset = darshan_core_wtime_absolute();
+            PMPI_Comm_dup(MPI_COMM_WORLD, &init_core->mpi_comm);
+            PMPI_Comm_size(init_core->mpi_comm, &nprocs);
+            PMPI_Comm_rank(init_core->mpi_comm, &my_rank);
+        }
+#endif
 
-        /* TODO: do we alloc new memory as we go or just do everything up front? */
+    /* TODO: do we alloc new memory as we go or just do everything up front? */
 
 #ifndef __DARSHAN_ENABLE_MMAP_LOGS
-            /* just allocate memory for each log file region */
-            init_core->log_hdr_p = malloc(sizeof(struct darshan_header));
-            init_core->log_job_p = malloc(sizeof(struct darshan_job));
-            init_core->log_exemnt_p = malloc(DARSHAN_EXE_LEN+1);
-            init_core->log_name_p = malloc(DARSHAN_NAME_RECORD_BUF_SIZE);
-            init_core->log_mod_p = malloc(darshan_mod_mem_quota);
-
-            if(!(init_core->log_hdr_p) || !(init_core->log_job_p) ||
-               !(init_core->log_exemnt_p) || !(init_core->log_name_p) ||
-               !(init_core->log_mod_p))
-            {
-                free(init_core);
-                return;
-            }
-            /* if allocation succeeds, zero fill memory regions */
-            memset(init_core->log_hdr_p, 0, sizeof(struct darshan_header));
-            memset(init_core->log_job_p, 0, sizeof(struct darshan_job));
-            memset(init_core->log_exemnt_p, 0, DARSHAN_EXE_LEN+1);
-            memset(init_core->log_name_p, 0, DARSHAN_NAME_RECORD_BUF_SIZE);
-            memset(init_core->log_mod_p, 0, darshan_mod_mem_quota);
+        /* just allocate memory for each log file region */
+        init_core->log_hdr_p = malloc(sizeof(struct darshan_header));
+        init_core->log_job_p = malloc(sizeof(struct darshan_job));
+        init_core->log_exemnt_p = malloc(DARSHAN_EXE_LEN+1);
+        init_core->log_name_p = malloc(DARSHAN_NAME_RECORD_BUF_SIZE);
+        init_core->log_mod_p = malloc(darshan_mod_mem_quota);
+
+        if(!(init_core->log_hdr_p) || !(init_core->log_job_p) ||
+           !(init_core->log_exemnt_p) || !(init_core->log_name_p) ||
+           !(init_core->log_mod_p))
+        {
+            free(init_core);
+            return;
+        }
+        /* if allocation succeeds, zero fill memory regions */
+        memset(init_core->log_hdr_p, 0, sizeof(struct darshan_header));
+        memset(init_core->log_job_p, 0, sizeof(struct darshan_job));
+        memset(init_core->log_exemnt_p, 0, DARSHAN_EXE_LEN+1);
+        memset(init_core->log_name_p, 0, DARSHAN_NAME_RECORD_BUF_SIZE);
+        memset(init_core->log_mod_p, 0, darshan_mod_mem_quota);
 #else
-            /* if mmap logs are enabled, we need to initialize the mmap region
-             * before setting the corresponding log file region pointers
-             */
-            void *mmap_p = darshan_init_mmap_log(init_core, jobid);
-            if(!mmap_p)
-            {
-                free(init_core);
-                return;
-            }
+        /* if mmap logs are enabled, we need to initialize the mmap region
+         * before setting the corresponding log file region pointers
+         */
+        void *mmap_p = darshan_init_mmap_log(init_core, jobid);
+        if(!mmap_p)
+        {
+            free(init_core);
+            return;
+        }
 
-            /* set the memory pointers for each log file region */
-            init_core->log_hdr_p = (struct darshan_header *)mmap_p;
-            init_core->log_job_p = (struct darshan_job *)
-                ((char *)init_core->log_hdr_p + sizeof(struct darshan_header));
-            init_core->log_exemnt_p = (char *)
-                ((char *)init_core->log_job_p + sizeof(struct darshan_job));
-            init_core->log_name_p = (void *)
-                ((char *)init_core->log_exemnt_p + DARSHAN_EXE_LEN + 1);
-            init_core->log_mod_p = (void *)
-                ((char *)init_core->log_name_p + DARSHAN_NAME_RECORD_BUF_SIZE);
-
-            /* set header fields needed for the mmap log mechanism */
-            init_core->log_hdr_p->comp_type = DARSHAN_NO_COMP;
-            init_core->log_hdr_p->name_map.off =
-                ((char *)init_core->log_name_p - (char *)init_core->log_hdr_p);
+        /* set the memory pointers for each log file region */
+        init_core->log_hdr_p = (struct darshan_header *)mmap_p;
+        init_core->log_job_p = (struct darshan_job *)
+            ((char *)init_core->log_hdr_p + sizeof(struct darshan_header));
+        init_core->log_exemnt_p = (char *)
+            ((char *)init_core->log_job_p + sizeof(struct darshan_job));
+        init_core->log_name_p = (void *)
+            ((char *)init_core->log_exemnt_p + DARSHAN_EXE_LEN + 1);
+        init_core->log_mod_p = (void *)
+            ((char *)init_core->log_name_p + DARSHAN_NAME_RECORD_BUF_SIZE);
+
+        /* set header fields needed for the mmap log mechanism */
+        init_core->log_hdr_p->comp_type = DARSHAN_NO_COMP;
+        init_core->log_hdr_p->name_map.off =
+            ((char *)init_core->log_name_p - (char *)init_core->log_hdr_p);
 #endif
 
-            /* set known header fields for the log file */
-            strcpy(init_core->log_hdr_p->version_string, DARSHAN_LOG_VERSION);
-            init_core->log_hdr_p->magic_nr = DARSHAN_MAGIC_NR;
+        /* set known header fields for the log file */
+        strcpy(init_core->log_hdr_p->version_string, DARSHAN_LOG_VERSION);
+        init_core->log_hdr_p->magic_nr = DARSHAN_MAGIC_NR;
 
-            /* set known job-level metadata fields for the log file */
-            init_core->log_job_p->uid = getuid();
-            init_core->log_job_p->start_time = time(NULL);
-            init_core->log_job_p->nprocs = nprocs;
-            init_core->log_job_p->jobid = (int64_t)jobid;
+        /* set known job-level metadata fields for the log file */
+        init_core->log_job_p->uid = getuid();
+        init_core->log_job_p->start_time = time(NULL);
+        init_core->log_job_p->nprocs = nprocs;
+        init_core->log_job_p->jobid = (int64_t)jobid;
 
-            /* if we are using any hints to write the log file, then record those
-             * hints with the darshan job information
-             */
-            darshan_log_record_hints_and_ver(init_core);
+        /* if we are using any hints to write the log file, then record those
+         * hints with the darshan job information
+         */
+        darshan_log_record_hints_and_ver(init_core);
 
-            /* collect information about command line and mounted file systems */
-            darshan_get_exe_and_mounts(init_core, argc, argv);
+        /* collect information about command line and mounted file systems */
+        darshan_get_exe_and_mounts(init_core, argc, argv);
 
-            /* if darshan was successfully initialized, set the global pointer
-             * and bootstrap any modules with static initialization routines
-             */
-            DARSHAN_CORE_LOCK();
-            darshan_core = init_core;
-            DARSHAN_CORE_UNLOCK();
+        /* if darshan was successfully initialized, set the global pointer
+         * and bootstrap any modules with static initialization routines
+         */
+        DARSHAN_CORE_LOCK();
+        darshan_core = init_core;
+        DARSHAN_CORE_UNLOCK();
 
-            i = 0;
-            while(mod_static_init_fns[i])
-            {
-                (*mod_static_init_fns[i])();
-                i++;
-            }
+        i = 0;
+        while(mod_static_init_fns[i])
+        {
+            (*mod_static_init_fns[i])();
+            i++;
         }
     }
 
@@ -386,7 +384,7 @@ void darshan_core_initialize(int argc, char **argv)
         if(using_mpi)
         {
             PMPI_Reduce(MPI_IN_PLACE, &init_time, 1,
-                MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD);
+                MPI_DOUBLE, MPI_MAX, 0, darshan_core->mpi_comm);
         }
         if(my_rank > 0) return;
 #endif
@@ -430,11 +428,10 @@ void darshan_core_shutdown()
     DARSHAN_CORE_UNLOCK();
 
     /* grab some initial timing information */
-    /* XXX move to MPI_Finalize wrapper */
 #ifdef HAVE_MPI
     /* if using mpi, sync across procs first */
     if(using_mpi)
-        PMPI_Barrier(MPI_COMM_WORLD);
+        PMPI_Barrier(final_core->mpi_comm);
 #endif
     start_log_time = darshan_core_wtime();
     final_core->log_job_p->end_time = time(NULL);
@@ -473,13 +470,13 @@ void darshan_core_shutdown()
     {
         /* allreduce locally active mods to determine globally active mods */
         PMPI_Allreduce(MPI_IN_PLACE, active_mods, DARSHAN_MAX_MODS, MPI_INT,
-            MPI_SUM, MPI_COMM_WORLD);
+            MPI_SUM, final_core->mpi_comm);
 
         /* reduce to report first start and last end time across all ranks at rank 0 */
         PMPI_Reduce(MPI_IN_PLACE, &final_core->log_job_p->start_time,
-            1, MPI_INT64_T, MPI_MIN, 0, MPI_COMM_WORLD);
+            1, MPI_INT64_T, MPI_MIN, 0, final_core->mpi_comm);
         PMPI_Reduce(MPI_IN_PLACE, &final_core->log_job_p->end_time,
-            1, MPI_INT64_T, MPI_MAX, 0, MPI_COMM_WORLD);
+            1, MPI_INT64_T, MPI_MAX, 0, final_core->mpi_comm);
 
         /* get a list of records which are shared across all processes */
         darshan_get_shared_records(final_core, &shared_recs, &shared_rec_cnt);
@@ -490,8 +487,7 @@ void darshan_core_shutdown()
 #endif
 
     /* get the log file name */
-    darshan_get_logfile_name(logfile_name, final_core->log_job_p->jobid,
-        final_core->log_job_p->start_time);
+    darshan_get_logfile_name(logfile_name, final_core);
     if(strlen(logfile_name) == 0)
     {
         /* failed to generate log file name */
@@ -501,7 +497,7 @@ void darshan_core_shutdown()
     if(internal_timing_flag)
         open1 = darshan_core_wtime();
     /* open the darshan log file */
-    ret = darshan_log_open(logfile_name, &log_fh);
+    ret = darshan_log_open(logfile_name, final_core, &log_fh);
     if(internal_timing_flag)
         open2 = darshan_core_wtime();
     /* error out if unable to open log file */
@@ -573,8 +569,8 @@ void darshan_core_shutdown()
             /* allow the module an opportunity to reduce shared files */
             if(this_mod->mod_funcs.mod_redux_func && (mod_shared_recs > 0) &&
                (!getenv("DARSHAN_DISABLE_SHARED_REDUCTION")))
-                this_mod->mod_funcs.mod_redux_func(mod_buf, MPI_COMM_WORLD, mod_shared_recs,
-                    mod_shared_rec_cnt);
+                this_mod->mod_funcs.mod_redux_func(mod_buf, final_core->mpi_comm,
+                    mod_shared_recs, mod_shared_rec_cnt);
         }
 #endif
 
@@ -648,17 +644,17 @@ void darshan_core_shutdown()
         if(using_mpi)
         {
             PMPI_Reduce(MPI_IN_PLACE, &open_tm, 1,
-                MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD);
+                MPI_DOUBLE, MPI_MAX, 0, final_core->mpi_comm);
             PMPI_Reduce(MPI_IN_PLACE, &header_tm, 1,
-                MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD);
+                MPI_DOUBLE, MPI_MAX, 0, final_core->mpi_comm);
             PMPI_Reduce(MPI_IN_PLACE, &job_tm, 1,
-                MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD);
+                MPI_DOUBLE, MPI_MAX, 0, final_core->mpi_comm);
             PMPI_Reduce(MPI_IN_PLACE, &rec_tm, 1,
-                MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD);
+                MPI_DOUBLE, MPI_MAX, 0, final_core->mpi_comm);
             PMPI_Reduce(MPI_IN_PLACE, &all_tm, 1,
-                MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD);
+                MPI_DOUBLE, MPI_MAX, 0, final_core->mpi_comm);
             PMPI_Reduce(MPI_IN_PLACE, mod_tm, DARSHAN_MAX_MODS,
-                MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD);
+                MPI_DOUBLE, MPI_MAX, 0, final_core->mpi_comm);
 
             /* let rank 0 report the timing info */
             if(my_rank > 0)
@@ -738,7 +734,7 @@ static void *darshan_init_mmap_log(struct darshan_core_runtime* core, int jobid)
         (void)gethostname(hname, sizeof(hname));
         logmod = darshan_hash((void*)hname,strlen(hname),hlevel);
     }
-    PMPI_Bcast(&logmod, 1, MPI_UINT64_T, 0, MPI_COMM_WORLD);
+    PMPI_Bcast(&logmod, 1, MPI_UINT64_T, 0, core->mpi_comm);
 
     /* construct a unique temporary log file name for this process
      * to write mmap log data to
@@ -1220,7 +1216,7 @@ static void darshan_get_shared_records(struct darshan_core_runtime *core,
     uint64_t *global_mod_flags;
 
     /* broadcast root's number of records to all other processes */
-    PMPI_Bcast(&tmp_cnt, 1, MPI_INT, 0, MPI_COMM_WORLD);
+    PMPI_Bcast(&tmp_cnt, 1, MPI_INT, 0, core->mpi_comm);
 
     /* use root record count to allocate data structures */
     id_array = malloc(tmp_cnt * sizeof(darshan_record_id));
@@ -1245,7 +1241,7 @@ static void darshan_get_shared_records(struct darshan_core_runtime *core,
 
     /* broadcast root's list of records to all other processes */
     PMPI_Bcast(id_array, (tmp_cnt * sizeof(darshan_record_id)),
-        MPI_BYTE, 0, MPI_COMM_WORLD);
+        MPI_BYTE, 0, core->mpi_comm);
 
     /* everyone looks to see if they opened the same records as root */
     for(i=0; i<tmp_cnt; i++)
@@ -1262,7 +1258,7 @@ static void darshan_get_shared_records(struct darshan_core_runtime *core,
      * which modules accessed them collectively
      */
     PMPI_Allreduce(mod_flags, global_mod_flags, tmp_cnt,
-        MPI_UINT64_T, MPI_BAND, MPI_COMM_WORLD);
+        MPI_UINT64_T, MPI_BAND, core->mpi_comm);
 
     j = 0;
     for(i=0; i<tmp_cnt; i++)
@@ -1290,7 +1286,8 @@ static void darshan_get_shared_records(struct darshan_core_runtime *core,
 #endif
 
 /* construct the darshan log file name */
-static void darshan_get_logfile_name(char* logfile_name, int jobid, time_t start_time)
+static void darshan_get_logfile_name(
+    char* logfile_name, struct darshan_core_runtime* core)
 {
     char* user_logfile_name;
     char* logpath;
@@ -1304,6 +1301,8 @@ static void darshan_get_logfile_name(char* logfile_name, int jobid, time_t start
     uint64_t logmod;
     char cuser[L_cuserid] = {0};
     struct tm *start_tm;
+    int jobid;
+    time_t start_time;
     int ret;
 
 #ifdef HAVE_MPI
@@ -1311,6 +1310,9 @@ static void darshan_get_logfile_name(char* logfile_name, int jobid, time_t start
         goto bcast;
 #endif
 
+    jobid = core->log_job_p->jobid;
+    start_time = core->log_job_p->start_time;
+
     /* first, check if user specifies a complete logpath to use */
     user_logfile_name = getenv("DARSHAN_LOGFILE");
     if(user_logfile_name)
@@ -1423,7 +1425,7 @@ static void darshan_get_logfile_name(char* logfile_name, int jobid, time_t start
 bcast:
     if(using_mpi)
     {
-        PMPI_Bcast(logfile_name, PATH_MAX, MPI_CHAR, 0, MPI_COMM_WORLD);
+        PMPI_Bcast(logfile_name, PATH_MAX, MPI_CHAR, 0, core->mpi_comm);
         if(my_rank > 0)
             return;
     }
@@ -1435,7 +1437,8 @@ bcast:
     return;
 }
 
-static int darshan_log_open(char *logfile_name, darshan_core_log_fh *log_fh)
+static int darshan_log_open(char *logfile_name, struct darshan_core_runtime *core,
+    darshan_core_log_fh *log_fh)
 {
     int ret;
 #ifdef HAVE_MPI
@@ -1490,7 +1493,7 @@ static int darshan_log_open(char *logfile_name, darshan_core_log_fh *log_fh)
         }
 
         /* open the darshan log file for writing using MPI */
-        ret = MPI_File_open(MPI_COMM_WORLD, logfile_name,
+        ret = MPI_File_open(core->mpi_comm, logfile_name,
             MPI_MODE_CREATE | MPI_MODE_WRONLY | MPI_MODE_EXCL, info, &log_fh->mpi_fh);
         MPI_Info_free(&info);
         if(ret != MPI_SUCCESS)
@@ -1685,10 +1688,10 @@ static int darshan_log_write_header(darshan_core_log_fh log_fh,
          */
         PMPI_Reduce(
             MPI_IN_PLACE, &(core->log_hdr_p->partial_flag),
-            1, MPI_UINT32_T, MPI_BOR, 0, MPI_COMM_WORLD);
+            1, MPI_UINT32_T, MPI_BOR, 0, core->mpi_comm);
         PMPI_Reduce(
             MPI_IN_PLACE, &(core->log_hdr_p->mod_ver),
-            DARSHAN_MAX_MODS, MPI_UINT32_T, MPI_MAX, 0, MPI_COMM_WORLD);
+            DARSHAN_MAX_MODS, MPI_UINT32_T, MPI_MAX, 0, core->mpi_comm);
 
         /* only rank 0 writes the header */
         if(my_rank > 0)
@@ -1754,7 +1757,7 @@ static int darshan_log_append(darshan_core_log_fh log_fh, struct darshan_core_ru
             send_off += *inout_off; /* rank 0 knows the beginning offset */
         }
 
-        PMPI_Scan(&send_off, &my_off, 1, MPI_OFFSET, MPI_SUM, MPI_COMM_WORLD);
+        PMPI_Scan(&send_off, &my_off, 1, MPI_OFFSET, MPI_SUM, core->mpi_comm);
         /* scan is inclusive; subtract local size back out */
         my_off -= comp_buf_sz;
 
@@ -1781,13 +1784,11 @@ static int darshan_log_append(darshan_core_log_fh log_fh, struct darshan_core_ru
             if(my_rank == (nprocs-1))
             {
                 my_off += comp_buf_sz;
-                PMPI_Send(&my_off, 1, MPI_OFFSET, 0, 0,
-                    MPI_COMM_WORLD);
+                PMPI_Send(&my_off, 1, MPI_OFFSET, 0, 0, core->mpi_comm);
             }
             if(my_rank == 0)
             {
-                PMPI_Recv(&my_off, 1, MPI_OFFSET, (nprocs-1), 0,
-                    MPI_COMM_WORLD, &status);
+                PMPI_Recv(&my_off, 1, MPI_OFFSET, (nprocs-1), 0, core->mpi_comm, &status);
 
                 *inout_off = my_off;
             }
@@ -1981,6 +1982,10 @@ static void darshan_core_cleanup(struct darshan_core_runtime* core)
     free(core->log_mod_p);
 #endif
 
+#ifdef HAVE_MPI
+    PMPI_Comm_free(&core->mpi_comm);
+#endif
+
     if(core->comp_buf)
         free(core->comp_buf);
     free(core);


=====================================
darshan-runtime/lib/darshan-mdhim.c
=====================================
@@ -15,6 +15,7 @@
 #include <string.h>
 #include <assert.h>
 
+#include <mpi.h>
 #include <mdhim.h>
 
 #include "darshan.h"
@@ -76,8 +77,7 @@ struct mdhim_runtime
     void *rec_id_hash;
     /* number of records currently tracked */
     int rec_count;
-    int record_buffer_size;
-    void *record_buffer;
+    int record_size;
 };
 
 /* internal helper functions for the MDHIM module */
@@ -88,13 +88,14 @@ static struct mdhim_record_ref *mdhim_track_new_record(
 static void mdhim_cleanup_runtime(
     void);
 
-static void mdhim_subtract_shared_rec_size(void * rec_ref_p);
-
 /* forward declaration for MDHIM shutdown function needed to interface
  * with darshan-core
  */
-static void mdhim_shutdown(MPI_Comm mod_comm, darshan_record_id *shared_recs,
-    int shared_rec_count, void **mdhim_buf, int *mdhim_buf_sz);
+static void mdhim_mpi_redux(
+    void *mdhim_buf, MPI_Comm mod_comm,
+    darshan_record_id *shared_recs, int shared_rec_count);
+static void mdhim_shutdown(
+    void **mdhim_buf, int *mdhim_buf_sz);
 
 /* mdhim_runtime is the global data structure encapsulating "MDHIM"
  * module state */
@@ -307,6 +308,10 @@ mdhim_grm_t * DARSHAN_DECL(mdhimGet)(mdhim_t *md,
 static void mdhim_runtime_initialize()
 {
     int mdhim_buf_size;
+    darshan_module_funcs mod_funcs = {
+    .mod_redux_func = &mdhim_mpi_redux,
+    .mod_shutdown_func = &mdhim_shutdown
+    };
 
     /* try and store a default number of records for this module */
     mdhim_buf_size = DARSHAN_DEF_MOD_REC_COUNT *
@@ -315,7 +320,7 @@ static void mdhim_runtime_initialize()
     /* register the MDHIM module with the darshan-core component */
     darshan_core_register_module(
         DARSHAN_MDHIM_MOD,   /* Darshan module identifier, defined in darshan-log-format.h */
-        &mdhim_shutdown,
+        mod_funcs,
         &mdhim_buf_size,
         &my_rank,
         NULL);
@@ -477,55 +482,42 @@ static void mdhim_record_reduction_op(void *infile_v, void *inoutfile_v,
  * darshan-core *
  ***********************************************************************/
 
-/* Pass output data for the MDHIM module back to darshan-core to log to
- * file, and shutdown/free internal data structures.
- */
-static void mdhim_shutdown(
-    MPI_Comm mod_comm,
-    darshan_record_id *shared_recs,
-    int shared_rec_count,
-    void **mdhim_buf,
-    int *mdhim_buf_sz)
+static void mdhim_mpi_redux(
+    void *mdhim_buf, MPI_Comm mod_comm,
+    darshan_record_id *shared_recs, int shared_rec_count)
 {
-
     int i, nr_servers=0;
-    /* other modules can declar this temporary record on the stack but I need a
-     * bit more space because of the server histogram */
     struct mdhim_record_ref *rec_ref;
-    /* walking through these arrays will be awkward if there is more than one
-     * record: the 'server_histogram' field is variable */
-    struct darshan_mdhim_record *mdhim_rec_buf =
-        *(struct darshan_mdhim_record **)mdhim_buf;
     struct darshan_mdhim_record *red_send_buf = NULL;
     struct darshan_mdhim_record *red_recv_buf = NULL;
     MPI_Datatype red_type;
     MPI_Op red_op;
+    /* walking through these arrays will be awkward if there is more than one
+     * record: the 'server_histogram' field is variable */
+    struct darshan_mdhim_record *mdhim_rec_buf =
+        *(struct darshan_mdhim_record **)mdhim_buf;
     int mdhim_rec_count;
 
     MDHIM_LOCK();
     assert(mdhim_runtime);
 
     mdhim_rec_count = mdhim_runtime->rec_count;
-    mdhim_runtime->record_buffer = *mdhim_buf;
-    mdhim_runtime->record_buffer_size = *mdhim_buf_sz;
 
     /* taking the approach in darshan-mpiio.c, except MDHIM is always a
      * "shared file" for now. */
-    assert(mdhim_runtime->rec_count == shared_rec_count);
-
-    /* can the number of mdhim servers change? I suppose if there were
-     * multiple mdhim instances, each instance could have a different
-     * number of servers.  If that's the case, I'll have to make some of
-     * the memory allocations variable (and I don't do that yet) */
-    rec_ref = darshan_lookup_record_ref(mdhim_runtime->rec_id_hash,
-            &shared_recs[0], sizeof(darshan_record_id));
-    nr_servers = rec_ref->record_p->counters[MDHIM_SERVERS];
+    assert(mdhim_rec_count == shared_rec_count);
 
     if (shared_rec_count && !getenv("DARSHAN_DISABLE_SHARED_REDUCTION"))
     {
-        /* already have the zeroth record because we checked how many
-         * servers there were */
+        /* can the number of mdhim servers change? I suppose if there were
+         * multiple mdhim instances, each instance could have a different
+         * number of servers.  If that's the case, I'll have to make some of
+         * the memory allocations variable (and I don't do that yet) */
+        rec_ref = darshan_lookup_record_ref(mdhim_runtime->rec_id_hash,
+                &shared_recs[0], sizeof(darshan_record_id));
         rec_ref->record_p->base_rec.rank = -1;
+        nr_servers = rec_ref->record_p->counters[MDHIM_SERVERS];
+        mdhim_runtime->record_size = MDHIM_RECORD_SIZE(nr_servers);
 
         /* there is probably only one shared record, but go ahead and
          * check for any other shared records, setting their rank to -1.
@@ -556,6 +548,7 @@ static void mdhim_shutdown(
                 return;
             }
         }
+
         PMPI_Type_contiguous(MDHIM_RECORD_SIZE(nr_servers),
                 MPI_BYTE, &red_type);
         PMPI_Type_commit(&red_type);
@@ -570,18 +563,32 @@ static void mdhim_shutdown(
                     MDHIM_RECORD_SIZE(nr_servers));
             free(red_recv_buf);
         }
+        else
+        {
+            /* drop shared records from non-root ranks or we'll end up writing too
+             * much */
+            mdhim_runtime->rec_count -= shared_rec_count;
+        }
 
         PMPI_Type_free(&red_type);
         PMPI_Op_free(&red_op);
-        /* drop shared records from non-root ranks or we'll end up writing too
-         * much */
-        if (my_rank != 0)
-        {
-            darshan_iter_record_refs(mdhim_runtime->rec_id_hash,
-                    &mdhim_subtract_shared_rec_size);
-        }
     }
-    *mdhim_buf_sz = mdhim_rec_count * mdhim_runtime->record_buffer_size;
+
+    MDHIM_UNLOCK();
+    return;
+}
+
+/* Pass output data for the MDHIM module back to darshan-core to log to
+ * file, and shutdown/free internal data structures.
+ */
+static void mdhim_shutdown(
+    void **mdhim_buf,
+    int *mdhim_buf_sz)
+{
+    MDHIM_LOCK();
+    assert(mdhim_runtime);
+
+    *mdhim_buf_sz = mdhim_runtime->rec_count * mdhim_runtime->record_size;
 
     /* shutdown internal structures used for instrumenting */
     mdhim_cleanup_runtime();
@@ -590,13 +597,6 @@ static void mdhim_shutdown(
     return;
 }
 
-static void mdhim_subtract_shared_rec_size(void * rec_ref_p)
-{
-    struct mdhim_record_ref *m_rec_ref = (struct mdhim_record_ref *)rec_ref_p;
-    if (m_rec_ref->record_p->base_rec.rank == -1)
-        mdhim_runtime->record_buffer_size -=
-            MDHIM_RECORD_SIZE(m_rec_ref->record_p->counters[MDHIM_SERVERS] );
-}
 /*
  * Local variables:
  *  c-indent-level: 4


=====================================
darshan-runtime/lib/darshan-null.c
=====================================
@@ -87,8 +87,7 @@ static void null_cleanup_runtime(
 /* forward declaration for NULL shutdown function needed to interface
  * with darshan-core
  */
-static void null_shutdown(MPI_Comm mod_comm, darshan_record_id *shared_recs,
-    int shared_rec_count, void **null_buf, int *null_buf_sz);
+static void null_shutdown(void **null_buf, int *null_buf_sz);
 
 /* null_runtime is the global data structure encapsulating "NULL" module state */
 static struct null_runtime *null_runtime = NULL;
@@ -199,6 +198,20 @@ int DARSHAN_DECL(foo)(const char* name, int arg1)
 static void null_runtime_initialize()
 {
     int null_buf_size;
+    darshan_module_funcs mod_funcs = {
+#ifdef HAVE_MPI
+    /* NOTE: the redux function can be used to run collective operations prior to
+     * shutting down the module. Typically, module developers will want to run a
+     * reduction on shared data records (passed in in the 'shared_recs' array),
+     * but other collective routines can be run here as well. For a detailed
+     * example illustrating how to run shared file reductions, consider the
+     * POSIX or MPIIO instrumentation modules, as they both implement this
+     * functionality.
+     */
+    .mod_redux_func = NULL,
+#endif
+    .mod_shutdown_func = &null_shutdown
+    };
 
     /* try and store a default number of records for this module */
     null_buf_size = DARSHAN_DEF_MOD_REC_COUNT * sizeof(struct darshan_null_record);
@@ -206,7 +219,7 @@ static void null_runtime_initialize()
     /* register the NULL module with the darshan-core component */
     darshan_core_register_module(
         DARSHAN_NULL_MOD,   /* Darshan module identifier, defined in darshan-log-format.h */
-        &null_shutdown,
+        mod_funcs,
         &null_buf_size,
         &my_rank,
         NULL);
@@ -305,25 +318,12 @@ static void null_cleanup_runtime()
  * and shutdown/free internal data structures.
  */
 static void null_shutdown(
-    MPI_Comm mod_comm,
-    darshan_record_id *shared_recs,
-    int shared_rec_count,
     void **null_buf,
     int *null_buf_sz)
 {
     NULL_LOCK();
     assert(null_runtime);
 
-    /* NOTE: this function can be used to run collective operations prior to
-     * shutting down the module, as implied by the MPI communicator passed in
-     * as the first agrument. Typically, module developers will want to run a
-     * reduction on shared data records (passed in in the 'shared_recs' array),
-     * but other collective routines can be run here as well. For a detailed
-     * example illustrating how to run shared file reductions, consider the
-     * POSIX or MPIIO instrumentation modules, as they both implement this
-     * functionality.
-     */
-
     /* Just set the output size according to the number of records currently
      * being tracked. In general, the module can decide to throw out records
      * that have been previously registered by shuffling around memory in



View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/compare/891fc5826f7d35e84f3abb7c70ec6bc39352d140...dee86d0c588d386e301dcee4391ddb6e22ee9b1c

-- 
View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/compare/891fc5826f7d35e84f3abb7c70ec6bc39352d140...dee86d0c588d386e301dcee4391ddb6e22ee9b1c
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/20191206/e2443a60/attachment-0001.html>


More information about the Darshan-commits mailing list