Commit cfda2264 authored by Shane Snyder's avatar Shane Snyder
Browse files

Add H5D module counter to indicate corresponding H5F record ID

parent 054de670
......@@ -9,7 +9,7 @@
/* current HDF5 log format versions */
#define DARSHAN_H5F_VER 3
#define DARSHAN_H5D_VER 1
#define DARSHAN_H5D_VER 2
#define H5D_MAX_NDIMS 5
......@@ -245,6 +245,7 @@ struct darshan_hdf5_file
struct darshan_hdf5_dataset
{
struct darshan_base_record base_rec;
uint64_t file_rec_id;
int64_t counters[H5D_NUM_INDICES];
double fcounters[H5D_F_NUM_INDICES];
};
......
......@@ -410,7 +410,7 @@ herr_t DARSHAN_DECL(H5Fclose)(hid_t file_id)
char *__file_path, *__tmp_ptr; \
char __rec_name[DARSHAN_HDF5_MAX_NAME_LEN] = {0}; \
ssize_t __req_name_len = DARSHAN_HDF5_MAX_NAME_LEN-1, __ret_name_len; \
darshan_record_id __rec_id; \
darshan_record_id __rec_id, __file_rec_id = 0; \
struct hdf5_dataset_record_ref *__rec_ref; \
hsize_t __chunk_dims[H5D_MAX_NDIMS] = {0}; \
int __i, __n_chunk_dims = 0; \
......@@ -424,6 +424,7 @@ herr_t DARSHAN_DECL(H5Fclose)(hid_t file_id)
free(__file_path); \
break; \
} \
__file_rec_id = darshan_core_gen_record_id(__file_path); \
strncpy(__rec_name, __file_path, __req_name_len); \
free(__file_path); \
if(strlen(__rec_name) + 2 <= __req_name_len) { \
......@@ -462,6 +463,7 @@ herr_t DARSHAN_DECL(H5Fclose)(hid_t file_id)
__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); \
} while(0)
......@@ -1177,6 +1179,7 @@ static void hdf5_dataset_record_reduction_op(void* inrec_v, void* inoutrec_v,
memset(&tmp_dataset, 0, sizeof(struct darshan_hdf5_dataset));
tmp_dataset.base_rec.id = inrec->base_rec.id;
tmp_dataset.base_rec.rank = -1;
tmp_dataset.file_rec_id = inrec->file_rec_id;
/* sum */
for(j=H5D_OPENS; j<=H5D_POINT_SELECTS; j++)
......
......@@ -39,6 +39,8 @@ char *h5d_f_counter_names[] = {
#define DARSHAN_H5F_FILE_SIZE_1 40
#define DARSHAN_H5F_FILE_SIZE_2 56
#define DARSHAN_H5D_DATASET_SIZE_1 904
static int darshan_log_get_hdf5_file(darshan_fd fd, void** hdf5_buf_p);
static int darshan_log_put_hdf5_file(darshan_fd fd, void* hdf5_buf);
static void darshan_log_print_hdf5_file(void *ds_rec,
......@@ -246,6 +248,30 @@ static int darshan_log_get_hdf5_dataset(darshan_fd fd, void** hdf5_buf_p)
rec_len = sizeof(struct darshan_hdf5_dataset);
ret = darshan_log_get_mod(fd, DARSHAN_H5D_MOD, ds, rec_len);
}
else
{
char scratch[1024] = {0};
char *src_p, *dest_p;
int len;
if(fd->mod_ver[DARSHAN_H5D_MOD] == 1)
{
rec_len = DARSHAN_H5D_DATASET_SIZE_1;
ret = darshan_log_get_mod(fd, DARSHAN_H5D_MOD, scratch, rec_len);
if(ret != rec_len)
goto exit;
/* upconvert version 1 to version 2 in-place */
dest_p = scratch + sizeof(struct darshan_base_record) + sizeof(uint64_t);
src_p = dest_p - sizeof(uint64_t);
len = DARSHAN_H5D_DATASET_SIZE_1 - sizeof(struct darshan_base_record);
memmove(dest_p, src_p, len);
/* set FILE_REC_ID to 0 */
*((uint64_t *)src_p) = 0;
}
memcpy(ds, scratch, sizeof(struct darshan_hdf5_dataset));
}
exit:
if(*hdf5_buf_p == NULL)
......@@ -267,6 +293,11 @@ exit:
{
DARSHAN_BSWAP64(&(ds->base_rec.id));
DARSHAN_BSWAP64(&(ds->base_rec.rank));
/* skip counters we explicitly set to 0 since they don't
* need to be byte swapped
*/
if(fd->mod_ver[DARSHAN_H5F_MOD] >= 2)
DARSHAN_BSWAP64(&ds->file_rec_id);
for(i=0; i<H5D_NUM_INDICES; i++)
DARSHAN_BSWAP64(&ds->counters[i]);
for(i=0; i<H5D_F_NUM_INDICES; i++)
......@@ -352,6 +383,11 @@ static void darshan_log_print_hdf5_dataset(void *ds_rec, char *ds_name,
ds_name, mnt_pt, fs_type);
}
DARSHAN_U_COUNTER_PRINT(darshan_module_names[DARSHAN_H5D_MOD],
hdf5_ds_rec->base_rec.rank, hdf5_ds_rec->base_rec.id,
"H5D_FILE_REC_ID", hdf5_ds_rec->file_rec_id,
ds_name, mnt_pt, fs_type);
return;
}
......@@ -410,6 +446,13 @@ static void darshan_log_print_hdf5_dataset_description(int ver)
printf("# H5D_F_MAX_*_TIME: duration of the slowest H5D read and write operations.\n");
printf("# H5D_F_*_RANK_TIME: fastest and slowest I/O time for a single rank (for shared datasets).\n");
printf("# H5D_F_VARIANCE_RANK_*: variance of total I/O time and bytes moved for all ranks (for shared datasets).\n");
printf("# H5D_FILE_REC_ID: Darshan record ID corresponding to the dataset.\n");
if(ver == 1)
{
printf("\n# WARNING: H5D module log format version 1 does not support the following counters:\n");
printf("# - H5D_FILE_REC_ID\n");
}
return;
}
......@@ -646,6 +689,7 @@ static void darshan_log_agg_hdf5_datasets(void *rec, void *agg_rec, int init_fla
struct var_t *var_bytes_p = (struct var_t *)
((char *)var_time_p + sizeof(struct var_t));
agg_hdf5_rec->file_rec_id = hdf5_rec->file_rec_id;
for(i = 0; i < H5D_NUM_INDICES; i++)
{
switch(i)
......
......@@ -78,6 +78,7 @@ struct darshan_hdf5_file
struct darshan_hdf5_dataset
{
struct darshan_base_record base_rec;
uint64_t file_rec_id;
int64_t counters[94];
double fcounters[17];
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment