[Darshan-commits] [Git][darshan/darshan][master] 2 commits: switch darshan-merge buffer allocation strategy

Shane Snyder xgitlab at cels.anl.gov
Tue Sep 20 11:49:30 CDT 2016


Shane Snyder pushed to branch master at darshan / darshan


Commits:
426d6161 by Shane Snyder at 2016-09-20T11:48:32-05:00
switch darshan-merge buffer allocation strategy

- - - - -
c8266822 by Shane Snyder at 2016-09-20T11:48:47-05:00
add aggregate function to lustre logutils

- - - - -


2 changed files:

- darshan-util/darshan-lustre-logutils.c
- darshan-util/darshan-merge.c


Changes:

=====================================
darshan-util/darshan-lustre-logutils.c
=====================================
--- a/darshan-util/darshan-lustre-logutils.c
+++ b/darshan-util/darshan-lustre-logutils.c
@@ -31,6 +31,7 @@ static void darshan_log_print_lustre_record(void *file_rec,
 static void darshan_log_print_lustre_description(void);
 static void darshan_log_print_lustre_record_diff(void *rec1, char *file_name1,
     void *rec2, char *file_name2);
+static void darshan_log_agg_lustre_records(void *rec, void *agg_rec, int init_flag);
 
 struct darshan_mod_logutil_funcs lustre_logutils =
 {
@@ -38,7 +39,8 @@ struct darshan_mod_logutil_funcs lustre_logutils =
     .log_put_record = &darshan_log_put_lustre_record,
     .log_print_record = &darshan_log_print_lustre_record,
     .log_print_description = &darshan_log_print_lustre_description,
-    .log_print_diff = &darshan_log_print_lustre_record_diff
+    .log_print_diff = &darshan_log_print_lustre_record_diff,
+    .log_agg_records = &darshan_log_agg_lustre_records
 };
 
 static int darshan_log_get_lustre_record(darshan_fd fd, void** lustre_buf_p)
@@ -158,13 +160,12 @@ static void darshan_log_print_lustre_record(void *rec, char *file_name,
 
 static void darshan_log_print_lustre_description()
 {
-    /* TODO: add actual counter descriptions here */
     printf("\n# description of LUSTRE counters:\n");
     printf("#   LUSTRE_OSTS: number of OSTs across the entire file system.\n");
     printf("#   LUSTRE_MDTS: number of MDTs across the entire file system.\n");
+    printf("#   LUSTRE_STRIPE_OFFSET: OST ID offset specified when the file was created.\n");
     printf("#   LUSTRE_STRIPE_SIZE: stripe size for file in bytes.\n");
     printf("#   LUSTRE_STRIPE_WIDTH: number of OSTs over which file is striped.\n");
-    printf("#   LUSTRE_STRIPE_OFFSET: OST ID offset specified when the file was created.\n");
     printf("#   LUSTRE_OST_ID_*: indices of OSTs over which the file is striped.\n");
 
     DARSHAN_PRINT_HEADER();
@@ -244,6 +245,35 @@ static void darshan_log_print_lustre_record_diff(void *rec1, char *file_name1,
     return;
 }
 
+static void darshan_log_agg_lustre_records(void *rec, void *agg_rec, int init_flag)
+{
+    struct darshan_lustre_record *lustre_rec = (struct darshan_lustre_record *)rec;
+    struct darshan_lustre_record *agg_lustre_rec = (struct darshan_lustre_record *)agg_rec;
+    int i;
+
+    if(init_flag)
+    {
+        /* when initializing, just copy over the first record */
+        memcpy(agg_lustre_rec, lustre_rec, LUSTRE_RECORD_SIZE(
+            lustre_rec->counters[LUSTRE_STRIPE_WIDTH]));
+    }
+    else
+    {
+        /* for remaining records, just sanity check the records are identical */
+        for(i = 0; i < LUSTRE_NUM_INDICES; i++)
+        {
+            assert(lustre_rec->counters[i] == agg_lustre_rec->counters[i]);
+        }
+        for(i = 0; i < agg_lustre_rec->counters[LUSTRE_STRIPE_WIDTH]; i++)
+        {
+            assert(lustre_rec->ost_ids[i] == agg_lustre_rec->ost_ids[i]);
+        }
+    }
+
+    return;
+}
+
+
 /*
  * Local variables:
  *  c-indent-level: 4


=====================================
darshan-util/darshan-merge.c
=====================================
--- a/darshan-util/darshan-merge.c
+++ b/darshan-util/darshan-merge.c
@@ -130,10 +130,10 @@ int build_mod_shared_rec_hash(char **infile_list, int n_infiles,
                 memset(ref, 0, sizeof(*ref));
 
                 /* initialize the aggregate record with this rank's record */
+                mod_logutils[mod_id]->log_agg_records(mod_buf, ref->agg_rec, 1);
                 agg_base = (struct darshan_base_record *)ref->agg_rec;
                 agg_base->id = base_rec->id;
                 agg_base->rank = -1;
-                mod_logutils[mod_id]->log_agg_records(mod_buf, ref->agg_rec, 1);
 
                 ref->id = base_rec->id;
                 ref->ref_cnt = 1;
@@ -195,7 +195,7 @@ int main(int argc, char *argv[])
     struct darshan_shared_record_ref *shared_rec_hash = NULL;
     struct darshan_shared_record_ref *sref, *stmp;
     struct darshan_base_record *base_rec;
-    char mod_buf[DEF_MOD_BUF_SIZE];
+    char *mod_buf;
     int i, j;
     int ret;
 
@@ -365,6 +365,15 @@ int main(int argc, char *argv[])
         return(-1);
     }
 
+    mod_buf = malloc(DEF_MOD_BUF_SIZE);
+    if(!mod_buf)
+    {
+        fprintf(stderr, "Error: unable to write record table to output darshan log.\n");
+        darshan_log_close(merge_fd);
+        unlink(outlog_path);
+        return(-1);
+    }
+
     /* iterate over active darshan modules and gather module data to write
      * to the merged output log
      */
@@ -384,6 +393,7 @@ int main(int argc, char *argv[])
                     darshan_module_names[i]);
                 darshan_log_close(merge_fd);
                 unlink(outlog_path);
+                free(mod_buf);
                 return(-1);
             }
 
@@ -399,6 +409,7 @@ int main(int argc, char *argv[])
                     infile_list[j]);
                 darshan_log_close(merge_fd);
                 unlink(outlog_path);
+                free(mod_buf);
                 return(-1);
             }
 
@@ -416,6 +427,7 @@ int main(int argc, char *argv[])
                         darshan_log_close(in_fd);
                         darshan_log_close(merge_fd);
                         unlink(outlog_path);
+                        free(mod_buf);
                         return(-1);
                     }
                 }
@@ -439,6 +451,7 @@ int main(int argc, char *argv[])
                     darshan_log_close(in_fd);
                     darshan_log_close(merge_fd);
                     unlink(outlog_path);
+                    free(mod_buf);
                     return(-1);
                 }
             }
@@ -450,6 +463,7 @@ int main(int argc, char *argv[])
                 darshan_log_close(in_fd);
                 darshan_log_close(merge_fd);
                 unlink(outlog_path);
+                free(mod_buf);
                 return(-1);
             }
 
@@ -467,6 +481,8 @@ int main(int argc, char *argv[])
         }
     }
 
+    free(mod_buf);
+
     darshan_log_close(merge_fd);
 
     return(0);



View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/compare/ab32cf6690d62217a188a1dcf5010331405a6c04...c82668224b7ec433158065ef719d3454e39d0611
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/darshan-commits/attachments/20160920/c8009b9b/attachment-0001.html>


More information about the Darshan-commits mailing list