[Darshan-commits] [Git][darshan/darshan][issue-219-dxt-mem-config] 6 commits: fix description of '--with-mod-mem' config flag

Shane Snyder xgitlab at cels.anl.gov
Mon Jan 30 20:39:59 CST 2017


Shane Snyder pushed to branch issue-219-dxt-mem-config at darshan / darshan


Commits:
7b72260d by Shane Snyder at 2017-01-27T16:02:59-06:00
fix description of '--with-mod-mem' config flag

- - - - -
a4a77ada by Phil Carns at 2017-01-30T06:52:10-06:00
fix bug in ld option substitution

- - - - -
7bebe64f by Shane Snyder at 2017-01-30T15:16:21-06:00
make dxt mem usage runtime configurable

- - - - -
79ec6b82 by Shane Snyder at 2017-01-30T16:39:14-06:00
allow mem env variables to be floats

this allows us to request memory allocations at smaller granularity
than MiB

- - - - -
410c684a by Shane Snyder at 2017-01-30T17:00:07-06:00
bug fix in dxt serialiation routines

- - - - -
915885cf by Shane Snyder at 2017-01-30T20:37:43-06:00
make sure compression buffers are big enough

- - - - -


9 changed files:

- darshan-runtime/configure
- darshan-runtime/configure.in
- darshan-runtime/darshan-core.h
- darshan-runtime/doc/darshan-runtime.txt
- darshan-runtime/lib/darshan-core.c
- darshan-runtime/lib/darshan-dxt.c
- darshan-runtime/lib/darshan-mpiio.c
- darshan-runtime/lib/darshan-posix.c
- darshan-runtime/share/ld-opts/darshan-base-ld-opts.in


Changes:

=====================================
darshan-runtime/configure
=====================================
--- a/darshan-runtime/configure
+++ b/darshan-runtime/configure
@@ -1343,7 +1343,7 @@ Optional Features:
   --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
+                          Enable HDF5 module for HDF5 versions earlier than 1.10
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -4217,7 +4217,7 @@ $as_echo "#define __DARSHAN_ENABLE_HDF5110 1" >>confdefs.h
         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"
+    DARSHAN_HDF5_LD_OPTS="@${darshan_share_path}/ld-opts/darshan-hdf5-ld-opts"
 fi
 
 fi
@@ -4229,7 +4229,7 @@ if test "${enable_HDF5_pre_1_10+set}" = set; 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"
+    DARSHAN_HDF5_LD_OPTS="@${darshan_share_path}/ld-opts/darshan-hdf5-ld-opts"
 fi
 
 fi


=====================================
darshan-runtime/configure.in
=====================================
--- a/darshan-runtime/configure.in
+++ b/darshan-runtime/configure.in
@@ -268,7 +268,7 @@ AC_ARG_ENABLE(HDF5-post-1.10,
         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"
+    DARSHAN_HDF5_LD_OPTS="@${darshan_share_path}/ld-opts/darshan-hdf5-ld-opts"
 fi]
 ,)
 AC_ARG_ENABLE(HDF5-pre-1.10,
@@ -279,7 +279,7 @@ AC_ARG_ENABLE(HDF5-pre-1.10,
         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"
+    DARSHAN_HDF5_LD_OPTS="@${darshan_share_path}/ld-opts/darshan-hdf5-ld-opts"
 fi]
 ,)
 


=====================================
darshan-runtime/darshan-core.h
=====================================
--- a/darshan-runtime/darshan-core.h
+++ b/darshan-runtime/darshan-core.h
@@ -48,9 +48,6 @@
 /* default name record buf can store 2048 records of size 100 bytes */
 #define DARSHAN_NAME_RECORD_BUF_SIZE (2048 * 100)
 
-/* Default runtime compression buffer size */
-#define DARSHAN_COMP_BUF_SIZE DARSHAN_MOD_MEM_MAX
-
 /* structure to track registered modules */
 struct darshan_core_module
 {


=====================================
darshan-runtime/doc/darshan-runtime.txt
=====================================
--- a/darshan-runtime/doc/darshan-runtime.txt
+++ b/darshan-runtime/doc/darshan-runtime.txt
@@ -65,7 +65,7 @@ determine the log path at run time.
 * `--with-log-hints=`: specifies hints to use when writing the Darshan log
 file.  See `./configure --help` for details.
 * `--with-mod-mem=`: specifies the maximum amount of memory (in MiB) that
-each Darshan module can consume.
+active Darshan instrumentation modules can collectively consume.
 * `--with-zlib=`: specifies an alternate location for the zlib development
 header and library.
 * `CC=`: specifies the MPI C compiler to use for compilation.


=====================================
darshan-runtime/lib/darshan-core.c
=====================================
--- a/darshan-runtime/lib/darshan-core.c
+++ b/darshan-runtime/lib/darshan-core.c
@@ -156,8 +156,9 @@ void darshan_core_initialize(int argc, char **argv)
     char *jobid_str;
     int jobid;
     int ret;
-    int tmpval;
     int i;
+    int tmpval;
+    double tmpfloat;
 
     DARSHAN_MPI_CALL(PMPI_Comm_size)(MPI_COMM_WORLD, &nprocs);
     DARSHAN_MPI_CALL(PMPI_Comm_rank)(MPI_COMM_WORLD, &my_rank);
@@ -219,11 +220,11 @@ void darshan_core_initialize(int argc, char **argv)
         envstr = getenv(DARSHAN_MOD_MEM_OVERRIDE);
         if(envstr)
         {
-            ret = sscanf(envstr, "%d", &tmpval);
+            ret = sscanf(envstr, "%lf", &tmpfloat);
             /* silently ignore if the env variable is set poorly */
-            if(ret == 1 && tmpval > 0)
+            if(ret == 1 && tmpfloat > 0)
             {
-                darshan_mod_mem_quota = tmpval * 1024 * 1024; /* convert from MiB */
+                darshan_mod_mem_quota = tmpfloat * 1024 * 1024; /* convert from MiB */
             }
         }
 
@@ -404,7 +405,7 @@ void darshan_core_shutdown()
         final_core->log_job_p->end_time = last_end_time;
     }
 
-    final_core->comp_buf = malloc(DARSHAN_COMP_BUF_SIZE);
+    final_core->comp_buf = malloc(darshan_mod_mem_quota);
     if(!(final_core->comp_buf))
     {
         darshan_core_cleanup(final_core);
@@ -1557,7 +1558,7 @@ static int darshan_deflate_buffer(void **pointers, int *lengths, int count,
     }
 
     tmp_stream.next_out = (unsigned char *)comp_buf;
-    tmp_stream.avail_out = DARSHAN_COMP_BUF_SIZE;
+    tmp_stream.avail_out = darshan_mod_mem_quota;
 
     /* loop over the input pointers */
     for(i = 0; i < count; i++)


=====================================
darshan-runtime/lib/darshan-dxt.c
=====================================
--- a/darshan-runtime/lib/darshan-dxt.c
+++ b/darshan-runtime/lib/darshan-dxt.c
@@ -35,7 +35,11 @@ typedef int64_t off64_t;
 #endif
 
 /* maximum amount of memory to use for storing DXT records */
-#define DXT_IO_TRACE_MEM_MAX (4 * 1024 * 1024) /* 4 MiB */
+#ifdef __DARSHAN_MOD_MEM_MAX
+#define DXT_IO_TRACE_MEM_MAX (__DARSHAN_MOD_MEM_MAX * 1024 * 1024)
+#else
+#define DXT_IO_TRACE_MEM_MAX (4 * 1024 * 1024) /* 4 MiB default */
+#endif
 
 /* initial size of read/write trace buffer (in number of segments) */
 /* NOTE: when this size is exceeded, the buffer size is doubled */
@@ -137,7 +141,8 @@ static pthread_mutex_t dxt_runtime_mutex =
             PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
 
 static int dxt_my_rank = -1;
-static int dxt_mem_remaining = DXT_IO_TRACE_MEM_MAX;
+static int dxt_total_mem = DXT_IO_TRACE_MEM_MAX;
+static int dxt_mem_remaining = 0;
 
 #define DXT_LOCK() pthread_mutex_lock(&dxt_runtime_mutex)
 #define DXT_UNLOCK() pthread_mutex_unlock(&dxt_runtime_mutex)
@@ -375,6 +380,9 @@ static void dxt_posix_runtime_initialize()
      * over realloc'ing module memory as needed.
      */
     int dxt_psx_buf_size = 0;
+    int ret;
+    double tmpfloat;
+    char *envstr;
 
     /* register the DXT module with darshan core */
     darshan_core_register_module(
@@ -391,14 +399,30 @@ static void dxt_posix_runtime_initialize()
         return;
     }
 
+    DXT_LOCK();
     dxt_posix_runtime = malloc(sizeof(*dxt_posix_runtime));
     if(!dxt_posix_runtime)
     {
         darshan_core_unregister_module(DXT_POSIX_MOD);
+        DXT_UNLOCK();
         return;
     }
     memset(dxt_posix_runtime, 0, sizeof(*dxt_posix_runtime));
 
+    /* set the memory quota for DXT, if it has not been initialized */
+    envstr = getenv("ENABLE_DXT_IO_TRACE_MEM");
+    if(envstr && dxt_mpiio_runtime == NULL)
+    {
+        ret = sscanf(envstr, "%lf", &tmpfloat);
+        /* silently ignore if the env variable is set poorly */
+        if(ret == 1 && tmpfloat > 0)
+        {
+            dxt_total_mem = tmpfloat * 1024 * 1024; /* convert from MiB */
+        }
+    }
+    dxt_mem_remaining = dxt_total_mem;
+    DXT_UNLOCK();
+
     return;
 }
 
@@ -409,6 +433,9 @@ void dxt_mpiio_runtime_initialize()
      * over realloc'ing module memory as needed.
      */
     int dxt_mpiio_buf_size = 0;
+    int ret;
+    double tmpfloat;
+    char *envstr;
 
     /* register the DXT module with darshan core */
     darshan_core_register_module(
@@ -425,14 +452,30 @@ void dxt_mpiio_runtime_initialize()
         return;
     }
 
+    DXT_LOCK();
     dxt_mpiio_runtime = malloc(sizeof(*dxt_mpiio_runtime));
     if(!dxt_mpiio_runtime)
     {
         darshan_core_unregister_module(DXT_MPIIO_MOD);
+        DXT_UNLOCK();
         return;
     }
     memset(dxt_mpiio_runtime, 0, sizeof(*dxt_mpiio_runtime));
 
+    /* set the memory quota for DXT, if it has not been initialized */
+    envstr = getenv("ENABLE_DXT_IO_TRACE_MEM");
+    if(envstr && dxt_posix_runtime == NULL)
+    {
+        ret = sscanf(envstr, "%lf", &tmpfloat);
+        /* silently ignore if the env variable is set poorly */
+        if(ret == 1 && tmpfloat > 0)
+        {
+            dxt_total_mem = tmpfloat * 1024 * 1024; /* convert from MiB */
+        }
+    }
+    dxt_mem_remaining = dxt_total_mem;
+    DXT_UNLOCK();
+
     return;
 }
 
@@ -682,10 +725,10 @@ static void dxt_posix_shutdown(
 
     *dxt_posix_buf_sz = 0;
 
-    dxt_posix_runtime->record_buf = malloc(DXT_IO_TRACE_MEM_MAX);
+    dxt_posix_runtime->record_buf = malloc(dxt_total_mem);
     if(!(dxt_posix_runtime->record_buf))
         return;
-    memset(dxt_posix_runtime->record_buf, 0, DXT_IO_TRACE_MEM_MAX);
+    memset(dxt_posix_runtime->record_buf, 0, dxt_total_mem);
     dxt_posix_runtime->record_buf_size = 0;
 
     /* iterate all dxt posix records and serialize them to the output buffer */
@@ -792,10 +835,10 @@ static void dxt_mpiio_shutdown(
 
     *dxt_mpiio_buf_sz = 0;
 
-    dxt_mpiio_runtime->record_buf = malloc(DXT_IO_TRACE_MEM_MAX);
+    dxt_mpiio_runtime->record_buf = malloc(dxt_total_mem);
     if(!(dxt_mpiio_runtime->record_buf))
         return;
-    memset(dxt_mpiio_runtime->record_buf, 0, DXT_IO_TRACE_MEM_MAX);
+    memset(dxt_mpiio_runtime->record_buf, 0, dxt_total_mem);
     dxt_mpiio_runtime->record_buf_size = 0;
 
     /* iterate all dxt posix records and serialize them to the output buffer */


=====================================
darshan-runtime/lib/darshan-mpiio.c
=====================================
--- a/darshan-runtime/lib/darshan-mpiio.c
+++ b/darshan-runtime/lib/darshan-mpiio.c
@@ -862,7 +862,7 @@ static void mpiio_runtime_initialize()
     memset(mpiio_runtime, 0, sizeof(*mpiio_runtime));
 
     /* check if DXT (Darshan extended tracing) should be enabled */
-    if (getenv("ENABLE_DXT_IO_TRACE")) {
+    if (getenv("ENABLE_DXT_IO_TRACE_MEM")) {
         enable_dxt_io_trace = 1;
     }
 


=====================================
darshan-runtime/lib/darshan-posix.c
=====================================
--- a/darshan-runtime/lib/darshan-posix.c
+++ b/darshan-runtime/lib/darshan-posix.c
@@ -1291,7 +1291,7 @@ static void posix_runtime_initialize()
     memset(posix_runtime, 0, sizeof(*posix_runtime));
 
     /* check if DXT (Darshan extended tracing) should be enabled */
-    if (getenv("ENABLE_DXT_IO_TRACE")) {
+    if (getenv("ENABLE_DXT_IO_TRACE_MEM")) {
         enable_dxt_io_trace = 1;
     }
 


=====================================
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
@@ -3,4 +3,4 @@
 @@darshan_share_path@/ld-opts/darshan-posix-ld-opts
 @@darshan_share_path@/ld-opts/darshan-pnetcdf-ld-opts
 @@darshan_share_path@/ld-opts/darshan-stdio-ld-opts
-@@DARSHAN_HDF5_LD_OPTS@
+ at DARSHAN_HDF5_LD_OPTS@



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


More information about the Darshan-commits mailing list