Skip to content

Commit

Permalink
fixing printf, mod checks and close counts
Browse files Browse the repository at this point in the history
  • Loading branch information
Snell1224 committed Oct 26, 2023
1 parent 39e73a7 commit de9c3a4
Show file tree
Hide file tree
Showing 8 changed files with 220 additions and 169 deletions.
8 changes: 7 additions & 1 deletion darshan-runtime/lib/darshan-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ void darshan_core_initialize(int argc, char **argv)
/* setup darshan runtime if darshan is enabled and hasn't been initialized already */
if (__darshan_core != NULL || getenv("DARSHAN_DISABLE"))
return;

init_start = darshan_core_wtime_absolute();

/* allocate structure to track darshan core runtime information */
Expand Down Expand Up @@ -776,6 +775,13 @@ void darshan_core_shutdown(int write_log)
free(shared_recs);
free(mod_shared_recs);
}
#endif
#ifdef HAVE_LDMS
/* free any allocated array memory*/
extern struct darshanConnector dC;
if(dC.ldms_lib){
free(dC.record_id);
free(dC.record_count);}
#endif
free(logfile_name);

Expand Down
83 changes: 44 additions & 39 deletions darshan-runtime/lib/darshan-hdf5.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,9 @@ static int my_rank = -1;
darshan_add_record_ref(&(hdf5_file_runtime->hid_hash), &__ret, sizeof(hid_t), __rec_ref); \
if(__newpath != __path) free(__newpath); \
/* LDMS to publish realtime read tracing information to daemon*/ \
extern struct darshanConnector dC; \
if(!dC.ldms_lib)\
if(!dC.hdf5_enable_ldms)\
darshan_ldms_connector_send(__rec_ref->file_rec->base_rec.id, __rec_ref->file_rec->base_rec.rank,__rec_ref->file_rec->counters[H5F_OPENS], "open", -1, -1, -1, -1, __rec_ref->file_rec->counters[H5F_FLUSHES], __tm1, __tm2, __rec_ref->file_rec->fcounters[H5F_F_META_TIME], "H5F", "MET");\
if(dC.ldms_lib)\
if(dC.hdf5_enable_ldms)\
darshan_ldms_connector_send(__rec_ref->file_rec->base_rec.id, __rec_ref->file_rec->base_rec.rank,__rec_ref->file_rec->counters[H5F_OPENS], "open", -1, -1, -1, -1, __rec_ref->file_rec->counters[H5F_FLUSHES], __tm1, __tm2, __rec_ref->file_rec->fcounters[H5F_F_META_TIME], "H5F", "MET");\
} while(0)

hid_t DARSHAN_DECL(H5Fcreate)(const char *filename, unsigned flags,
Expand Down Expand Up @@ -417,10 +416,11 @@ herr_t DARSHAN_DECL(H5Fclose)(hid_t file_id)
&file_id, sizeof(hid_t));

#ifdef HAVE_LDMS
/* LDMS to publish runtime h5d tracing information to daemon*/
extern struct darshanConnector dC;
if(!dC.hdf5_enable_ldms)
darshan_ldms_connector_send(rec_ref->file_rec->base_rec.id, rec_ref->file_rec->base_rec.rank, -1, "close", -1, -1, -1, -1, rec_ref->file_rec->counters[H5F_FLUSHES],rec_ref->file_rec->fcounters[H5F_F_CLOSE_START_TIMESTAMP], rec_ref->file_rec->fcounters[H5F_F_CLOSE_END_TIMESTAMP], rec_ref->file_rec->fcounters[H5F_F_META_TIME], "H5F", "MOD");
/* LDMS to publish runtime h5d tracing information to daemon*/
extern struct darshanConnector dC;
if(dC.ldms_lib)
if(dC.hdf5_enable_ldms)
darshan_ldms_connector_send(rec_ref->file_rec->base_rec.id, rec_ref->file_rec->base_rec.rank, -1, "close", -1, -1, -1, -1, rec_ref->file_rec->counters[H5F_FLUSHES],rec_ref->file_rec->fcounters[H5F_F_CLOSE_START_TIMESTAMP], rec_ref->file_rec->fcounters[H5F_F_CLOSE_END_TIMESTAMP], rec_ref->file_rec->fcounters[H5F_F_META_TIME], "H5F", "MOD");
#endif
}
H5F_POST_RECORD();
Expand Down Expand Up @@ -506,17 +506,16 @@ herr_t DARSHAN_DECL(H5Fclose)(hid_t file_id)
if(__dcpl_id != H5P_DEFAULT && H5Pget_layout(__dcpl_id) == H5D_CHUNKED) { \
__n_chunk_dims = H5Pget_chunk(__dcpl_id, H5D_MAX_NDIMS, __chunk_dims); \
__n_chunk_dims = (__n_chunk_dims < H5D_MAX_NDIMS) ? __n_chunk_dims : H5D_MAX_NDIMS; \
for(__i = 0; __i < __n_chunk_dims; __i++) \
__rec_ref->dataset_rec->counters[H5D_CHUNK_SIZE_D1 + __i] = __chunk_dims[__n_chunk_dims - __i - 1]; \
} \
for(__i = 0; __i < __n_chunk_dims; __i++){ \
__rec_ref->dataset_rec->counters[H5D_CHUNK_SIZE_D1 + __i] = __chunk_dims[__n_chunk_dims - __i - 1];} \
}\
__rec_ref->dataset_rec->counters[H5D_DATATYPE_SIZE] = H5Tget_size(__type_id); \
__rec_ref->dataset_rec->file_rec_id = __file_rec_id; \
darshan_add_record_ref(&(hdf5_dataset_runtime->hid_hash), &__ret, sizeof(hid_t), __rec_ref); \
/* LDMS to publish runtime h5d tracing information to daemon*/ \
extern struct darshanConnector dC;\
if(!dC.ldms_lib)\
if(!dC.hdf5_enable_ldms)\
darshan_ldms_connector_send(__rec_ref->dataset_rec->base_rec.id, __rec_ref->dataset_rec->base_rec.rank,__rec_ref->dataset_rec->counters[H5D_OPENS], "open", -1, -1, -1, -1, __rec_ref->dataset_rec->counters[H5D_FLUSHES], __tm1, __tm2, __rec_ref->dataset_rec->fcounters[H5D_F_META_TIME], "H5D", "MET");\
if(dC.ldms_lib)\
if(dC.hdf5_enable_ldms)\
darshan_ldms_connector_send(__rec_ref->dataset_rec->base_rec.id, __rec_ref->dataset_rec->base_rec.rank,__rec_ref->dataset_rec->counters[H5D_OPENS], "open", -1, -1, -1, -1, __rec_ref->dataset_rec->counters[H5D_FLUSHES], __tm1, __tm2, __rec_ref->dataset_rec->fcounters[H5D_F_META_TIME], "H5D", "MET");\
} while(0)

hid_t DARSHAN_DECL(H5Dcreate1)(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t dcpl_id)
Expand Down Expand Up @@ -765,17 +764,19 @@ herr_t DARSHAN_DECL(H5Dread)(hid_t dataset_id, hid_t mem_type_id, hid_t mem_spac
tm1, tm2, rec_ref->last_read_end);

#ifdef HAVE_LDMS
extern struct darshanConnector dC;
/* LDMS to publish runtime h5d tracing information to daemon*/
if(!dC.hdf5_enable_ldms){
dC.hdf5_data[0] = rec_ref->dataset_rec->counters[H5D_POINT_SELECTS];
dC.hdf5_data[1] = rec_ref->dataset_rec->counters[H5D_IRREGULAR_HYPERSLAB_SELECTS];
dC.hdf5_data[2] = rec_ref->dataset_rec->counters[H5D_REGULAR_HYPERSLAB_SELECTS];
dC.hdf5_data[3] = rec_ref->dataset_rec->counters[H5D_DATASPACE_NDIMS];
dC.hdf5_data[4] = rec_ref->dataset_rec->counters[H5D_DATASPACE_NPOINTS];

darshan_ldms_connector_send(rec_ref->dataset_rec->base_rec.id, rec_ref->dataset_rec->base_rec.rank, rec_ref->dataset_rec->counters[H5D_READS], "read", -1, rec_ref->dataset_rec->counters[H5D_MAX_READ_TIME_SIZE], -1, rec_ref->dataset_rec->counters[H5D_RW_SWITCHES], rec_ref->dataset_rec->counters[H5D_FLUSHES], rec_ref->dataset_rec->fcounters[H5D_F_READ_START_TIMESTAMP], rec_ref->dataset_rec->fcounters[H5D_F_READ_END_TIMESTAMP], rec_ref->dataset_rec->fcounters[H5D_F_READ_TIME], "H5D", "MOD");
/* LDMS to publish runtime h5d tracing information to daemon*/
extern struct darshanConnector dC;
if(dC.ldms_lib){
if(dC.hdf5_enable_ldms){
dC.hdf5_data[0] = rec_ref->dataset_rec->counters[H5D_POINT_SELECTS];
dC.hdf5_data[1] = rec_ref->dataset_rec->counters[H5D_IRREGULAR_HYPERSLAB_SELECTS];
dC.hdf5_data[2] = rec_ref->dataset_rec->counters[H5D_REGULAR_HYPERSLAB_SELECTS];
dC.hdf5_data[3] = rec_ref->dataset_rec->counters[H5D_DATASPACE_NDIMS];
dC.hdf5_data[4] = rec_ref->dataset_rec->counters[H5D_DATASPACE_NPOINTS];

darshan_ldms_connector_send(rec_ref->dataset_rec->base_rec.id, rec_ref->dataset_rec->base_rec.rank, rec_ref->dataset_rec->counters[H5D_READS], "read", -1, rec_ref->dataset_rec->counters[H5D_MAX_READ_TIME_SIZE], -1, rec_ref->dataset_rec->counters[H5D_RW_SWITCHES], rec_ref->dataset_rec->counters[H5D_FLUSHES], rec_ref->dataset_rec->fcounters[H5D_F_READ_START_TIMESTAMP], rec_ref->dataset_rec->fcounters[H5D_F_READ_END_TIMESTAMP], rec_ref->dataset_rec->fcounters[H5D_F_READ_TIME], "H5D", "MOD");
}
}
#endif
}
H5D_POST_RECORD();
Expand Down Expand Up @@ -895,17 +896,20 @@ herr_t DARSHAN_DECL(H5Dwrite)(hid_t dataset_id, hid_t mem_type_id, hid_t mem_spa
tm1, tm2, rec_ref->last_write_end);

#ifdef HAVE_LDMS
/* LDMS to publish runtime h5d tracing information to daemon*/
extern struct darshanConnector dC;
if(!dC.hdf5_enable_ldms){
dC.hdf5_data[0] = rec_ref->dataset_rec->counters[H5D_POINT_SELECTS];
dC.hdf5_data[1] = rec_ref->dataset_rec->counters[H5D_IRREGULAR_HYPERSLAB_SELECTS];
dC.hdf5_data[2] = rec_ref->dataset_rec->counters[H5D_REGULAR_HYPERSLAB_SELECTS];
dC.hdf5_data[3] = rec_ref->dataset_rec->counters[H5D_DATASPACE_NDIMS];
dC.hdf5_data[4] = rec_ref->dataset_rec->counters[H5D_DATASPACE_NPOINTS];

darshan_ldms_connector_send(rec_ref->dataset_rec->base_rec.id, rec_ref->dataset_rec->base_rec.rank, rec_ref->dataset_rec->counters[H5D_WRITES], "write", -1, rec_ref->dataset_rec->counters[H5D_MAX_WRITE_TIME_SIZE], -1, rec_ref->dataset_rec->counters[H5D_RW_SWITCHES], rec_ref->dataset_rec->counters[H5D_FLUSHES], rec_ref->dataset_rec->fcounters[H5D_F_WRITE_START_TIMESTAMP], rec_ref->dataset_rec->fcounters[H5D_F_WRITE_END_TIMESTAMP], rec_ref->dataset_rec->fcounters[H5D_F_WRITE_TIME], "H5D", "MOD");
/* LDMS to publish runtime h5d tracing information to daemon*/
extern struct darshanConnector dC;
if(dC.ldms_lib){
if(dC.hdf5_enable_ldms){
dC.hdf5_data[0] = rec_ref->dataset_rec->counters[H5D_POINT_SELECTS];
dC.hdf5_data[1] = rec_ref->dataset_rec->counters[H5D_IRREGULAR_HYPERSLAB_SELECTS];
dC.hdf5_data[2] = rec_ref->dataset_rec->counters[H5D_REGULAR_HYPERSLAB_SELECTS];
dC.hdf5_data[3] = rec_ref->dataset_rec->counters[H5D_DATASPACE_NDIMS];
dC.hdf5_data[4] = rec_ref->dataset_rec->counters[H5D_DATASPACE_NPOINTS];

darshan_ldms_connector_send(rec_ref->dataset_rec->base_rec.id, rec_ref->dataset_rec->base_rec.rank, rec_ref->dataset_rec->counters[H5D_WRITES], "write", -1, rec_ref->dataset_rec->counters[H5D_MAX_WRITE_TIME_SIZE], -1, rec_ref->dataset_rec->counters[H5D_RW_SWITCHES], rec_ref->dataset_rec->counters[H5D_FLUSHES], rec_ref->dataset_rec->fcounters[H5D_F_WRITE_START_TIMESTAMP], rec_ref->dataset_rec->fcounters[H5D_F_WRITE_END_TIMESTAMP], rec_ref->dataset_rec->fcounters[H5D_F_WRITE_TIME], "H5D", "MOD");

}
}
#endif
}
H5D_POST_RECORD();
Expand Down Expand Up @@ -974,10 +978,11 @@ herr_t DARSHAN_DECL(H5Dclose)(hid_t dataset_id)
darshan_delete_record_ref(&(hdf5_dataset_runtime->hid_hash), &dataset_id, sizeof(hid_t));

#ifdef HAVE_LDMS
/* LDMS to publish runtime h5d tracing information to daemon*/
extern struct darshanConnector dC;
if(!dC.hdf5_enable_ldms)
darshan_ldms_connector_send(rec_ref->dataset_rec->base_rec.id, rec_ref->dataset_rec->base_rec.rank, -1, "close", -1, -1, -1, -1, rec_ref->dataset_rec->counters[H5D_FLUSHES], rec_ref->dataset_rec->fcounters[H5D_F_CLOSE_START_TIMESTAMP], rec_ref->dataset_rec->fcounters[H5D_F_CLOSE_END_TIMESTAMP], rec_ref->dataset_rec->fcounters[H5D_F_META_TIME], "H5D", "MOD");
/* LDMS to publish runtime h5d tracing information to daemon*/
extern struct darshanConnector dC;
if(dC.ldms_lib)
if(dC.hdf5_enable_ldms)
darshan_ldms_connector_send(rec_ref->dataset_rec->base_rec.id, rec_ref->dataset_rec->base_rec.rank, -1, "close", -1, -1, -1, -1, rec_ref->dataset_rec->counters[H5D_FLUSHES], rec_ref->dataset_rec->fcounters[H5D_F_CLOSE_START_TIMESTAMP], rec_ref->dataset_rec->fcounters[H5D_F_CLOSE_END_TIMESTAMP], rec_ref->dataset_rec->fcounters[H5D_F_META_TIME], "H5D", "MOD");
#endif

}
Expand Down
Loading

0 comments on commit de9c3a4

Please sign in to comment.