[Darshan-commits] [Git][darshan/darshan][master] add unique id to mmap log file names

Shane Snyder xgitlab at cels.anl.gov
Thu Sep 8 17:17:20 CDT 2016


Shane Snyder pushed to branch master at darshan / darshan


Commits:
df34ba2b by Shane Snyder at 2016-09-08T15:16:31-07:00
add unique id to mmap log file names

This is needed to distinguish between log files generated with
the same job id (i.e., for jobs that have multiple steps)

- - - - -


1 changed file:

- darshan-runtime/lib/darshan-core.c


Changes:

=====================================
darshan-runtime/lib/darshan-core.c
=====================================
--- a/darshan-runtime/lib/darshan-core.c
+++ b/darshan-runtime/lib/darshan-core.c
@@ -786,6 +786,9 @@ static void *darshan_init_mmap_log(struct darshan_core_runtime* core, int jobid)
     int mmap_size;
     int sys_page_size;
     char cuser[L_cuserid] = {0};
+    uint64_t hlevel;
+    char hname[HOST_NAME_MAX];
+    uint64_t logmod;
     char *envstr;
     char *mmap_log_path;
     void *mmap_p;
@@ -806,12 +809,25 @@ static void *darshan_init_mmap_log(struct darshan_core_runtime* core, int jobid)
 
     darshan_get_user_name(cuser);
 
+    /* generate a random number to help differentiate the temporary log */
+    /* NOTE: job id is not sufficient for constructing a unique log file name,
+     * since a job could be composed of multiple application runs, so we also
+     * add a random number component to the log name
+     */
+    if(my_rank == 0)
+    {
+        hlevel=DARSHAN_MPI_CALL(PMPI_Wtime)() * 1000000;
+        (void)gethostname(hname, sizeof(hname));
+        logmod = darshan_hash((void*)hname,strlen(hname),hlevel);
+    }
+    DARSHAN_MPI_CALL(PMPI_Bcast)(&logmod, 1, MPI_UINT64_T, 0, MPI_COMM_WORLD);
+
     /* construct a unique temporary log file name for this process
      * to write mmap log data to
      */
     snprintf(core->mmap_log_name, PATH_MAX,
-        "/%s/%s_%s_id%d_mmap-log-%d.darshan",
-        mmap_log_path, cuser, __progname, jobid, my_rank);
+        "/%s/%s_%s_id%d_mmap-log-%" PRIu64 "-%d.darshan",
+        mmap_log_path, cuser, __progname, jobid, logmod, my_rank);
 
     /* create the temporary mmapped darshan log */
     mmap_fd = open(core->mmap_log_name, O_CREAT|O_RDWR|O_EXCL , 0644);



View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/commit/df34ba2b01936ec028e972b336c89daeda70aeea
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/darshan-commits/attachments/20160908/f8f7ca03/attachment-0001.html>


More information about the Darshan-commits mailing list