<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>
GitLab
</title>

</head>
<body>
<style type="text/css">
img {
max-width: 100%; height: auto;
}
</style>
<div class="content">
<h3>
Shane Snyder pushed to branch mmap-dev
at <a href="https://xgitlab.cels.anl.gov/darshan/darshan">darshan / darshan</a>
</h3>
<h4>
Commits:
</h4>
<ul>
<li>
<strong><a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/7d35c45a16402f60a1a95846901adc85dc33024f">7d35c45a</a></strong>
<div>
<span>by Shane Snyder</span>
<i>at 2016-05-27T16:36:32-05:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap">register/lookup_record now use strings explicitly</pre>
</li>
<li>
<strong><a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/bfde9eb7378a95682389a76d677bbef29af8f530">bfde9eb7</a></strong>
<div>
<span>by Shane Snyder</span>
<i>at 2016-05-31T15:47:51-05:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap">numerous darshan-core api changes

- memory management is now entirely handled by darshan-core for
  module records
    * when registering new records, darshan-core returns the
      corresponding buffer to write it to, rather than allowing
      module to determine this
- modules now decide whether darshan-core should track record
  names by passing either a valid name or NULL to the register
  function
    * this allows modules to register records that aren't really
      tracked by darshan-core
- only the POSIX module has been ported to new changes for this
  commit</pre>
</li>
</ul>
<h4>8 changed files:</h4>
<ul>
<li class="file-stats">
<a href="#620f2ecad2bb6f74b2fcd0134963a841" style="text-decoration: none">
darshan-runtime/Makefile.in
</a>
</li>
<li class="file-stats">
<a href="#ad29afc395839758d41094872298bd0d" style="text-decoration: none">
darshan-runtime/darshan-core.h
</a>
</li>
<li class="file-stats">
<a href="#c0b0bf6d71bc5fc7e6d50d69c8aa2413" style="text-decoration: none">
darshan-runtime/darshan.h
</a>
</li>
<li class="file-stats">
<a href="#2ace16276b68c7d5aef163bb260bd9f7" style="text-decoration: none">
darshan-runtime/lib/darshan-core.c
</a>
</li>
<li class="file-stats">
<a href="#4dfe7e78b540daa005ea4b5f0458c90d" style="text-decoration: none">
darshan-runtime/lib/darshan-hdf5.c
</a>
</li>
<li class="file-stats">
<a href="#172f4bf093caeeba24730a1adff8f15a" style="text-decoration: none">
darshan-runtime/lib/darshan-mpiio.c
</a>
</li>
<li class="file-stats">
<a href="#a453f91a0a4af7575917fad54f4ac1d0" style="text-decoration: none">
darshan-runtime/lib/darshan-pnetcdf.c
</a>
</li>
<li class="file-stats">
<a href="#dffc348e63ffc0037c23afd36439222f" style="text-decoration: none">
darshan-runtime/lib/darshan-posix.c
</a>
</li>
</ul>
<h4>Changes:</h4>
<li id="620f2ecad2bb6f74b2fcd0134963a841">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/compare/8f463e512cf639f9cbd64bba7c758ca0e02ae8d7...bfde9eb7378a95682389a76d677bbef29af8f530#diff-0">
<strong>
darshan-runtime/Makefile.in
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="background: #ffdddd; color: #000000">--- a/darshan-runtime/Makefile.in
</span><span style="background: #ddffdd; color: #000000">+++ b/darshan-runtime/Makefile.in
</span><span style="color: #aaaaaa">@@ -35,7 +35,8 @@ CFLAGS_SHARED = -DDARSHAN_CONFIG_H=\"darshan-runtime-config.h\" -I . -I$(srcdir)
</span> 
 LIBS = -lz @LIBBZ2@
 
<span style="background: #ffdddd; color: #000000">-DARSHAN_STATIC_MOD_OBJS = lib/darshan-posix.o lib/darshan-mpiio.o lib/darshan-hdf5.o lib/darshan-pnetcdf.o
</span><span style="background: #ddffdd; color: #000000">+DARSHAN_STATIC_MOD_OBJS = lib/darshan-posix.o
+# TODO: lib/darshan-mpiio.o lib/darshan-hdf5.o lib/darshan-pnetcdf.o
</span> DARSHAN_DYNAMIC_MOD_OBJS = lib/darshan-posix.po lib/darshan-mpiio.po lib/darshan-hdf5.po lib/darshan-pnetcdf.po
 
 ifdef DARSHAN_USE_BGQ
</code></pre>

<br>
</li>
<li id="ad29afc395839758d41094872298bd0d">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/compare/8f463e512cf639f9cbd64bba7c758ca0e02ae8d7...bfde9eb7378a95682389a76d677bbef29af8f530#diff-1">
<strong>
darshan-runtime/darshan-core.h
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="background: #ffdddd; color: #000000">--- a/darshan-runtime/darshan-core.h
</span><span style="background: #ddffdd; color: #000000">+++ b/darshan-runtime/darshan-core.h
</span><span style="color: #aaaaaa">@@ -52,8 +52,10 @@
</span> /* structure to track registered modules */
 struct darshan_core_module
 {
<span style="background: #ffdddd; color: #000000">-    struct darshan_module_funcs mod_funcs;
-    int mem_avail;
</span><span style="background: #ddffdd; color: #000000">+    void *rec_buf_start;
+    void *rec_buf_p;
+    int rec_mem_avail;
+    struct darshan_module_funcs funcs;
</span> };
 
 struct darshan_core_name_record_ref
<span style="color: #aaaaaa">@@ -78,7 +80,6 @@ struct darshan_core_runtime
</span>     struct darshan_core_module* mod_array[DARSHAN_MAX_MODS];
     int mod_mem_used;
     struct darshan_core_name_record_ref *name_hash;
<span style="background: #ffdddd; color: #000000">-    int name_hash_cnt;
</span>     double wtime_offset;
     char *comp_buf;
 #ifdef __DARSHAN_ENABLE_MMAP_LOGS
</code></pre>

<br>
</li>
<li id="c0b0bf6d71bc5fc7e6d50d69c8aa2413">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/compare/8f463e512cf639f9cbd64bba7c758ca0e02ae8d7...bfde9eb7378a95682389a76d677bbef29af8f530#diff-2">
<strong>
darshan-runtime/darshan.h
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="background: #ffdddd; color: #000000">--- a/darshan-runtime/darshan.h
</span><span style="background: #ddffdd; color: #000000">+++ b/darshan-runtime/darshan.h
</span><span style="color: #aaaaaa">@@ -101,8 +101,7 @@ struct darshan_module_funcs
</span> void darshan_core_register_module(
     darshan_module_id mod_id,
     struct darshan_module_funcs *funcs,
<span style="background: #ffdddd; color: #000000">-    int *inout_mod_size,
-    void **mod_buf,
</span><span style="background: #ddffdd; color: #000000">+    int *inout_mod_buf_size,
</span>     int *rank,
     int *sys_mem_alignment);
 
<span style="color: #aaaaaa">@@ -114,14 +113,12 @@ void darshan_core_register_module(
</span> void darshan_core_unregister_module(
     darshan_module_id mod_id);
 
<span style="background: #ffdddd; color: #000000">-/* darshan_core_lookup_record()
</span><span style="background: #ddffdd; color: #000000">+/* darshan_core_gen_record_id()
</span>  *
  *
  */
<span style="background: #ffdddd; color: #000000">-void darshan_core_lookup_record(
-    void *name,
-    int name_len,
-    darshan_record_id *rec_id);
</span><span style="background: #ddffdd; color: #000000">+darshan_record_id darshan_core_gen_record_id(
+    char *name);
</span> 
 /* darshan_core_register_record()
  *
<span style="color: #aaaaaa">@@ -137,11 +134,11 @@ void darshan_core_lookup_record(
</span>  * correspoing Darshan record identifier and 'file_alignment' is an output
  * pointer storing the file system alignment value for the given record.
  */
<span style="background: #ffdddd; color: #000000">-int darshan_core_register_record(
</span><span style="background: #ddffdd; color: #000000">+void *darshan_core_register_record(
</span>     darshan_record_id rec_id,
<span style="background: #ffdddd; color: #000000">-    void *name,
</span><span style="background: #ddffdd; color: #000000">+    char *name,
</span>     darshan_module_id mod_id,
<span style="background: #ffdddd; color: #000000">-    int rec_size,
</span><span style="background: #ddffdd; color: #000000">+    int rec_len,
</span>     int *file_alignment);
 
 /* darshan_core_wtime()
</code></pre>

<br>
</li>
<li id="2ace16276b68c7d5aef163bb260bd9f7">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/compare/8f463e512cf639f9cbd64bba7c758ca0e02ae8d7...bfde9eb7378a95682389a76d677bbef29af8f530#diff-3">
<strong>
darshan-runtime/lib/darshan-core.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="background: #ffdddd; color: #000000">--- a/darshan-runtime/lib/darshan-core.c
</span><span style="background: #ddffdd; color: #000000">+++ b/darshan-runtime/lib/darshan-core.c
</span><span style="color: #aaaaaa">@@ -94,8 +94,8 @@ static void darshan_log_record_hints_and_ver(
</span> static void darshan_get_exe_and_mounts(
     struct darshan_core_runtime *core, int argc, char **argv);
 static void darshan_add_name_record_ref(
<span style="background: #ffdddd; color: #000000">-    struct darshan_core_runtime *core, char *name,
-    darshan_record_id id, struct darshan_core_name_record_ref **ref);
</span><span style="background: #ddffdd; color: #000000">+    struct darshan_core_runtime *core, darshan_record_id rec_id,
+    char *name, darshan_module_id mod_id);
</span> static int darshan_block_size_from_path(
     const char *path);
 static void darshan_get_user_name(
<span style="color: #aaaaaa">@@ -436,7 +436,7 @@ void darshan_core_shutdown()
</span>         if(final_core->mod_array[i])
         {
             local_mod_use[i] = 1;
<span style="background: #ffdddd; color: #000000">-            final_core->mod_array[i]->mod_funcs.begin_shutdown();
</span><span style="background: #ddffdd; color: #000000">+            final_core->mod_array[i]->funcs.begin_shutdown();
</span>         }
     }
 
<span style="color: #aaaaaa">@@ -640,7 +640,9 @@ void darshan_core_shutdown()
</span>          */
         if(this_mod)
         {
<span style="background: #ffdddd; color: #000000">-            this_mod->mod_funcs.get_output_data(MPI_COMM_WORLD, mod_shared_recs,
</span><span style="background: #ddffdd; color: #000000">+            mod_buf = final_core->mod_array[i]->rec_buf_start;
+            mod_buf_sz = final_core->mod_array[i]->rec_buf_p - mod_buf;
+            this_mod->funcs.get_output_data(MPI_COMM_WORLD, mod_shared_recs,
</span>                 mod_shared_rec_cnt, &mod_buf, &mod_buf_sz);
         }
 
<span style="color: #aaaaaa">@@ -669,7 +671,7 @@ void darshan_core_shutdown()
</span>         /* shutdown module if registered locally */
         if(this_mod)
         {
<span style="background: #ffdddd; color: #000000">-            this_mod->mod_funcs.shutdown();
</span><span style="background: #ddffdd; color: #000000">+            this_mod->funcs.shutdown();
</span>         }
         if(internal_timing_flag)
             mod2[i] = DARSHAN_MPI_CALL(PMPI_Wtime)();
<span style="color: #aaaaaa">@@ -1219,29 +1221,34 @@ static void darshan_get_logfile_name(char* logfile_name, int jobid, struct tm* s
</span>     return;
 }
 
<span style="background: #ffdddd; color: #000000">-static void darshan_add_name_record_ref(struct darshan_core_runtime *core, char *name,
-    darshan_record_id id, struct darshan_core_name_record_ref **ref)
</span><span style="background: #ddffdd; color: #000000">+static void darshan_add_name_record_ref(struct darshan_core_runtime *core,
+    darshan_record_id rec_id, char *name, darshan_module_id mod_id)
</span> {
<span style="background: #ddffdd; color: #000000">+    struct darshan_core_name_record_ref *ref;
</span>     int record_size = sizeof(darshan_record_id) + strlen(name) + 1;
 
     if((record_size + core->log_hdr_p->name_map.len) > DARSHAN_NAME_RECORD_BUF_SIZE)
         return;
 
<span style="background: #ffdddd; color: #000000">-    *ref = malloc(sizeof(**ref));
-    if(*ref)
</span><span style="background: #ddffdd; color: #000000">+    ref = malloc(sizeof(*ref));
+    if(ref)
</span>     {
<span style="background: #ffdddd; color: #000000">-        memset(*ref, 0, sizeof(**ref));
</span><span style="background: #ddffdd; color: #000000">+        memset(ref, 0, sizeof(*ref));
</span> 
<span style="background: #ffdddd; color: #000000">-        (*ref)->name_record = (struct darshan_name_record *)
</span><span style="background: #ddffdd; color: #000000">+        ref->name_record = (struct darshan_name_record *)
</span>             ((char *)core->log_name_p + core->log_hdr_p->name_map.len);
<span style="background: #ffdddd; color: #000000">-        memset((*ref)->name_record, 0, record_size);
-        (*ref)->name_record->id = id;
-        strcpy((*ref)->name_record->name, name);
</span><span style="background: #ddffdd; color: #000000">+        memset(ref->name_record, 0, record_size);
+        ref->name_record->id = rec_id;
+        strcpy(ref->name_record->name, name);
+
+        if(!DARSHAN_MOD_FLAG_ISSET(ref->mod_flags, mod_id))
+        {
+            DARSHAN_MOD_FLAG_SET(ref->mod_flags, mod_id);
+        }
</span> 
         /* add the record to the hash table */
         HASH_ADD(hlink, core->name_hash, name_record->id,
<span style="background: #ffdddd; color: #000000">-            sizeof(darshan_record_id), (*ref));
-        core->name_hash_cnt++;
</span><span style="background: #ddffdd; color: #000000">+            sizeof(darshan_record_id), ref);
</span>         core->log_hdr_p->name_map.len += record_size;
     }
 
<span style="color: #aaaaaa">@@ -1252,7 +1259,7 @@ static void darshan_get_shared_records(struct darshan_core_runtime *core,
</span>     darshan_record_id **shared_recs, int *shared_rec_cnt)
 {
     int i, j;
<span style="background: #ffdddd; color: #000000">-    int tmp_cnt = core->name_hash_cnt;
</span><span style="background: #ddffdd; color: #000000">+    int tmp_cnt = HASH_CNT(hlink, core->name_hash);
</span>     struct darshan_core_name_record_ref *tmp, *ref;
     darshan_record_id *id_array;
     uint64_t *mod_flags;
<span style="color: #aaaaaa">@@ -1675,17 +1682,15 @@ static void darshan_core_cleanup(struct darshan_core_runtime* core)
</span> void darshan_core_register_module(
     darshan_module_id mod_id,
     struct darshan_module_funcs *funcs,
<span style="background: #ffdddd; color: #000000">-    int *inout_mod_size,
-    void **mod_buf,
</span><span style="background: #ddffdd; color: #000000">+    int *inout_mod_buf_size,
</span>     int *rank,
     int *sys_mem_alignment)
 {
     struct darshan_core_module* mod;
<span style="background: #ffdddd; color: #000000">-    int mod_mem_req = *inout_mod_size;
</span><span style="background: #ddffdd; color: #000000">+    int mod_mem_req = *inout_mod_buf_size;
</span>     int mod_mem_avail;
 
<span style="background: #ffdddd; color: #000000">-    *mod_buf = NULL;
-    *inout_mod_size = 0;
</span><span style="background: #ddffdd; color: #000000">+    *inout_mod_buf_size = 0;
</span> 
     if(!darshan_core || (mod_id >= DARSHAN_MAX_MODS))
         return;
<span style="color: #aaaaaa">@@ -1706,26 +1711,27 @@ void darshan_core_register_module(
</span>     }
     memset(mod, 0, sizeof(*mod));
 
<span style="background: #ffdddd; color: #000000">-    /* assign a buffer from Darshan's contiguous module memory range for
-     * this module to use for storing record data
-     */
</span><span style="background: #ddffdd; color: #000000">+    /* set module's record buffer and max memory usage */
</span>     mod_mem_avail = DARSHAN_MOD_MEM_MAX - darshan_core->mod_mem_used;
     if(mod_mem_avail >= mod_mem_req)
<span style="background: #ffdddd; color: #000000">-        *inout_mod_size = mod_mem_req;
</span><span style="background: #ddffdd; color: #000000">+        mod->rec_mem_avail = mod_mem_req;
</span>     else
<span style="background: #ffdddd; color: #000000">-        *inout_mod_size = mod_mem_avail;
-    *mod_buf = darshan_core->log_mod_p + darshan_core->mod_mem_used;
</span><span style="background: #ddffdd; color: #000000">+        mod->rec_mem_avail = mod_mem_avail;
+    mod->rec_buf_start = darshan_core->log_mod_p + darshan_core->mod_mem_used;
+    mod->rec_buf_p = mod->rec_buf_start;
+    mod->funcs = *funcs;
</span> 
     /* register module with darshan */
<span style="background: #ffdddd; color: #000000">-    mod->mod_funcs = *funcs;
-    mod->mem_avail = *inout_mod_size;
</span>     darshan_core->mod_array[mod_id] = mod;
<span style="background: #ffdddd; color: #000000">-    darshan_core->mod_mem_used += *inout_mod_size;
</span><span style="background: #ddffdd; color: #000000">+    darshan_core->mod_mem_used += mod->rec_mem_avail;
</span> 
     /* update darshan header */
<span style="background: #ddffdd; color: #000000">+    /* TODO: ifdef wrap for mmap ? */
</span>     darshan_core->log_hdr_p->mod_ver[mod_id] = darshan_module_versions[mod_id];
     darshan_core->log_hdr_p->mod_map[mod_id].off =
<span style="background: #ffdddd; color: #000000">-        ((char *)*mod_buf - (char *)darshan_core->log_hdr_p);
</span><span style="background: #ddffdd; color: #000000">+        ((char *)mod->rec_buf_start - (char *)darshan_core->log_hdr_p);
+
+    *inout_mod_buf_size = mod->rec_mem_avail;
</span>     DARSHAN_CORE_UNLOCK();
 
     /* set the memory alignment and calling process's rank, if desired */
<span style="color: #aaaaaa">@@ -1771,76 +1777,60 @@ void darshan_core_unregister_module(
</span>     return;
 }
 
<span style="background: #ffdddd; color: #000000">-void darshan_core_lookup_record(
-    void *name,
-    int name_len,
-    darshan_record_id *rec_id)
</span><span style="background: #ddffdd; color: #000000">+darshan_record_id darshan_core_gen_record_id(
+    char *name)
</span> {
<span style="background: #ffdddd; color: #000000">-    darshan_record_id tmp_rec_id;
-
-    /* TODO: how do we handle potentially non-ascii record names? */
-
</span>     /* hash the input name to get a unique id for this record */
<span style="background: #ffdddd; color: #000000">-    tmp_rec_id = darshan_hash(name, name_len, 0);
-    *rec_id = tmp_rec_id;
-
-    return;
</span><span style="background: #ddffdd; color: #000000">+    return darshan_hash((unsigned char *)name, strlen(name), 0);
</span> }
 
<span style="background: #ffdddd; color: #000000">-int darshan_core_register_record(
</span><span style="background: #ddffdd; color: #000000">+void *darshan_core_register_record(
</span>     darshan_record_id rec_id,
<span style="background: #ffdddd; color: #000000">-    void *name,
</span><span style="background: #ddffdd; color: #000000">+    char *name,
</span>     darshan_module_id mod_id,
<span style="background: #ffdddd; color: #000000">-    int rec_size,
</span><span style="background: #ddffdd; color: #000000">+    int rec_len,
</span>     int *file_alignment)
 {
     struct darshan_core_name_record_ref *ref;
<span style="background: #ffdddd; color: #000000">-    int mod_oom = 0;
</span><span style="background: #ddffdd; color: #000000">+    void *rec_buf;
</span> 
     if(!darshan_core)
<span style="background: #ffdddd; color: #000000">-        return 0;
</span><span style="background: #ddffdd; color: #000000">+        return(NULL);
</span> 
     DARSHAN_CORE_LOCK();
 
     /* check to see if this module has enough space to store a new record */
<span style="background: #ffdddd; color: #000000">-    if(darshan_core->mod_array[mod_id]->mem_avail < rec_size)
-        mod_oom = 1;
-
-    /* check to see if we've already stored the id->name mapping for this record */
-    HASH_FIND(hlink, darshan_core->name_hash, &rec_id, sizeof(darshan_record_id), ref);
-    if(!ref && !mod_oom)
-    {
-        /* no mapping already exists, but this module has memory available for
-         * storing the record being registered, so we create a new id->name
-         * mapping to correspond to the record
-         */
-        darshan_add_name_record_ref(darshan_core, name, rec_id, &ref);
-    }
-
-    if(!ref)
</span><span style="background: #ddffdd; color: #000000">+    if(darshan_core->mod_array[mod_id]->rec_mem_avail < rec_len)
</span>     {
<span style="background: #ffdddd; color: #000000">-        /* if there still is no mapping for this record, either the
-         * module is out of memory or there is no more memory available for
-         * id->name mappings. just back out and indicate the record was 
-         * not registered
-         */
</span>         DARSHAN_MOD_FLAG_SET(darshan_core->log_hdr_p->partial_flag, mod_id);
         DARSHAN_CORE_UNLOCK();
<span style="background: #ffdddd; color: #000000">-        return 0;
</span><span style="background: #ddffdd; color: #000000">+        return(NULL);
</span>     }
 
<span style="background: #ffdddd; color: #000000">-    if(!DARSHAN_MOD_FLAG_ISSET(ref->mod_flags, mod_id))
</span><span style="background: #ddffdd; color: #000000">+    /* register a name record if a name is given for this record */
+    if(name)
</span>     {
<span style="background: #ffdddd; color: #000000">-        DARSHAN_MOD_FLAG_SET(ref->mod_flags, mod_id);
-        darshan_core->mod_array[mod_id]->mem_avail -= rec_size;
-        darshan_core->log_hdr_p->mod_map[mod_id].len += rec_size;
</span><span style="background: #ddffdd; color: #000000">+        /* check to see if we've already stored the id->name mapping for
+         * this record, and add a new name record if not
+         */
+        HASH_FIND(hlink, darshan_core->name_hash, &rec_id,
+            sizeof(darshan_record_id), ref);
+        if(!ref)
+        {
+            darshan_add_name_record_ref(darshan_core, rec_id, name, mod_id);
+        }
</span>     }
<span style="background: #ddffdd; color: #000000">+
+    rec_buf = darshan_core->mod_array[mod_id]->rec_buf_p;
+    darshan_core->mod_array[mod_id]->rec_buf_p += rec_len;
+    darshan_core->mod_array[mod_id]->rec_mem_avail -= rec_len;
+    darshan_core->log_hdr_p->mod_map[mod_id].len += rec_len; /* XXX */
</span>     DARSHAN_CORE_UNLOCK();
 
     if(file_alignment)
         *file_alignment = darshan_block_size_from_path(name);
 
<span style="background: #ffdddd; color: #000000">-    return 1;
</span><span style="background: #ddffdd; color: #000000">+    return(rec_buf);;
</span> }
 
 /* TODO: */
</code></pre>

<br>
</li>
<li id="4dfe7e78b540daa005ea4b5f0458c90d">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/compare/8f463e512cf639f9cbd64bba7c758ca0e02ae8d7...bfde9eb7378a95682389a76d677bbef29af8f530#diff-4">
<strong>
darshan-runtime/lib/darshan-hdf5.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="background: #ffdddd; color: #000000">--- a/darshan-runtime/lib/darshan-hdf5.c
</span><span style="background: #ddffdd; color: #000000">+++ b/darshan-runtime/lib/darshan-hdf5.c
</span><span style="color: #aaaaaa">@@ -279,8 +279,7 @@ static struct hdf5_file_runtime* hdf5_file_by_name(const char *name)
</span> 
     /* lookup the unique id for this filename */
     darshan_core_lookup_record(
<span style="background: #ffdddd; color: #000000">-        (void*)newname,
-        strlen(newname),
</span><span style="background: #ddffdd; color: #000000">+        newname,
</span>         &file_id);
 
     /* search the hash table for this file record, and return if found */
<span style="color: #aaaaaa">@@ -288,7 +287,7 @@ static struct hdf5_file_runtime* hdf5_file_by_name(const char *name)
</span>     if(!file)
     {
         /* register the record with the darshan core component */
<span style="background: #ffdddd; color: #000000">-        ret = darshan_core_register_record(file_id, (void *)newname, DARSHAN_HDF5_MOD,
</span><span style="background: #ddffdd; color: #000000">+        ret = darshan_core_register_record(file_id, newname, DARSHAN_HDF5_MOD,
</span>             sizeof(struct darshan_hdf5_file), NULL);
         if(ret == 1)
         {
</code></pre>

<br>
</li>
<li id="172f4bf093caeeba24730a1adff8f15a">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/compare/8f463e512cf639f9cbd64bba7c758ca0e02ae8d7...bfde9eb7378a95682389a76d677bbef29af8f530#diff-5">
<strong>
darshan-runtime/lib/darshan-mpiio.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="background: #ffdddd; color: #000000">--- a/darshan-runtime/lib/darshan-mpiio.c
</span><span style="background: #ddffdd; color: #000000">+++ b/darshan-runtime/lib/darshan-mpiio.c
</span><span style="color: #aaaaaa">@@ -910,8 +910,7 @@ static struct mpiio_file_runtime* mpiio_file_by_name(const char *name)
</span> 
     /* lookup the unique id for this filename */
     darshan_core_lookup_record(
<span style="background: #ffdddd; color: #000000">-        (void*)newname,
-        strlen(newname),
</span><span style="background: #ddffdd; color: #000000">+        newname,
</span>         &file_id);
 
     /* search the hash table for this file record, and return if found */
<span style="color: #aaaaaa">@@ -919,7 +918,7 @@ static struct mpiio_file_runtime* mpiio_file_by_name(const char *name)
</span>     if(!file)
     {
         /* register the record with the darshan core component */
<span style="background: #ffdddd; color: #000000">-        ret = darshan_core_register_record(file_id, (void *)newname, DARSHAN_MPIIO_MOD,
</span><span style="background: #ddffdd; color: #000000">+        ret = darshan_core_register_record(file_id, newname, DARSHAN_MPIIO_MOD,
</span>             sizeof(struct darshan_mpiio_file), NULL);
         if(ret == 1)
         {
</code></pre>

<br>
</li>
<li id="a453f91a0a4af7575917fad54f4ac1d0">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/compare/8f463e512cf639f9cbd64bba7c758ca0e02ae8d7...bfde9eb7378a95682389a76d677bbef29af8f530#diff-6">
<strong>
darshan-runtime/lib/darshan-pnetcdf.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="background: #ffdddd; color: #000000">--- a/darshan-runtime/lib/darshan-pnetcdf.c
</span><span style="background: #ddffdd; color: #000000">+++ b/darshan-runtime/lib/darshan-pnetcdf.c
</span><span style="color: #aaaaaa">@@ -291,8 +291,7 @@ static struct pnetcdf_file_runtime* pnetcdf_file_by_name(const char *name)
</span> 
     /* lookup the unique id for this filename */
     darshan_core_lookup_record(
<span style="background: #ffdddd; color: #000000">-        (void*)newname,
-        strlen(newname),
</span><span style="background: #ddffdd; color: #000000">+        newname,
</span>         &file_id);
 
     /* search the hash table for this file record, and return if found */
<span style="color: #aaaaaa">@@ -300,7 +299,7 @@ static struct pnetcdf_file_runtime* pnetcdf_file_by_name(const char *name)
</span>     if(!file)
     {
         /* register the record with the darshan core component */
<span style="background: #ffdddd; color: #000000">-        ret = darshan_core_register_record(file_id, (void *)newname, DARSHAN_PNETCDF_MOD,
</span><span style="background: #ddffdd; color: #000000">+        ret = darshan_core_register_record(file_id, newname, DARSHAN_PNETCDF_MOD,
</span>             sizeof(struct darshan_pnetcdf_file), NULL);
         if(ret == 1)
         {
</code></pre>

<br>
</li>
<li id="dffc348e63ffc0037c23afd36439222f">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/compare/8f463e512cf639f9cbd64bba7c758ca0e02ae8d7...bfde9eb7378a95682389a76d677bbef29af8f530#diff-7">
<strong>
darshan-runtime/lib/darshan-posix.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="background: #ffdddd; color: #000000">--- a/darshan-runtime/lib/darshan-posix.c
</span><span style="background: #ddffdd; color: #000000">+++ b/darshan-runtime/lib/darshan-posix.c
</span><span style="color: #aaaaaa">@@ -168,9 +168,6 @@ struct posix_file_runtime_ref
</span>  */
 struct posix_runtime
 {
<span style="background: #ffdddd; color: #000000">-    struct posix_file_runtime* file_runtime_array;
-    struct darshan_posix_file* file_record_array;
-    int file_array_ndx;
</span>     struct posix_file_runtime* file_hash;
     struct posix_file_runtime_ref* fd_hash;
 };
<span style="color: #aaaaaa">@@ -1450,9 +1447,7 @@ static void posix_runtime_initialize()
</span>         .get_output_data = &posix_get_output_data,
         .shutdown = &posix_shutdown
     };
<span style="background: #ffdddd; color: #000000">-    void *psx_buf;
</span>     int psx_buf_size;
<span style="background: #ffdddd; color: #000000">-    int file_array_size;
</span> 
     /* don't do anything if already initialized or instrumenation is disabled */
     if(posix_runtime || instrumentation_disabled)
<span style="color: #aaaaaa">@@ -1466,7 +1461,6 @@ static void posix_runtime_initialize()
</span>         DARSHAN_POSIX_MOD,
         &posix_mod_fns,
         &psx_buf_size,
<span style="background: #ffdddd; color: #000000">-        &psx_buf,
</span>         &my_rank,
         &darshan_mem_alignment);
 
<span style="color: #aaaaaa">@@ -1485,40 +1479,17 @@ static void posix_runtime_initialize()
</span>     }
     memset(posix_runtime, 0, sizeof(*posix_runtime));
 
<span style="background: #ffdddd; color: #000000">-    /* set number of trackable files for the POSIX module according to the
-     * amount of memory returned by darshan-core
-     */
-    file_array_size = psx_buf_size / sizeof(struct darshan_posix_file);
-    posix_runtime->file_array_ndx = 0;
-
-    /* store pointer to POSIX record buffer given by darshan-core */
-    posix_runtime->file_record_array = (struct darshan_posix_file *)psx_buf;
-
-    /* allocate array of runtime file records */
-    posix_runtime->file_runtime_array = malloc(file_array_size *
-                                               sizeof(struct posix_file_runtime));
-    if(!posix_runtime->file_runtime_array)
-    {
-        free(posix_runtime);
-        posix_runtime = NULL;
-        darshan_core_unregister_module(DARSHAN_POSIX_MOD);
-        return;
-    }
-    memset(posix_runtime->file_runtime_array, 0, file_array_size *
-           sizeof(struct posix_file_runtime));
-
</span>     return;
 }
 
 /* get a POSIX file record for the given file path */
 static struct posix_file_runtime* posix_file_by_name(const char *name)
 {
<span style="background: #ffdddd; color: #000000">-    struct posix_file_runtime *file = NULL;
-    struct darshan_posix_file *file_rec;
</span><span style="background: #ddffdd; color: #000000">+    struct posix_file_runtime *file_rec_rt;
+    struct darshan_posix_file *file_rec = NULL;
</span>     char *newname = NULL;
     darshan_record_id file_id;
     int file_alignment;
<span style="background: #ffdddd; color: #000000">-    int ret;
</span> 
     if(!posix_runtime || instrumentation_disabled)
         return(NULL);
<span style="color: #aaaaaa">@@ -1527,42 +1498,44 @@ static struct posix_file_runtime* posix_file_by_name(const char *name)
</span>     if(!newname)
         newname = (char*)name;
 
<span style="background: #ffdddd; color: #000000">-    /* lookup the unique id for this filename */
-    darshan_core_lookup_record(
-        (void*)newname,
-        strlen(newname),
-        &file_id);
</span><span style="background: #ddffdd; color: #000000">+    /* lookup the id for this filename */
+    file_id = darshan_core_gen_record_id(newname);
</span> 
     /* search the hash table for this file record, and return if found */
<span style="background: #ffdddd; color: #000000">-    HASH_FIND(hlink, posix_runtime->file_hash, &file_id, sizeof(darshan_record_id), file);
-    if(!file)
</span><span style="background: #ddffdd; color: #000000">+    HASH_FIND(hlink, posix_runtime->file_hash, &file_id,
+        sizeof(darshan_record_id), file_rec_rt);
+    if(file_rec_rt == NULL)
</span>     {
<span style="background: #ffdddd; color: #000000">-        /* register the record with the darshan core component */
-        ret = darshan_core_register_record(file_id, (void *)newname, DARSHAN_POSIX_MOD,
-            sizeof(struct darshan_posix_file), &file_alignment);
-        if(ret == 1)
</span><span style="background: #ddffdd; color: #000000">+        file_rec_rt = malloc(sizeof(*file_rec_rt));
+        if(file_rec_rt)
</span>         {
<span style="background: #ffdddd; color: #000000">-            /* register was successful */
-            file = &(posix_runtime->file_runtime_array[posix_runtime->file_array_ndx]);
-            file->file_record = 
-                &(posix_runtime->file_record_array[posix_runtime->file_array_ndx]);
-            file_rec = file->file_record;
</span><span style="background: #ddffdd; color: #000000">+            memset(file_rec_rt, 0, sizeof(*file_rec_rt));
</span> 
<span style="background: #ddffdd; color: #000000">+            /* attempt to register the record with darshan core */
+            file_rec = darshan_core_register_record(file_id, newname, DARSHAN_POSIX_MOD,
+                sizeof(struct darshan_posix_file), &file_alignment);
+            if(!file_rec)
+                free(file_rec_rt);
+        }
+
+        if(file_rec != NULL)
+        {
+            /* register was successful, init structures */
</span>             file_rec->base_rec.id = file_id;
             file_rec->base_rec.rank = my_rank;
             file_rec->counters[POSIX_MEM_ALIGNMENT] = darshan_mem_alignment;
             file_rec->counters[POSIX_FILE_ALIGNMENT] = file_alignment;
<span style="background: #ddffdd; color: #000000">+            file_rec_rt->file_record = file_rec;
</span> 
             /* add new record to file hash table */
             HASH_ADD(hlink, posix_runtime->file_hash, file_record->base_rec.id,
<span style="background: #ffdddd; color: #000000">-                sizeof(darshan_record_id), file);
-            posix_runtime->file_array_ndx++;
</span><span style="background: #ddffdd; color: #000000">+                sizeof(darshan_record_id), file_rec_rt);
</span>         }
     }
 
     if(newname != name)
         free(newname);
<span style="background: #ffdddd; color: #000000">-    return(file);
</span><span style="background: #ddffdd; color: #000000">+    return(file_rec_rt);
</span> }
 
 /* get a POSIX file record for the given file path, and also create a
<span style="color: #aaaaaa">@@ -1578,7 +1551,6 @@ static struct posix_file_runtime* posix_file_by_name_setfd(const char* name, int
</span> 
     /* find file record by name first */
     file = posix_file_by_name(name);
<span style="background: #ffdddd; color: #000000">-
</span>     if(!file)
         return(NULL);
 
<span style="color: #aaaaaa">@@ -2040,41 +2012,41 @@ static void posix_get_output_data(
</span>     void **posix_buf,
     int *posix_buf_sz)
 {
<span style="background: #ffdddd; color: #000000">-    struct posix_file_runtime *file;
-    struct posix_file_runtime *tmp;
-    int i;
</span><span style="background: #ddffdd; color: #000000">+    struct posix_file_runtime *file_rec_rt, *tmp;
+    struct darshan_posix_file *posix_rec_buf = *(struct darshan_posix_file **)posix_buf;
</span>     double posix_time;
<span style="background: #ddffdd; color: #000000">+    int posix_rec_count;
</span>     struct darshan_posix_file *red_send_buf = NULL;
     struct darshan_posix_file *red_recv_buf = NULL;
     MPI_Datatype red_type;
     MPI_Op red_op;
<span style="background: #ddffdd; color: #000000">+    int i;
</span> 
     assert(posix_runtime);
<span style="background: #ddffdd; color: #000000">+    posix_rec_count = HASH_CNT(hlink, posix_runtime->file_hash);
</span> 
     /* go through file access data for each record and set the 4 most common
      * stride/access size counters.
      */
<span style="background: #ffdddd; color: #000000">-    for(i = 0; i < posix_runtime->file_array_ndx; i++)
</span><span style="background: #ddffdd; color: #000000">+    HASH_ITER(hlink, posix_runtime->file_hash, file_rec_rt, tmp)
</span>     {
<span style="background: #ffdddd; color: #000000">-        tmp = &(posix_runtime->file_runtime_array[i]);
-
</span> #ifndef __DARSHAN_ENABLE_MMAP_LOGS
         /* walk common counters to get 4 most common -- only if mmap
          * feature is disabled (mmap updates counters on the go)
          */
 
         /* common accesses */
<span style="background: #ffdddd; color: #000000">-        darshan_walk_common_vals(tmp->access_root,
-            &(tmp->file_record->counters[POSIX_ACCESS1_ACCESS]),
-            &(tmp->file_record->counters[POSIX_ACCESS1_COUNT]));
</span><span style="background: #ddffdd; color: #000000">+        darshan_walk_common_vals(file_rec_rt->access_root,
+            &(file_rec_rt->file_record->counters[POSIX_ACCESS1_ACCESS]),
+            &(file_rec_rt->file_record->counters[POSIX_ACCESS1_COUNT]));
</span>         /* common strides */
<span style="background: #ffdddd; color: #000000">-        darshan_walk_common_vals(tmp->stride_root,
-            &(tmp->file_record->counters[POSIX_STRIDE1_STRIDE]),
-            &(tmp->file_record->counters[POSIX_STRIDE1_COUNT]));
</span><span style="background: #ddffdd; color: #000000">+        darshan_walk_common_vals(file_rec_rt->stride_root,
+            &(file_rec_rt->file_record->counters[POSIX_STRIDE1_STRIDE]),
+            &(file_rec_rt->file_record->counters[POSIX_STRIDE1_COUNT]));
</span> #endif
 
<span style="background: #ffdddd; color: #000000">-        tdestroy(tmp->access_root, free);
-        tdestroy(tmp->stride_root, free);
</span><span style="background: #ddffdd; color: #000000">+        tdestroy(file_rec_rt->access_root, free);
+        tdestroy(file_rec_rt->stride_root, free);
</span>     }
 
     /* if there are globally shared files, do a shared file reduction */
<span style="color: #aaaaaa">@@ -2087,56 +2059,53 @@ static void posix_get_output_data(
</span>         for(i = 0; i < shared_rec_count; i++)
         {
             HASH_FIND(hlink, posix_runtime->file_hash, &shared_recs[i],
<span style="background: #ffdddd; color: #000000">-                sizeof(darshan_record_id), file);
-            assert(file);
</span><span style="background: #ddffdd; color: #000000">+                sizeof(darshan_record_id), file_rec_rt);
+            assert(file_rec_rt);
</span> 
             posix_time =
<span style="background: #ffdddd; color: #000000">-                file->file_record->fcounters[POSIX_F_READ_TIME] +
-                file->file_record->fcounters[POSIX_F_WRITE_TIME] +
-                file->file_record->fcounters[POSIX_F_META_TIME];
</span><span style="background: #ddffdd; color: #000000">+                file_rec_rt->file_record->fcounters[POSIX_F_READ_TIME] +
+                file_rec_rt->file_record->fcounters[POSIX_F_WRITE_TIME] +
+                file_rec_rt->file_record->fcounters[POSIX_F_META_TIME];
</span> 
             /* initialize fastest/slowest info prior to the reduction */
<span style="background: #ffdddd; color: #000000">-            file->file_record->counters[POSIX_FASTEST_RANK] =
-                file->file_record->base_rec.rank;
-            file->file_record->counters[POSIX_FASTEST_RANK_BYTES] =
-                file->file_record->counters[POSIX_BYTES_READ] +
-                file->file_record->counters[POSIX_BYTES_WRITTEN];
-            file->file_record->fcounters[POSIX_F_FASTEST_RANK_TIME] =
</span><span style="background: #ddffdd; color: #000000">+            file_rec_rt->file_record->counters[POSIX_FASTEST_RANK] =
+                file_rec_rt->file_record->base_rec.rank;
+            file_rec_rt->file_record->counters[POSIX_FASTEST_RANK_BYTES] =
+                file_rec_rt->file_record->counters[POSIX_BYTES_READ] +
+                file_rec_rt->file_record->counters[POSIX_BYTES_WRITTEN];
+            file_rec_rt->file_record->fcounters[POSIX_F_FASTEST_RANK_TIME] =
</span>                 posix_time;
 
             /* until reduction occurs, we assume that this rank is both
              * the fastest and slowest. It is up to the reduction operator
              * to find the true min and max.
              */
<span style="background: #ffdddd; color: #000000">-            file->file_record->counters[POSIX_SLOWEST_RANK] =
-                file->file_record->counters[POSIX_FASTEST_RANK];
-            file->file_record->counters[POSIX_SLOWEST_RANK_BYTES] =
-                file->file_record->counters[POSIX_FASTEST_RANK_BYTES];
-            file->file_record->fcounters[POSIX_F_SLOWEST_RANK_TIME] =
-                file->file_record->fcounters[POSIX_F_FASTEST_RANK_TIME];
-
-            file->file_record->base_rec.rank = -1;
</span><span style="background: #ddffdd; color: #000000">+            file_rec_rt->file_record->counters[POSIX_SLOWEST_RANK] =
+                file_rec_rt->file_record->counters[POSIX_FASTEST_RANK];
+            file_rec_rt->file_record->counters[POSIX_SLOWEST_RANK_BYTES] =
+                file_rec_rt->file_record->counters[POSIX_FASTEST_RANK_BYTES];
+            file_rec_rt->file_record->fcounters[POSIX_F_SLOWEST_RANK_TIME] =
+                file_rec_rt->file_record->fcounters[POSIX_F_FASTEST_RANK_TIME];
+
+            file_rec_rt->file_record->base_rec.rank = -1;
</span>         }
 
         /* sort the array of files descending by rank so that we get all of the 
          * shared files (marked by rank -1) in a contiguous portion at end 
          * of the array
          */
<span style="background: #ffdddd; color: #000000">-        qsort(posix_runtime->file_record_array, posix_runtime->file_array_ndx,
-            sizeof(struct darshan_posix_file), posix_record_compare);
</span><span style="background: #ddffdd; color: #000000">+        qsort(posix_rec_buf, posix_rec_count, sizeof(struct darshan_posix_file),
+            posix_record_compare);
</span> 
         /* make *send_buf point to the shared files at the end of sorted array */
<span style="background: #ffdddd; color: #000000">-        red_send_buf =
-            &(posix_runtime->file_record_array[posix_runtime->file_array_ndx-shared_rec_count]);
-        
</span><span style="background: #ddffdd; color: #000000">+        red_send_buf = &(posix_rec_buf[posix_rec_count-shared_rec_count]);
+
</span>         /* allocate memory for the reduction output on rank 0 */
         if(my_rank == 0)
         {
             red_recv_buf = malloc(shared_rec_count * sizeof(struct darshan_posix_file));
             if(!red_recv_buf)
<span style="background: #ffdddd; color: #000000">-            {
</span>                 return;
<span style="background: #ffdddd; color: #000000">-            }
</span>         }
 
         /* construct a datatype for a POSIX file record.  This is serving no purpose
<span style="color: #aaaaaa">@@ -2160,41 +2129,45 @@ static void posix_get_output_data(
</span>         /* clean up reduction state */
         if(my_rank == 0)
         {
<span style="background: #ffdddd; color: #000000">-            int tmp_ndx = posix_runtime->file_array_ndx - shared_rec_count;
-            memcpy(&(posix_runtime->file_record_array[tmp_ndx]), red_recv_buf,
</span><span style="background: #ddffdd; color: #000000">+            int tmp_ndx = posix_rec_count - shared_rec_count;
+            memcpy(&(posix_rec_buf[tmp_ndx]), red_recv_buf,
</span>                 shared_rec_count * sizeof(struct darshan_posix_file));
             free(red_recv_buf);
         }
         else
         {
<span style="background: #ffdddd; color: #000000">-            posix_runtime->file_array_ndx -= shared_rec_count;
</span><span style="background: #ddffdd; color: #000000">+            posix_rec_count -= shared_rec_count;
</span>         }
 
         DARSHAN_MPI_CALL(PMPI_Type_free)(&red_type);
         DARSHAN_MPI_CALL(PMPI_Op_free)(&red_op);
     }
 
<span style="background: #ffdddd; color: #000000">-    *posix_buf = (void *)(posix_runtime->file_record_array);
-    *posix_buf_sz = posix_runtime->file_array_ndx * sizeof(struct darshan_posix_file);
</span><span style="background: #ddffdd; color: #000000">+    /* update output buffer size to account for shared file reduction */
+    *posix_buf_sz = posix_rec_count * sizeof(struct darshan_posix_file);
</span> 
     return;
 }
 
 static void posix_shutdown()
 {
<span style="background: #ffdddd; color: #000000">-    struct posix_file_runtime_ref *ref, *tmp;
</span><span style="background: #ddffdd; color: #000000">+    struct posix_file_runtime_ref *fd_ref, *fd_tmp;
+    struct posix_file_runtime *file_ref, *file_tmp;
</span> 
     assert(posix_runtime);
 
<span style="background: #ffdddd; color: #000000">-    HASH_ITER(hlink, posix_runtime->fd_hash, ref, tmp)
</span><span style="background: #ddffdd; color: #000000">+    HASH_ITER(hlink, posix_runtime->fd_hash, fd_ref, fd_tmp)
</span>     {
<span style="background: #ffdddd; color: #000000">-        HASH_DELETE(hlink, posix_runtime->fd_hash, ref);
-        free(ref);
</span><span style="background: #ddffdd; color: #000000">+        HASH_DELETE(hlink, posix_runtime->fd_hash, fd_ref);
+        free(fd_ref);
</span>     }
 
<span style="background: #ffdddd; color: #000000">-    HASH_CLEAR(hlink, posix_runtime->file_hash); /* these entries are freed all at once below */
</span><span style="background: #ddffdd; color: #000000">+    HASH_ITER(hlink, posix_runtime->file_hash, file_ref, file_tmp)
+    {
+        HASH_DELETE(hlink, posix_runtime->file_hash, file_ref);
+        free(file_ref);
+    }
</span> 
<span style="background: #ffdddd; color: #000000">-    free(posix_runtime->file_runtime_array);
</span>     free(posix_runtime);
     posix_runtime = NULL;
     
</code></pre>

<br>
</li>

</div>
<div class="footer" style="margin-top: 10px">
<p style="color: #777; font-size: small">

<br>
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/compare/8f463e512cf639f9cbd64bba7c758ca0e02ae8d7...bfde9eb7378a95682389a76d677bbef29af8f530">View it on GitLab</a>.
<br>
You're receiving this email because of your account on xgitlab.cels.anl.gov.
If you'd like to receive fewer emails, you can
adjust your notification settings.

</p>
</div>
</body>
</html>