<!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/8f463e512cf639f9cbd64bba7c758ca0e02ae8d7">8f463e51</a></strong>
<div>
<span>by Shane Snyder</span>
<i>at 2016-05-27T15:10:12-05:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap">remove shared name records on nonzero ranks</pre>
</li>
</ul>
<h4>1 changed file:</h4>
<ul>
<li class="file-stats">
<a href="#620f2ecad2bb6f74b2fcd0134963a841" style="text-decoration: none">
darshan-runtime/lib/darshan-core.c
</a>
</li>
</ul>
<h4>Changes:</h4>
<li id="620f2ecad2bb6f74b2fcd0134963a841">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/8f463e512cf639f9cbd64bba7c758ca0e02ae8d7#diff-0">
<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">@@ -1480,22 +1480,83 @@ static int darshan_deflate_buffer(void **pointers, int *lengths, int count,
</span> static int darshan_log_write_name_record_hash(MPI_File log_fh,
     struct darshan_core_runtime *core, uint64_t *inout_off)
 {
<span style="background: #ffdddd; color: #000000">-    struct darshan_core_name_record_ref *ref, *tmp;
</span><span style="background: #ddffdd; color: #000000">+    struct darshan_core_name_record_ref *ref;
+    struct darshan_name_record *name_rec;
+    char *my_buf, *shared_buf;
+    char *tmp_p;
+    int rec_len;
+    int shared_buf_len;
+    int name_rec_buf_len;
</span>     int ret;
 
<span style="background: #ffdddd; color: #000000">-    /* serialize the record hash into a buffer for writing */
-    HASH_ITER(hlink, core->name_hash, ref, tmp)
</span><span style="background: #ddffdd; color: #000000">+    name_rec_buf_len = core->log_hdr_p->name_map.len;
+    if(my_rank > 0)
</span>     {
<span style="background: #ffdddd; color: #000000">-        /* to avoid duplicate records, only rank 0 will write shared records */
-        if(my_rank > 0 && ref->global_mod_flags)
</span><span style="background: #ddffdd; color: #000000">+        name_rec = core->log_name_p;
+        my_buf = core->log_name_p;
+        shared_buf = core->comp_buf;
+        shared_buf_len = 0;
+        while(name_rec_buf_len > 0)
+        {
+            HASH_FIND(hlink, core->name_hash, &(name_rec->id),
+                sizeof(darshan_record_id), ref);
+            assert(ref);
+            rec_len = sizeof(darshan_record_id) + strlen(name_rec->name) + 1;
+
+            if(ref->global_mod_flags)
+            {
+                HASH_DELETE(hlink, core->name_hash, ref);
+                memcpy(shared_buf, name_rec, rec_len);
+                ref->name_record = (struct darshan_name_record *)shared_buf;
+                HASH_ADD(hlink, core->name_hash, name_record->id,
+                    sizeof(darshan_record_id), ref);
+
+                shared_buf += rec_len;
+                shared_buf_len += rec_len;
+            }
+            else
+            {
+                if(my_buf != (char *)name_rec)
+                {
+                    HASH_DELETE(hlink, core->name_hash, ref);
+                    memcpy(my_buf, name_rec, rec_len);
+                    ref->name_record =(struct darshan_name_record *)my_buf;
+                    HASH_ADD(hlink, core->name_hash, name_record->id,
+                        sizeof(darshan_record_id), ref);
+                }
+                my_buf += rec_len;
+            }
+
+            tmp_p = (char *)name_rec + rec_len;
+            name_rec = (struct darshan_name_record *)tmp_p;
+            name_rec_buf_len -= rec_len;
+        }
+        name_rec_buf_len = core->log_hdr_p->name_map.len - shared_buf_len;
+
+        name_rec = (struct darshan_name_record *)core->comp_buf;
+        while(shared_buf_len > 0)
</span>         {
<span style="background: #ffdddd; color: #000000">-            /* TODO: remove ref */
</span><span style="background: #ddffdd; color: #000000">+            HASH_FIND(hlink, core->name_hash, &(name_rec->id),
+                sizeof(darshan_record_id), ref);
+            assert(ref);
+            rec_len = sizeof(darshan_record_id) + strlen(name_rec->name) + 1;
+
+            HASH_DELETE(hlink, core->name_hash, ref);
+            memcpy(my_buf, name_rec, rec_len);
+            ref->name_record = (struct darshan_name_record *)my_buf;
+            HASH_ADD(hlink, core->name_hash, name_record->id,
+                sizeof(darshan_record_id), ref);
+
+            tmp_p = (char *)name_rec + rec_len;
+            name_rec = (struct darshan_name_record *)tmp_p;
+            my_buf += rec_len;
+            shared_buf_len -= rec_len;
</span>         }
     }
 
     /* collectively write out the record hash to the darshan log */
     ret = darshan_log_append_all(log_fh, core, core->log_name_p,
<span style="background: #ffdddd; color: #000000">-        core->log_hdr_p->name_map.len, inout_off);
</span><span style="background: #ddffdd; color: #000000">+        name_rec_buf_len, inout_off);
</span> 
     return(ret);
 }
</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/commit/8f463e512cf639f9cbd64bba7c758ca0e02ae8d7">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>