[Darshan-commits] [Git][darshan/darshan][master] 2 commits: Instrument offsets in DXT_MPIIO module

Shane Snyder xgitlab at cels.anl.gov
Sun Apr 26 21:55:57 CDT 2020



Shane Snyder pushed to branch master at darshan / darshan


Commits:
cad82a11 by Rob Latham at 2020-04-26T21:55:52-05:00
Instrument offsets in DXT_MPIIO module

- - - - -
55921949 by Shane Snyder at 2020-04-26T21:55:52-05:00
Merge branch 'dev-dxt-mpiio-offset' into 'master'

DXT: include  mpiio offset

See merge request darshan/darshan!46
- - - - -


8 changed files:

- darshan-dxt-log-format.h
- darshan-runtime/configure
- darshan-runtime/configure.in
- darshan-runtime/darshan-common.h
- darshan-runtime/darshan-dxt.h
- darshan-runtime/lib/darshan-dxt.c
- darshan-runtime/lib/darshan-mpiio.c
- darshan-util/darshan-dxt-logutils.c


Changes:

=====================================
darshan-dxt-log-format.h
=====================================
@@ -8,7 +8,7 @@
 
 /* current DXT log format version */
 #define DXT_POSIX_VER 1
-#define DXT_MPIIO_VER 1
+#define DXT_MPIIO_VER 2
 
 #define HOSTNAME_SIZE 64
 


=====================================
darshan-runtime/configure
=====================================
@@ -4675,10 +4675,10 @@ int
 main ()
 {
 
-    MPI_Comm comm;
-    char* filename;
-    int amode;
-    MPI_Info info;
+    MPI_Comm comm=0;
+    char* filename=0;
+    int amode=0;
+    MPI_Info info=0;
     MPI_File fh;
             MPI_File_open(comm, filename, amode, info, &fh);
   ;


=====================================
darshan-runtime/configure.in
=====================================
@@ -392,10 +392,10 @@ AS_IF([test "x$ENABLE_MPI" = "x1"], [
 # determine if the MPI library includes MPI-IO functions or not
 AC_MSG_CHECKING(for MPI-IO support in MPI)
 AC_TRY_LINK([#include <mpi.h>], [
-    MPI_Comm comm;
-    char* filename;
-    int amode;
-    MPI_Info info;
+    MPI_Comm comm=0;
+    char* filename=0;
+    int amode=0;
+    MPI_Info info=0;
     MPI_File fh;
             MPI_File_open(comm, filename, amode, info, &fh);],
     AC_MSG_RESULT(yes),


=====================================
darshan-runtime/darshan-common.h
=====================================
@@ -82,7 +82,7 @@
  * added to the common access counter, rather than just incrementing it.
  */
 #define DARSHAN_COMMON_VAL_COUNTER_INC(__val_p, __cnt_p, __value, __count, __add_flag) do {\
-    int i; \
+    int i_; \
     int inc_count, total_count; \
     int64_t tmp_val[4] = {0}; \
     int64_t tmp_cnt[4] = {0}; \
@@ -92,21 +92,21 @@
         inc_count = 1; \
     else \
         inc_count = __count; \
-    for(i=0; i<4; i++) { \
-        if(*(__val_p + i) == __value) { \
-            total_count = *(__cnt_p + i) + inc_count; \
+    for(i_=0; i_<4; i_++) { \
+        if(*(__val_p + i_) == __value) { \
+            total_count = *(__cnt_p + i_) + inc_count; \
             break; \
         } \
     } \
-    if(i == 4) total_count = __count; \
+    if(i_ == 4) total_count = __count; \
     /* first, copy over any counters that should be sorted above this one \
      * (counters with higher counts or equal counts and larger values) \
      */ \
-    for(i=0;i < 4; i++) { \
-        if((*(__cnt_p + i) > total_count) || \
-           ((*(__cnt_p + i) == total_count) && (*(__val_p + i) > __value))) { \
-            tmp_val[tmp_ndx] = *(__val_p + i); \
-            tmp_cnt[tmp_ndx] = *(__cnt_p + i); \
+    for(i_=0;i_ < 4; i_++) { \
+        if((*(__cnt_p + i_) > total_count) || \
+           ((*(__cnt_p + i_) == total_count) && (*(__val_p + i_) > __value))) { \
+            tmp_val[tmp_ndx] = *(__val_p + i_); \
+            tmp_cnt[tmp_ndx] = *(__cnt_p + i_); \
             tmp_ndx++; \
         } \
         else break; \
@@ -118,12 +118,12 @@
     tmp_ndx++; \
     /* last, copy over any remaining counters to make sure we have 4 sets total */ \
     while(tmp_ndx != 4) { \
-        if(*(__val_p + i) != __value) { \
-            tmp_val[tmp_ndx] = *(__val_p + i); \
-            tmp_cnt[tmp_ndx] = *(__cnt_p + i); \
+        if(*(__val_p + i_) != __value) { \
+            tmp_val[tmp_ndx] = *(__val_p + i_); \
+            tmp_cnt[tmp_ndx] = *(__cnt_p + i_); \
             tmp_ndx++; \
         } \
-        i++; \
+        i_++; \
     } \
     memcpy(__val_p, tmp_val, 4*sizeof(int64_t)); \
     memcpy(__cnt_p, tmp_cnt, 4*sizeof(int64_t)); \


=====================================
darshan-runtime/darshan-dxt.h
=====================================
@@ -45,10 +45,10 @@ void dxt_posix_read(darshan_record_id rec_id, int64_t offset,
  * with 'length' size. 'start_time' and 'end_time' are starting and ending
  * timestamps for the operation, respectively.
  */
-void dxt_mpiio_write(darshan_record_id rec_id, int64_t length,
-        double start_time, double end_time);
-void dxt_mpiio_read(darshan_record_id rec_id, int64_t length,
-        double start_time, double end_time);
+void dxt_mpiio_write(darshan_record_id rec_id, int64_t offset,
+        int64_t length, double start_time, double end_time);
+void dxt_mpiio_read(darshan_record_id rec_id, int64_t offset,
+        int64_t length, double start_time, double end_time);
 
 void dxt_posix_filter_dynamic_traces(
     struct darshan_posix_file *(*rec_id_to_psx_file)(darshan_record_id));


=====================================
darshan-runtime/lib/darshan-dxt.c
=====================================
@@ -517,8 +517,8 @@ void dxt_posix_read(darshan_record_id rec_id, int64_t offset,
     DXT_UNLOCK();
 }
 
-void dxt_mpiio_write(darshan_record_id rec_id, int64_t length,
-        double start_time, double end_time)
+void dxt_mpiio_write(darshan_record_id rec_id, int64_t offset,
+        int64_t length, double start_time, double end_time)
 {
     struct dxt_file_record_ref* rec_ref = NULL;
     struct dxt_file_record *file_rec;
@@ -566,6 +566,7 @@ void dxt_mpiio_write(darshan_record_id rec_id, int64_t length,
     }
 
     rec_ref->write_traces[file_rec->write_count].length = length;
+    rec_ref->write_traces[file_rec->write_count].offset = offset;
     rec_ref->write_traces[file_rec->write_count].start_time = start_time;
     rec_ref->write_traces[file_rec->write_count].end_time = end_time;
     file_rec->write_count += 1;
@@ -573,8 +574,8 @@ void dxt_mpiio_write(darshan_record_id rec_id, int64_t length,
     DXT_UNLOCK();
 }
 
-void dxt_mpiio_read(darshan_record_id rec_id, int64_t length,
-        double start_time, double end_time)
+void dxt_mpiio_read(darshan_record_id rec_id, int64_t offset,
+        int64_t length, double start_time, double end_time)
 {
     struct dxt_file_record_ref* rec_ref = NULL;
     struct dxt_file_record *file_rec;
@@ -622,6 +623,7 @@ void dxt_mpiio_read(darshan_record_id rec_id, int64_t length,
     }
 
     rec_ref->read_traces[file_rec->read_count].length = length;
+    rec_ref->read_traces[file_rec->read_count].offset = offset;
     rec_ref->read_traces[file_rec->read_count].start_time = start_time;
     rec_ref->read_traces[file_rec->read_count].end_time = end_time;
     file_rec->read_count += 1;


=====================================
darshan-runtime/lib/darshan-mpiio.c
=====================================
@@ -236,17 +236,19 @@ static int my_rank = -1;
     if(newpath != __path) free(newpath); \
 } while(0)
 
-#define MPIIO_RECORD_READ(__ret, __fh, __count, __datatype, __counter, __tm1, __tm2) do { \
+#define MPIIO_RECORD_READ(__ret, __fh, __count, __datatype, __offset, __counter, __tm1, __tm2) do { \
     struct mpiio_file_record_ref *rec_ref; \
     int size = 0; \
+    MPI_Offset displacement=0;\
     double __elapsed = __tm2-__tm1; \
     if(__ret != MPI_SUCCESS) break; \
     rec_ref = darshan_lookup_record_ref(mpiio_runtime->fh_hash, &(__fh), sizeof(MPI_File)); \
     if(!rec_ref) break; \
     PMPI_Type_size(__datatype, &size);  \
     size = size * __count; \
+    MPI_File_get_byte_offset(__fh, __offset, &displacement);\
     /* DXT to record detailed read tracing information */ \
-    dxt_mpiio_read(rec_ref->file_rec->base_rec.id, size, __tm1, __tm2); \
+    dxt_mpiio_read(rec_ref->file_rec->base_rec.id, displacement, size, __tm1, __tm2); \
     DARSHAN_BUCKET_INC(&(rec_ref->file_rec->counters[MPIIO_SIZE_READ_AGG_0_100]), size); \
     darshan_common_val_counter(&rec_ref->access_root, &rec_ref->access_count, size, \
         &(rec_ref->file_rec->counters[MPIIO_ACCESS1_ACCESS]), \
@@ -267,9 +269,10 @@ static int my_rank = -1;
         __tm1, __tm2, rec_ref->last_read_end); \
 } while(0)
 
-#define MPIIO_RECORD_WRITE(__ret, __fh, __count, __datatype, __counter, __tm1, __tm2) do { \
+#define MPIIO_RECORD_WRITE(__ret, __fh, __count, __datatype, __offset, __counter, __tm1, __tm2) do { \
     struct mpiio_file_record_ref *rec_ref; \
     int size = 0; \
+    MPI_Offset displacement; \
     double __elapsed = __tm2-__tm1; \
     if(__ret != MPI_SUCCESS) break; \
     rec_ref = darshan_lookup_record_ref(mpiio_runtime->fh_hash, &(__fh), sizeof(MPI_File)); \
@@ -277,7 +280,8 @@ static int my_rank = -1;
     PMPI_Type_size(__datatype, &size);  \
     size = size * __count; \
     /* DXT to record detailed write tracing information */ \
-    dxt_mpiio_write(rec_ref->file_rec->base_rec.id, size, __tm1, __tm2); \
+    MPI_File_get_byte_offset(__fh, __offset, &displacement); \
+    dxt_mpiio_write(rec_ref->file_rec->base_rec.id, displacement, size, __tm1, __tm2); \
     DARSHAN_BUCKET_INC(&(rec_ref->file_rec->counters[MPIIO_SIZE_WRITE_AGG_0_100]), size); \
     darshan_common_val_counter(&rec_ref->access_root, &rec_ref->access_count, size, \
         &(rec_ref->file_rec->counters[MPIIO_ACCESS1_ACCESS]), \
@@ -347,15 +351,17 @@ int DARSHAN_DECL(MPI_File_read)(MPI_File fh, void *buf, int count,
 {
     int ret;
     double tm1, tm2;
+    MPI_Offset offset;
 
     MAP_OR_FAIL(PMPI_File_read);
 
+    MPI_File_get_position(fh, &offset);
     tm1 = darshan_core_wtime();
     ret = __real_PMPI_File_read(fh, buf, count, datatype, status);
     tm2 = darshan_core_wtime();
 
     MPIIO_PRE_RECORD();
-    MPIIO_RECORD_READ(ret, fh, count, datatype, MPIIO_INDEP_READS, tm1, tm2);
+    MPIIO_RECORD_READ(ret, fh, count, datatype, offset, MPIIO_INDEP_READS, tm1, tm2);
     MPIIO_POST_RECORD();
 
     return(ret);
@@ -373,15 +379,17 @@ int DARSHAN_DECL(MPI_File_write)(MPI_File fh, void *buf, int count,
 {
     int ret;
     double tm1, tm2;
+    MPI_Offset offset;
 
     MAP_OR_FAIL(PMPI_File_write);
 
+    MPI_File_get_position(fh, &offset);
     tm1 = darshan_core_wtime();
     ret = __real_PMPI_File_write(fh, buf, count, datatype, status);
     tm2 = darshan_core_wtime();
 
     MPIIO_PRE_RECORD();
-    MPIIO_RECORD_WRITE(ret, fh, count, datatype, MPIIO_INDEP_WRITES, tm1, tm2);
+    MPIIO_RECORD_WRITE(ret, fh, count, datatype, offset, MPIIO_INDEP_WRITES, tm1, tm2);
     MPIIO_POST_RECORD();
 
     return(ret);
@@ -408,7 +416,7 @@ int DARSHAN_DECL(MPI_File_read_at)(MPI_File fh, MPI_Offset offset, void *buf,
     tm2 = darshan_core_wtime();
 
     MPIIO_PRE_RECORD();
-    MPIIO_RECORD_READ(ret, fh, count, datatype, MPIIO_INDEP_READS, tm1, tm2);
+    MPIIO_RECORD_READ(ret, fh, count, datatype, offset, MPIIO_INDEP_READS, tm1, tm2);
     MPIIO_POST_RECORD();
 
     return(ret);
@@ -435,7 +443,7 @@ int DARSHAN_DECL(MPI_File_write_at)(MPI_File fh, MPI_Offset offset, void *buf,
     tm2 = darshan_core_wtime();
 
     MPIIO_PRE_RECORD();
-    MPIIO_RECORD_WRITE(ret, fh, count, datatype, MPIIO_INDEP_WRITES, tm1, tm2);
+    MPIIO_RECORD_WRITE(ret, fh, count, datatype, offset, MPIIO_INDEP_WRITES, tm1, tm2);
     MPIIO_POST_RECORD();
 
     return(ret);
@@ -452,16 +460,18 @@ int DARSHAN_DECL(MPI_File_read_all)(MPI_File fh, void * buf, int count, MPI_Data
 {
     int ret;
     double tm1, tm2;
+    MPI_Offset offset;
 
     MAP_OR_FAIL(PMPI_File_read_all);
 
+    MPI_File_get_position(fh, &offset);
     tm1 = darshan_core_wtime();
     ret = __real_PMPI_File_read_all(fh, buf, count,
         datatype, status);
     tm2 = darshan_core_wtime();
 
     MPIIO_PRE_RECORD();
-    MPIIO_RECORD_READ(ret, fh, count, datatype, MPIIO_COLL_READS, tm1, tm2);
+    MPIIO_RECORD_READ(ret, fh, count, datatype, offset, MPIIO_COLL_READS, tm1, tm2);
     MPIIO_POST_RECORD();
 
     return(ret);
@@ -477,16 +487,18 @@ int DARSHAN_DECL(MPI_File_write_all)(MPI_File fh, void * buf, int count, MPI_Dat
 {
     int ret;
     double tm1, tm2;
+    MPI_Offset offset;
 
     MAP_OR_FAIL(PMPI_File_write_all);
 
+    MPI_File_get_position(fh, &offset);
     tm1 = darshan_core_wtime();
     ret = __real_PMPI_File_write_all(fh, buf, count,
         datatype, status);
     tm2 = darshan_core_wtime();
 
     MPIIO_PRE_RECORD();
-    MPIIO_RECORD_WRITE(ret, fh, count, datatype, MPIIO_COLL_WRITES, tm1, tm2);
+    MPIIO_RECORD_WRITE(ret, fh, count, datatype, offset, MPIIO_COLL_WRITES, tm1, tm2);
     MPIIO_POST_RECORD();
 
     return(ret);
@@ -513,7 +525,7 @@ int DARSHAN_DECL(MPI_File_read_at_all)(MPI_File fh, MPI_Offset offset, void * bu
     tm2 = darshan_core_wtime();
 
     MPIIO_PRE_RECORD();
-    MPIIO_RECORD_READ(ret, fh, count, datatype, MPIIO_COLL_READS, tm1, tm2);
+    MPIIO_RECORD_READ(ret, fh, count, datatype, offset, MPIIO_COLL_READS, tm1, tm2);
     MPIIO_POST_RECORD();
 
     return(ret);
@@ -541,7 +553,7 @@ int DARSHAN_DECL(MPI_File_write_at_all)(MPI_File fh, MPI_Offset offset, void * b
     tm2 = darshan_core_wtime();
 
     MPIIO_PRE_RECORD();
-    MPIIO_RECORD_WRITE(ret, fh, count, datatype, MPIIO_COLL_WRITES, tm1, tm2);
+    MPIIO_RECORD_WRITE(ret, fh, count, datatype, offset, MPIIO_COLL_WRITES, tm1, tm2);
     MPIIO_POST_RECORD();
 
     return(ret);
@@ -560,16 +572,18 @@ int DARSHAN_DECL(MPI_File_read_shared)(MPI_File fh, void * buf, int count, MPI_D
 {
     int ret;
     double tm1, tm2;
+    MPI_Offset offset;
 
     MAP_OR_FAIL(PMPI_File_read_shared);
 
+    MPI_File_get_position_shared(fh, &offset);
     tm1 = darshan_core_wtime();
     ret = __real_PMPI_File_read_shared(fh, buf, count,
         datatype, status);
     tm2 = darshan_core_wtime();
 
     MPIIO_PRE_RECORD();
-    MPIIO_RECORD_READ(ret, fh, count, datatype, MPIIO_INDEP_READS, tm1, tm2);
+    MPIIO_RECORD_READ(ret, fh, count, datatype, offset, MPIIO_INDEP_READS, tm1, tm2);
     MPIIO_POST_RECORD();
 
     return(ret);
@@ -585,16 +599,18 @@ int DARSHAN_DECL(MPI_File_write_shared)(MPI_File fh, void * buf, int count, MPI_
 {
     int ret;
     double tm1, tm2;
+    MPI_Offset offset;
 
     MAP_OR_FAIL(PMPI_File_write_shared);
 
+    MPI_File_get_position_shared(fh, &offset);
     tm1 = darshan_core_wtime();
     ret = __real_PMPI_File_write_shared(fh, buf, count,
         datatype, status);
     tm2 = darshan_core_wtime();
 
     MPIIO_PRE_RECORD();
-    MPIIO_RECORD_WRITE(ret, fh, count, datatype, MPIIO_INDEP_WRITES, tm1, tm2);
+    MPIIO_RECORD_WRITE(ret, fh, count, datatype, offset, MPIIO_INDEP_WRITES, tm1, tm2);
     MPIIO_POST_RECORD();
 
     return(ret);
@@ -613,16 +629,18 @@ int DARSHAN_DECL(MPI_File_read_ordered)(MPI_File fh, void * buf, int count,
 {
     int ret;
     double tm1, tm2;
+    MPI_Offset offset;
 
     MAP_OR_FAIL(PMPI_File_read_ordered);
 
+    MPI_File_get_position_shared(fh, &offset);
     tm1 = darshan_core_wtime();
     ret = __real_PMPI_File_read_ordered(fh, buf, count,
         datatype, status);
     tm2 = darshan_core_wtime();
 
     MPIIO_PRE_RECORD();
-    MPIIO_RECORD_READ(ret, fh, count, datatype, MPIIO_COLL_READS, tm1, tm2);
+    MPIIO_RECORD_READ(ret, fh, count, datatype, offset, MPIIO_COLL_READS, tm1, tm2);
     MPIIO_POST_RECORD();
 
     return(ret);
@@ -641,8 +659,10 @@ int DARSHAN_DECL(MPI_File_write_ordered)(MPI_File fh, void * buf, int count,
 {
     int ret;
     double tm1, tm2;
+    MPI_Offset offset;
 
     MAP_OR_FAIL(PMPI_File_write_ordered);
+    MPI_File_get_position_shared(fh, &offset);
 
     tm1 = darshan_core_wtime();
     ret = __real_PMPI_File_write_ordered(fh, buf, count,
@@ -650,7 +670,7 @@ int DARSHAN_DECL(MPI_File_write_ordered)(MPI_File fh, void * buf, int count,
     tm2 = darshan_core_wtime();
 
     MPIIO_PRE_RECORD();
-    MPIIO_RECORD_WRITE(ret, fh, count, datatype, MPIIO_COLL_WRITES, tm1, tm2);
+    MPIIO_RECORD_WRITE(ret, fh, count, datatype, offset, MPIIO_COLL_WRITES, tm1, tm2);
     MPIIO_POST_RECORD();
 
     return(ret);
@@ -669,15 +689,17 @@ int DARSHAN_DECL(MPI_File_read_all_begin)(MPI_File fh, void * buf, int count, MP
 {
     int ret;
     double tm1, tm2;
+    MPI_Offset offset;
 
     MAP_OR_FAIL(PMPI_File_read_all_begin);
 
+    MPI_File_get_position_shared(fh, &offset);
     tm1 = darshan_core_wtime();
     ret = __real_PMPI_File_read_all_begin(fh, buf, count, datatype);
     tm2 = darshan_core_wtime();
 
     MPIIO_PRE_RECORD();
-    MPIIO_RECORD_READ(ret, fh, count, datatype, MPIIO_SPLIT_READS, tm1, tm2);
+    MPIIO_RECORD_READ(ret, fh, count, datatype, offset, MPIIO_SPLIT_READS, tm1, tm2);
     MPIIO_POST_RECORD();
 
     return(ret);
@@ -693,15 +715,18 @@ int DARSHAN_DECL(MPI_File_write_all_begin)(MPI_File fh, void * buf, int count, M
 {
     int ret;
     double tm1, tm2;
+    MPI_Offset offset;
 
     MAP_OR_FAIL(PMPI_File_write_all_begin);
 
+    MPI_File_get_position_shared(fh, &offset);
+
     tm1 = darshan_core_wtime();
     ret = __real_PMPI_File_write_all_begin(fh, buf, count, datatype);
     tm2 = darshan_core_wtime();
 
     MPIIO_PRE_RECORD();
-    MPIIO_RECORD_WRITE(ret, fh, count, datatype, MPIIO_SPLIT_WRITES, tm1, tm2);
+    MPIIO_RECORD_WRITE(ret, fh, count, datatype, offset, MPIIO_SPLIT_WRITES, tm1, tm2);
     MPIIO_POST_RECORD();
 
     return(ret);
@@ -728,7 +753,7 @@ int DARSHAN_DECL(MPI_File_read_at_all_begin)(MPI_File fh, MPI_Offset offset, voi
     tm2 = darshan_core_wtime();
     
     MPIIO_PRE_RECORD();
-    MPIIO_RECORD_READ(ret, fh, count, datatype, MPIIO_SPLIT_READS, tm1, tm2);
+    MPIIO_RECORD_READ(ret, fh, count, datatype, offset, MPIIO_SPLIT_READS, tm1, tm2);
     MPIIO_POST_RECORD();
 
     return(ret);
@@ -755,7 +780,7 @@ int DARSHAN_DECL(MPI_File_write_at_all_begin)(MPI_File fh, MPI_Offset offset, vo
     tm2 = darshan_core_wtime();
 
     MPIIO_PRE_RECORD();
-    MPIIO_RECORD_WRITE(ret, fh, count, datatype, MPIIO_SPLIT_WRITES, tm1, tm2);
+    MPIIO_RECORD_WRITE(ret, fh, count, datatype, offset, MPIIO_SPLIT_WRITES, tm1, tm2);
     MPIIO_POST_RECORD();
 
     return(ret);
@@ -772,16 +797,18 @@ int DARSHAN_DECL(MPI_File_read_ordered_begin)(MPI_File fh, void * buf, int count
 {
     int ret;
     double tm1, tm2;
+    MPI_Offset offset;
 
     MAP_OR_FAIL(PMPI_File_read_ordered_begin);
 
+    MPI_File_get_position_shared(fh, &offset);
     tm1 = darshan_core_wtime();
     ret = __real_PMPI_File_read_ordered_begin(fh, buf, count,
         datatype);
     tm2 = darshan_core_wtime();
 
     MPIIO_PRE_RECORD();
-    MPIIO_RECORD_READ(ret, fh, count, datatype, MPIIO_SPLIT_READS, tm1, tm2);
+    MPIIO_RECORD_READ(ret, fh, count, datatype, offset, MPIIO_SPLIT_READS, tm1, tm2);
     MPIIO_POST_RECORD();
 
     return(ret);
@@ -797,16 +824,18 @@ int DARSHAN_DECL(MPI_File_write_ordered_begin)(MPI_File fh, void * buf, int coun
 {
     int ret;
     double tm1, tm2;
+    MPI_Offset offset;
 
     MAP_OR_FAIL(PMPI_File_write_ordered_begin);
 
+    MPI_File_get_position_shared(fh, &offset);
     tm1 = darshan_core_wtime();
     ret = __real_PMPI_File_write_ordered_begin(fh, buf, count,
         datatype);
     tm2 = darshan_core_wtime();
 
     MPIIO_PRE_RECORD();
-    MPIIO_RECORD_WRITE(ret, fh, count, datatype, MPIIO_SPLIT_WRITES, tm1, tm2);
+    MPIIO_RECORD_WRITE(ret, fh, count, datatype, offset, MPIIO_SPLIT_WRITES, tm1, tm2);
     MPIIO_POST_RECORD();
 
     return(ret);
@@ -823,15 +852,17 @@ int DARSHAN_DECL(MPI_File_iread)(MPI_File fh, void * buf, int count, MPI_Datatyp
 {
     int ret;
     double tm1, tm2;
+    MPI_Offset offset;
 
     MAP_OR_FAIL(PMPI_File_iread);
 
+    MPI_File_get_position_shared(fh, &offset);
     tm1 = darshan_core_wtime();
     ret = __real_PMPI_File_iread(fh, buf, count, datatype, request);
     tm2 = darshan_core_wtime();
 
     MPIIO_PRE_RECORD();
-    MPIIO_RECORD_READ(ret, fh, count, datatype, MPIIO_NB_READS, tm1, tm2);
+    MPIIO_RECORD_READ(ret, fh, count, datatype, offset, MPIIO_NB_READS, tm1, tm2);
     MPIIO_POST_RECORD();
 
     return(ret);
@@ -849,15 +880,17 @@ int DARSHAN_DECL(MPI_File_iwrite)(MPI_File fh, void * buf, int count,
 {
     int ret;
     double tm1, tm2;
+    MPI_Offset offset;
 
     MAP_OR_FAIL(PMPI_File_iwrite);
 
+    MPI_File_get_position(fh, &offset);
     tm1 = darshan_core_wtime();
     ret = __real_PMPI_File_iwrite(fh, buf, count, datatype, request);
     tm2 = darshan_core_wtime();
 
     MPIIO_PRE_RECORD();
-    MPIIO_RECORD_WRITE(ret, fh, count, datatype, MPIIO_NB_WRITES, tm1, tm2);
+    MPIIO_RECORD_WRITE(ret, fh, count, datatype, offset, MPIIO_NB_WRITES, tm1, tm2);
     MPIIO_POST_RECORD();
 
     return(ret);
@@ -886,7 +919,7 @@ int DARSHAN_DECL(MPI_File_iread_at)(MPI_File fh, MPI_Offset offset, void * buf,
     tm2 = darshan_core_wtime();
 
     MPIIO_PRE_RECORD();
-    MPIIO_RECORD_READ(ret, fh, count, datatype, MPIIO_NB_READS, tm1, tm2);
+    MPIIO_RECORD_READ(ret, fh, count, datatype, offset, MPIIO_NB_READS, tm1, tm2);
     MPIIO_POST_RECORD();
 
     return(ret);
@@ -914,7 +947,7 @@ int DARSHAN_DECL(MPI_File_iwrite_at)(MPI_File fh, MPI_Offset offset, void * buf,
     tm2 = darshan_core_wtime();
 
     MPIIO_PRE_RECORD();
-    MPIIO_RECORD_WRITE(ret, fh, count, datatype, MPIIO_NB_WRITES, tm1, tm2);
+    MPIIO_RECORD_WRITE(ret, fh, count, datatype, offset, MPIIO_NB_WRITES, tm1, tm2);
     MPIIO_POST_RECORD();
 
     return(ret);
@@ -934,16 +967,18 @@ int DARSHAN_DECL(MPI_File_iread_shared)(MPI_File fh, void * buf, int count,
 {
     int ret;
     double tm1, tm2;
+    MPI_Offset offset;
 
     MAP_OR_FAIL(PMPI_File_iread_shared);
 
+    MPI_File_get_position_shared(fh, &offset);
     tm1 = darshan_core_wtime();
     ret = __real_PMPI_File_iread_shared(fh, buf, count,
         datatype, request);
     tm2 = darshan_core_wtime();
 
     MPIIO_PRE_RECORD();
-    MPIIO_RECORD_READ(ret, fh, count, datatype, MPIIO_NB_READS, tm1, tm2);
+    MPIIO_RECORD_READ(ret, fh, count, datatype, offset, MPIIO_NB_READS, tm1, tm2);
     MPIIO_POST_RECORD();
 
     return(ret);
@@ -962,16 +997,18 @@ int DARSHAN_DECL(MPI_File_iwrite_shared)(MPI_File fh, void * buf, int count,
 {
     int ret;
     double tm1, tm2;
+    MPI_Offset offset;
 
     MAP_OR_FAIL(PMPI_File_iwrite_shared);
 
+    MPI_File_get_position_shared(fh, &offset);
     tm1 = darshan_core_wtime();
     ret = __real_PMPI_File_iwrite_shared(fh, buf, count,
         datatype, request);
     tm2 = darshan_core_wtime();
 
     MPIIO_PRE_RECORD();
-    MPIIO_RECORD_WRITE(ret, fh, count, datatype, MPIIO_NB_WRITES, tm1, tm2);
+    MPIIO_RECORD_WRITE(ret, fh, count, datatype, offset, MPIIO_NB_WRITES, tm1, tm2);
     MPIIO_POST_RECORD();
 
     return(ret);
@@ -1477,6 +1514,7 @@ void darshan_mpiio_shutdown_bench_setup(int test_case)
 {
     char filepath[256];
     MPI_File *fh_array;
+    MPI_Offset *offset_array;
     int64_t *size_array;
     int i;
     intptr_t j;
@@ -1489,12 +1527,15 @@ void darshan_mpiio_shutdown_bench_setup(int test_case)
     srand(my_rank);
     fh_array = malloc(1024 * sizeof(MPI_File));
     size_array = malloc(DARSHAN_COMMON_VAL_MAX_RUNTIME_COUNT * sizeof(int64_t));
+    offset_array = malloc(DARSHAN_COMMON_VAL_MAX_RUNTIME_COUNT *sizeof(MPI_Offset));
     assert(fh_array && size_array);
 
     for(j = 0; j < 1024; j++)
         fh_array[j] = (MPI_File)j;
-    for(i = 0; i < DARSHAN_COMMON_VAL_MAX_RUNTIME_COUNT; i++)
+    for(i = 0; i < DARSHAN_COMMON_VAL_MAX_RUNTIME_COUNT; i++) {
+        offset_array[i] = rand();
         size_array[i] = rand();
+    }
 
     switch(test_case)
     {
@@ -1503,8 +1544,8 @@ void darshan_mpiio_shutdown_bench_setup(int test_case)
 
             MPIIO_RECORD_OPEN(MPI_SUCCESS, filepath, fh_array[0], MPI_COMM_SELF,
                 2, MPI_INFO_NULL, 0, 1);
-            MPIIO_RECORD_WRITE(MPI_SUCCESS, fh_array[0], size_array[0], MPI_BYTE,
-                MPIIO_INDEP_WRITES, 1, 2);
+            MPIIO_RECORD_WRITE(MPI_SUCCESS, fh_array[0], size_array[0], offset_array[0],
+                MPI_BYTE, MPIIO_INDEP_WRITES, 1, 2);
 
             break;
         case 2: /* single shared file */
@@ -1512,8 +1553,8 @@ void darshan_mpiio_shutdown_bench_setup(int test_case)
 
             MPIIO_RECORD_OPEN(MPI_SUCCESS, filepath, fh_array[0], MPI_COMM_WORLD,
                 2, MPI_INFO_NULL, 0, 1);
-            MPIIO_RECORD_WRITE(MPI_SUCCESS, fh_array[0], size_array[0], MPI_BYTE,
-                MPIIO_COLL_WRITES, 1, 2);
+            MPIIO_RECORD_WRITE(MPI_SUCCESS, fh_array[0], size_array[0], offset_array[0],
+                MPI_BYTE, MPIIO_COLL_WRITES, 1, 2);
 
             break;
         case 3: /* 1024 unique files per proc */
@@ -1525,6 +1566,7 @@ void darshan_mpiio_shutdown_bench_setup(int test_case)
                     2, MPI_INFO_NULL, 0, 1);
                 MPIIO_RECORD_WRITE(MPI_SUCCESS, fh_array[i],
                     size_array[i % DARSHAN_COMMON_VAL_MAX_RUNTIME_COUNT],
+                    offset_array[i % DARSHAN_COMMON_VAL_MAX_RUNTIME_COUNT],
                     MPI_BYTE, MPIIO_INDEP_WRITES, 1, 2);
             }
 
@@ -1538,6 +1580,7 @@ void darshan_mpiio_shutdown_bench_setup(int test_case)
                     2, MPI_INFO_NULL, 0, 1);
                 MPIIO_RECORD_WRITE(MPI_SUCCESS, fh_array[i],
                     size_array[i % DARSHAN_COMMON_VAL_MAX_RUNTIME_COUNT],
+                    offset_array[i % DARSHAN_COMMON_VAL_MAX_RUNTIME_COUNT],
                     MPI_BYTE, MPIIO_COLL_WRITES, 1, 2);
             }
             break;


=====================================
darshan-util/darshan-dxt-logutils.c
=====================================
@@ -150,6 +150,7 @@ static int dxt_log_get_mpiio_file(darshan_fd fd, void** dxt_mpiio_buf_p)
 {
     struct dxt_file_record *rec = *((struct dxt_file_record **)dxt_mpiio_buf_p);
     struct dxt_file_record tmp_rec;
+    int i;
     int ret;
     int64_t io_trace_size;
 
@@ -196,6 +197,15 @@ static int dxt_log_get_mpiio_file(darshan_fd fd, void** dxt_mpiio_buf_p)
                 /* byte swap trace data if necessary */
                 dxt_swap_segments(rec);
             }
+
+            if(fd->mod_ver[DXT_MPIIO_MOD] == 1)
+            {
+                /* make sure to indicate offsets are invalid in version 1 */
+                for(i = 0; i < (tmp_rec.write_count + tmp_rec.read_count); i++)
+                {
+                    ((segment_info *)tmp_p)[i].offset = -1;
+                }
+            }
         }
     }
     else
@@ -383,6 +393,7 @@ void dxt_log_print_mpiio_file(void *mpiio_file_rec, char *file_name,
                 (struct dxt_file_record *)mpiio_file_rec;
 
     int64_t length;
+    int64_t offset;
     double start_time;
     double end_time;
     int i;
@@ -405,23 +416,25 @@ void dxt_log_print_mpiio_file(void *mpiio_file_rec, char *file_name,
     printf("# DXT, mnt_pt: %s, fs_type: %s\n", mnt_pt, fs_type);
 
     /* Print header */
-    printf("# Module    Rank  Wt/Rd  Segment       Length    Start(s)      End(s)\n");
+    printf("# Module    Rank  Wt/Rd  Segment          Offset       Length    Start(s)      End(s)\n");
 
     /* Print IO Traces information */
     for (i = 0; i < write_count; i++) {
+        offset = io_trace[i].offset;
         length = io_trace[i].length;
         start_time = io_trace[i].start_time;
         end_time = io_trace[i].end_time;
 
-        printf("%8s%8" PRId64 "%7s%9d%16" PRId64 "%12.4f%12.4f\n", "X_MPIIO", rank, "write", i, length, start_time, end_time);
+        printf("%8s%8" PRId64 "%7s%9d%16" PRId64 "%16" PRId64 "%12.4f%12.4f\n", "X_MPIIO", rank, "write", i, offset, length, start_time, end_time);
     }
 
     for (i = write_count; i < write_count + read_count; i++) {
+        offset = io_trace[i].offset;
         length = io_trace[i].length;
         start_time = io_trace[i].start_time;
         end_time = io_trace[i].end_time;
 
-        printf("%8s%8" PRId64 "%7s%9d%16" PRId64 "%12.4f%12.4f\n", "X_MPIIO", rank, "read", (int)(i - write_count), length, start_time, end_time);
+        printf("%8s%8" PRId64 "%7s%9d%16" PRId64 "%16" PRId64 "%12.4f%12.4f\n", "X_MPIIO", rank, "read", (int)(i - write_count), offset, length, start_time, end_time);
     }
 
     return;



View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/compare/73972e987fc8fc6f5046a88d27250587b290268f...559219497a455fec5d58446c6e093905c118acb0

-- 
View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/compare/73972e987fc8fc6f5046a88d27250587b290268f...559219497a455fec5d58446c6e093905c118acb0
You're receiving this email because of your account on xgitlab.cels.anl.gov.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/darshan-commits/attachments/20200426/737a83ff/attachment-0001.html>


More information about the Darshan-commits mailing list