[Darshan-commits] [Git][darshan/darshan][master] 4 commits: demonstrator for #218

Shane Snyder xgitlab at cels.anl.gov
Mon Jan 23 16:03:18 CST 2017


Shane Snyder pushed to branch master at darshan / darshan


Commits:
640f20ff by Phil Carns at 2017-01-22T19:32:09-05:00
demonstrator for #218

- - - - -
8a6a35b0 by Phil Carns at 2017-01-22T19:39:16-05:00
script to run reproducer in regression test

- - - - -
ace2260c by Phil Carns at 2017-01-22T19:44:43-05:00
fix segfault in common val counters

- - - - -
1561ab23 by Shane Snyder at 2017-01-23T16:02:49-06:00
Merge branch 'issue-218-val-counter' into 'master'

Issue 218 val counter

Closes #218

See merge request !6
- - - - -


4 changed files:

- ChangeLog
- darshan-runtime/lib/darshan-common.c
- + darshan-test/regression/test-cases/access-size-counter-test.sh
- + darshan-test/regression/test-cases/src/access-size-counter-test.c


Changes:

=====================================
ChangeLog
=====================================
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,9 @@ Darshan-3.1.3-pre1
 * skip instrumentation attempts for anonymous mmap() calls; this avoids a
   potentential deadlock condition when used with hugepages on Cray systems.
   Reported by Glenn Lockwood and Cristian Simarro.
+* fix segmentation fault in statistics collection for applications that issue
+  operations with a large number of distince access sizes or strides on the
+  same file.  Reported by Glenn Lockwood.
 
 Darshan-3.1.2
 =============


=====================================
darshan-runtime/lib/darshan-common.c
=====================================
--- a/darshan-runtime/lib/darshan-common.c
+++ b/darshan-runtime/lib/darshan-common.c
@@ -267,9 +267,13 @@ void darshan_common_val_counter(void **common_val_root, int *common_val_count,
         (*common_val_count)++;
     }
 
-    /* update common access counters as we go */
-    DARSHAN_COMMON_VAL_COUNTER_INC(common_val_p, common_cnt_p,
-        found->val, found->freq, 1);
+    /* update common access counters as we go, as long as we haven't already
+     * hit the limit in the number we are willing to track */
+    if(found)
+    {
+        DARSHAN_COMMON_VAL_COUNTER_INC(common_val_p, common_cnt_p,
+            found->val, found->freq, 1);
+    }
 
     return;
 }


=====================================
darshan-test/regression/test-cases/access-size-counter-test.sh
=====================================
--- /dev/null
+++ b/darshan-test/regression/test-cases/access-size-counter-test.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+PROG=access-size-counter-test
+
+# set log file path; remove previous log if present
+export DARSHAN_LOGFILE=$DARSHAN_TMP/${PROG}.darshan
+rm -f ${DARSHAN_LOGFILE}
+
+# compile
+$DARSHAN_CC $DARSHAN_TESTDIR/test-cases/src/${PROG}.c -o $DARSHAN_TMP/${PROG}
+if [ $? -ne 0 ]; then
+    echo "Error: failed to compile ${PROG}" 1>&2
+    exit 1
+fi
+
+# execute
+$DARSHAN_RUNJOB $DARSHAN_TMP/${PROG} -f $DARSHAN_TMP/${PROG}.tmp.dat
+if [ $? -ne 0 ]; then
+    echo "Error: failed to execute ${PROG}" 1>&2
+    exit 1
+fi
+
+# parse log
+$DARSHAN_PATH/bin/darshan-parser $DARSHAN_LOGFILE > $DARSHAN_TMP/${PROG}.darshan.txt
+if [ $? -ne 0 ]; then
+    echo "Error: failed to parse ${DARSHAN_LOGFILE}" 1>&2
+    exit 1
+fi
+
+# check results (for now just make sure it didn't crash)
+
+exit 0


=====================================
darshan-test/regression/test-cases/src/access-size-counter-test.c
=====================================
--- /dev/null
+++ b/darshan-test/regression/test-cases/src/access-size-counter-test.c
@@ -0,0 +1,118 @@
+/*
+ * (C) 1995-2001 Clemson University and Argonne National Laboratory.
+ *
+ * See COPYING in top-level directory.
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/time.h>
+#include <mpi.h>
+#include <errno.h>
+#include <getopt.h>
+
+/* DEFAULT VALUES FOR OPTIONS */
+static char    opt_file[256] = "test.out";
+
+/* function prototypes */
+static int parse_args(int argc, char **argv);
+static void usage(void);
+
+/* global vars */
+static int mynod = 0;
+static int nprocs = 1;
+
+int main(int argc, char **argv)
+{
+   int namelen;
+   char processor_name[MPI_MAX_PROCESSOR_NAME];
+   char buffer[128] = {0};
+   int fd;
+   int i = 1;
+   int ret;
+
+   /* startup MPI and determine the rank of this process */
+   MPI_Init(&argc,&argv);
+   MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
+   MPI_Comm_rank(MPI_COMM_WORLD, &mynod);
+   MPI_Get_processor_name(processor_name, &namelen); 
+   
+   /* parse the command line arguments */
+   parse_args(argc, argv);
+
+   if(mynod == 0)
+   {
+
+      fd = open(opt_file, O_WRONLY|O_TRUNC|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
+      if(fd<0)
+      {
+         perror("open");
+         return(-1);
+      }
+
+      /* cycle through a range of unique write access sizes */
+      for(i=1; i<128; i++)
+      {
+         ret = write(fd, buffer, i);
+         if(ret < 0)
+         {
+            perror("write");
+            return(-1);
+         }
+         if(ret != i)
+         {
+            fprintf(stderr, "Short write: %d\n", ret);
+            return(-1);
+         }
+      }
+
+      close(fd);
+
+   }
+   MPI_Finalize();
+   return(0);
+}
+
+static int parse_args(int argc, char **argv)
+{
+   int c;
+   
+   while ((c = getopt(argc, argv, "f:")) != EOF) {
+      switch (c) {
+         case 'f': /* filename */
+            strncpy(opt_file, optarg, 255);
+            break;
+         case '?': /* unknown */
+            if (mynod == 0)
+                usage();
+            exit(1);
+         default:
+            break;
+      }
+   }
+   return(0);
+}
+
+static void usage(void)
+{
+    printf("Usage: stdio-test [<OPTIONS>...]\n");
+    printf("\n<OPTIONS> is one of\n");
+    printf(" -f       filename [default: test.out]\n");
+    printf(" -h       print this help\n");
+}
+
+/*
+ * Local variables:
+ *  c-indent-level: 3
+ *  c-basic-offset: 3
+ *  tab-width: 3
+ *
+ * vim: ts=3
+ * End:
+ */ 
+
+



View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/compare/8babcd89206d62f0e004c0769055f5362488d6ef...1561ab231dbda237c064146d05019213dc74c7f8
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/darshan-commits/attachments/20170123/e7fc9993/attachment-0001.html>


More information about the Darshan-commits mailing list