diff --git a/darshan-runtime/lib/darshan-core-init-finalize.c b/darshan-runtime/lib/darshan-core-init-finalize.c index c26eb50eb..36adc2494 100644 --- a/darshan-runtime/lib/darshan-core-init-finalize.c +++ b/darshan-runtime/lib/darshan-core-init-finalize.c @@ -27,7 +27,7 @@ DARSHAN_FORWARD_DECL(PMPI_Init_thread, int, (int *argc, char ***argv, int requir int DARSHAN_DECL(MPI_Init)(int *argc, char ***argv) { - int ret; + int ret, __darshan_disabled; MAP_OR_FAIL(PMPI_Init); (void)__darshan_disabled; @@ -54,7 +54,7 @@ DARSHAN_WRAPPER_MAP(PMPI_Init, int, (int *argc, char ***argv), MPI_Init) int DARSHAN_DECL(MPI_Init_thread)(int *argc, char ***argv, int required, int *provided) { - int ret; + int ret, __darshan_disabled; MAP_OR_FAIL(PMPI_Init_thread); (void)__darshan_disabled; @@ -81,7 +81,7 @@ DARSHAN_WRAPPER_MAP(PMPI_Init_thread, int, (int *argc, char ***argv, int require int DARSHAN_DECL(MPI_Finalize)(void) { - int ret; + int ret, __darshan_disabled; MAP_OR_FAIL(PMPI_Finalize); (void)__darshan_disabled; @@ -119,6 +119,8 @@ __attribute__((destructor)) void serial_finalize(void) void (*__real__exit)(int status) __attribute__ ((noreturn)) = NULL; void _exit(int status) { + int __darshan_disabled; + MAP_OR_FAIL(_exit); (void)__darshan_disabled; diff --git a/darshan-runtime/lib/darshan-core.c b/darshan-runtime/lib/darshan-core.c index 515e70f87..603c766d6 100644 --- a/darshan-runtime/lib/darshan-core.c +++ b/darshan-runtime/lib/darshan-core.c @@ -2752,6 +2752,7 @@ extern int __real_vfprintf(FILE *stream, const char *format, va_list); void darshan_core_fprintf( FILE *stream, const char *format, ...) { + int __darshan_disabled; va_list ap; MAP_OR_FAIL(vfprintf); diff --git a/darshan-runtime/lib/darshan-daos.c b/darshan-runtime/lib/darshan-daos.c index b944dfcc1..283377ad7 100644 --- a/darshan-runtime/lib/darshan-daos.c +++ b/darshan-runtime/lib/darshan-daos.c @@ -493,7 +493,7 @@ int darshan_daos_contopen_comp_cb(void *arg, daos_event_t *ev, int ret) int DARSHAN_DECL(daos_cont_open)(daos_handle_t poh, const char *cont, unsigned int flags, daos_handle_t *coh, daos_cont_info_t *info, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; MAP_OR_FAIL(daos_cont_open); @@ -523,7 +523,7 @@ int DARSHAN_DECL(daos_cont_open)(daos_handle_t poh, const char *cont, unsigned i int DARSHAN_DECL(daos_cont_global2local)(daos_handle_t poh, d_iov_t glob, daos_handle_t *coh) { - int ret; + int ret, __darshan_disabled; MAP_OR_FAIL(daos_cont_global2local); @@ -538,7 +538,7 @@ int DARSHAN_DECL(daos_cont_global2local)(daos_handle_t poh, d_iov_t glob, daos_h int DARSHAN_DECL(daos_cont_close)(daos_handle_t coh, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; struct daos_poolcont_info *poolcont_info; MAP_OR_FAIL(daos_cont_close); @@ -564,7 +564,7 @@ int DARSHAN_DECL(daos_cont_close)(daos_handle_t coh, daos_event_t *ev) int DARSHAN_DECL(daos_obj_open)(daos_handle_t coh, daos_obj_id_t oid, unsigned int mode, daos_handle_t *oh, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(daos_obj_open); @@ -618,7 +618,7 @@ int DARSHAN_DECL(daos_obj_fetch)(daos_handle_t oh, daos_handle_t th, uint64_t fl daos_key_t *dkey, unsigned int nr, daos_iod_t *iods, d_sg_list_t *sgls, daos_iom_t *ioms, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; daos_size_t fetch_sz; @@ -659,7 +659,7 @@ int DARSHAN_DECL(daos_obj_update)(daos_handle_t oh, daos_handle_t th, uint64_t f daos_key_t *dkey, unsigned int nr, daos_iod_t *iods, d_sg_list_t *sgls, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; daos_size_t update_sz; @@ -699,7 +699,7 @@ int DARSHAN_DECL(daos_obj_update)(daos_handle_t oh, daos_handle_t th, uint64_t f int DARSHAN_DECL(daos_obj_punch)(daos_handle_t oh, daos_handle_t th, uint64_t flags, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; struct daos_object_record_ref *rec_ref; @@ -744,7 +744,7 @@ int DARSHAN_DECL(daos_obj_punch)(daos_handle_t oh, daos_handle_t th, uint64_t fl int DARSHAN_DECL(daos_obj_punch_dkeys)(daos_handle_t oh, daos_handle_t th, uint64_t flags, unsigned int nr, daos_key_t *dkeys, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; struct daos_object_record_ref *rec_ref; @@ -789,7 +789,7 @@ int DARSHAN_DECL(daos_obj_punch_dkeys)(daos_handle_t oh, daos_handle_t th, uint6 int DARSHAN_DECL(daos_obj_punch_akeys)(daos_handle_t oh, daos_handle_t th, uint64_t flags, daos_key_t *dkey, unsigned int nr, daos_key_t *akeys, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; struct daos_object_record_ref *rec_ref; @@ -835,7 +835,7 @@ int DARSHAN_DECL(daos_obj_punch_akeys)(daos_handle_t oh, daos_handle_t th, uint6 int DARSHAN_DECL(daos_obj_list_dkey)(daos_handle_t oh, daos_handle_t th, uint32_t *nr, daos_key_desc_t *kds, d_sg_list_t *sgl, daos_anchor_t *anchor, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; struct daos_object_record_ref *rec_ref; @@ -881,7 +881,7 @@ int DARSHAN_DECL(daos_obj_list_akey)(daos_handle_t oh, daos_handle_t th, daos_key_t *dkey, uint32_t *nr, daos_key_desc_t *kds, d_sg_list_t *sgl, daos_anchor_t *anchor, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; struct daos_object_record_ref *rec_ref; @@ -928,7 +928,7 @@ int DARSHAN_DECL(daos_obj_list_recx)(daos_handle_t oh, daos_handle_t th, daos_recx_t *recxs, daos_epoch_range_t *eprs, daos_anchor_t *anchor, bool incr_order, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; struct daos_object_record_ref *rec_ref; @@ -973,7 +973,7 @@ int DARSHAN_DECL(daos_obj_list_recx)(daos_handle_t oh, daos_handle_t th, int DARSHAN_DECL(daos_obj_close)(daos_handle_t oh, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(daos_obj_close); @@ -1011,7 +1011,7 @@ int DARSHAN_DECL(daos_array_create)(daos_handle_t coh, daos_obj_id_t oid, daos_handle_t th, daos_size_t cell_size, daos_size_t chunk_size, daos_handle_t *oh, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(daos_array_create); @@ -1053,7 +1053,7 @@ int DARSHAN_DECL(daos_array_open)(daos_handle_t coh, daos_obj_id_t oid, daos_handle_t th, unsigned int mode, daos_size_t *cell_size, daos_size_t *chunk_size, daos_handle_t *oh, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(daos_array_open); @@ -1093,7 +1093,7 @@ int DARSHAN_DECL(daos_array_open)(daos_handle_t coh, daos_obj_id_t oid, int DARSHAN_DECL(daos_array_open_with_attr)(daos_handle_t coh, daos_obj_id_t oid, daos_handle_t th, unsigned int mode, daos_size_t cell_size, daos_size_t chunk_size, daos_handle_t *oh, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(daos_array_open_with_attr); @@ -1145,7 +1145,7 @@ int DARSHAN_DECL(daos_array_open_with_attr)(daos_handle_t coh, daos_obj_id_t oid int DARSHAN_DECL(daos_array_read)(daos_handle_t oh, daos_handle_t th, daos_array_iod_t *iod, d_sg_list_t *sgl, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; daos_size_t read_sz; @@ -1185,7 +1185,7 @@ int DARSHAN_DECL(daos_array_read)(daos_handle_t oh, daos_handle_t th, int DARSHAN_DECL(daos_array_write)(daos_handle_t oh, daos_handle_t th, daos_array_iod_t *iod, d_sg_list_t *sgl, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; daos_size_t write_sz; @@ -1225,7 +1225,7 @@ int DARSHAN_DECL(daos_array_write)(daos_handle_t oh, daos_handle_t th, int DARSHAN_DECL(daos_array_get_size)(daos_handle_t oh, daos_handle_t th, daos_size_t *size, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; struct daos_object_record_ref *rec_ref; @@ -1270,7 +1270,7 @@ int DARSHAN_DECL(daos_array_get_size)(daos_handle_t oh, daos_handle_t th, int DARSHAN_DECL(daos_array_set_size)(daos_handle_t oh, daos_handle_t th, daos_size_t size, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; struct daos_object_record_ref *rec_ref; @@ -1314,7 +1314,7 @@ int DARSHAN_DECL(daos_array_set_size)(daos_handle_t oh, daos_handle_t th, int DARSHAN_DECL(daos_array_stat)(daos_handle_t oh, daos_handle_t th, daos_array_stbuf_t *stbuf, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; struct daos_object_record_ref *rec_ref; @@ -1359,7 +1359,7 @@ int DARSHAN_DECL(daos_array_stat)(daos_handle_t oh, daos_handle_t th, daos_array int DARSHAN_DECL(daos_array_punch)(daos_handle_t oh, daos_handle_t th, daos_array_iod_t *iod, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; struct daos_object_record_ref *rec_ref; @@ -1404,7 +1404,7 @@ int DARSHAN_DECL(daos_array_punch)(daos_handle_t oh, daos_handle_t th, int DARSHAN_DECL(daos_array_destroy)(daos_handle_t oh, daos_handle_t th, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; struct daos_object_record_ref *rec_ref; @@ -1448,7 +1448,7 @@ int DARSHAN_DECL(daos_array_destroy)(daos_handle_t oh, daos_handle_t th, int DARSHAN_DECL(daos_array_close)(daos_handle_t oh, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(daos_array_close); @@ -1485,7 +1485,7 @@ int DARSHAN_DECL(daos_array_close)(daos_handle_t oh, daos_event_t *ev) int DARSHAN_DECL(daos_kv_open)(daos_handle_t coh, daos_obj_id_t oid, unsigned int mode, daos_handle_t *oh, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(daos_kv_open); @@ -1526,7 +1526,7 @@ int DARSHAN_DECL(daos_kv_open)(daos_handle_t coh, daos_obj_id_t oid, unsigned in int DARSHAN_DECL(daos_kv_get)(daos_handle_t oh, daos_handle_t th, uint64_t flags, const char *key, daos_size_t *size, void *buf, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(daos_kv_get); @@ -1563,7 +1563,7 @@ int DARSHAN_DECL(daos_kv_get)(daos_handle_t oh, daos_handle_t th, uint64_t flags int DARSHAN_DECL(daos_kv_put)(daos_handle_t oh, daos_handle_t th, uint64_t flags, const char *key, daos_size_t size, const void *buf, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(daos_kv_put); @@ -1600,7 +1600,7 @@ int DARSHAN_DECL(daos_kv_put)(daos_handle_t oh, daos_handle_t th, uint64_t flags int DARSHAN_DECL(daos_kv_remove)(daos_handle_t oh, daos_handle_t th, uint64_t flags, const char *key, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; struct daos_object_record_ref *rec_ref; @@ -1645,7 +1645,7 @@ int DARSHAN_DECL(daos_kv_remove)(daos_handle_t oh, daos_handle_t th, uint64_t fl int DARSHAN_DECL(daos_kv_list)(daos_handle_t oh, daos_handle_t th, uint32_t *nr, daos_key_desc_t *kds, d_sg_list_t *sgl, daos_anchor_t *anchor, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; struct daos_object_record_ref *rec_ref; @@ -1689,7 +1689,7 @@ int DARSHAN_DECL(daos_kv_list)(daos_handle_t oh, daos_handle_t th, uint32_t *nr, int DARSHAN_DECL(daos_kv_destroy)(daos_handle_t oh, daos_handle_t th, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; struct daos_object_record_ref *rec_ref; @@ -1733,7 +1733,7 @@ int DARSHAN_DECL(daos_kv_destroy)(daos_handle_t oh, daos_handle_t th, daos_event int DARSHAN_DECL(daos_kv_close)(daos_handle_t oh, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(daos_kv_close); diff --git a/darshan-runtime/lib/darshan-dfs.c b/darshan-runtime/lib/darshan-dfs.c index 4d7bf3964..63e2aca26 100644 --- a/darshan-runtime/lib/darshan-dfs.c +++ b/darshan-runtime/lib/darshan-dfs.c @@ -325,7 +325,7 @@ static int my_rank = -1; int DARSHAN_DECL(dfs_mount)(daos_handle_t poh, daos_handle_t coh, int flags, dfs_t **dfs) { - int ret; + int ret, __darshan_disabled; MAP_OR_FAIL(dfs_mount); @@ -340,7 +340,7 @@ int DARSHAN_DECL(dfs_mount)(daos_handle_t poh, daos_handle_t coh, int flags, dfs int DARSHAN_DECL(dfs_global2local)(daos_handle_t poh, daos_handle_t coh, int flags, d_iov_t glob, dfs_t **dfs) { - int ret; + int ret, __darshan_disabled; MAP_OR_FAIL(dfs_global2local); @@ -355,7 +355,7 @@ int DARSHAN_DECL(dfs_global2local)(daos_handle_t poh, daos_handle_t coh, int fla int DARSHAN_DECL(dfs_umount)(dfs_t *dfs) { - int ret; + int ret, __darshan_disabled; struct dfs_mount_info *mnt_info; MAP_OR_FAIL(dfs_umount); @@ -379,7 +379,7 @@ int DARSHAN_DECL(dfs_umount)(dfs_t *dfs) int DARSHAN_DECL(dfs_lookup)(dfs_t *dfs, const char *path, int flags, dfs_obj_t **obj, mode_t *mode, struct stat *stbuf) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(dfs_lookup); @@ -397,7 +397,7 @@ int DARSHAN_DECL(dfs_lookup)(dfs_t *dfs, const char *path, int flags, dfs_obj_t int DARSHAN_DECL(dfs_lookup_rel)(dfs_t *dfs, dfs_obj_t *parent, const char *name, int flags, dfs_obj_t **obj, mode_t *mode, struct stat *stbuf) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; char *obj_rec_name = NULL; @@ -421,7 +421,7 @@ int DARSHAN_DECL(dfs_lookup_rel)(dfs_t *dfs, dfs_obj_t *parent, const char *name int DARSHAN_DECL(dfs_open)(dfs_t *dfs, dfs_obj_t *parent, const char *name, mode_t mode, int flags, daos_oclass_id_t cid, daos_size_t chunk_size, const char *value, dfs_obj_t **obj) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; char *obj_rec_name = NULL; @@ -445,7 +445,7 @@ int DARSHAN_DECL(dfs_open)(dfs_t *dfs, dfs_obj_t *parent, const char *name, mode int DARSHAN_DECL(dfs_dup)(dfs_t *dfs, dfs_obj_t *obj, int flags, dfs_obj_t **new_obj) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; struct dfs_file_record_ref *rec_ref = NULL; @@ -465,7 +465,7 @@ int DARSHAN_DECL(dfs_dup)(dfs_t *dfs, dfs_obj_t *obj, int flags, dfs_obj_t **new int DARSHAN_DECL(dfs_obj_global2local)(dfs_t *dfs, int flags, d_iov_t glob, dfs_obj_t **obj) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; char *obj_rec_name = NULL; @@ -484,7 +484,7 @@ int DARSHAN_DECL(dfs_obj_global2local)(dfs_t *dfs, int flags, d_iov_t glob, dfs_ int DARSHAN_DECL(dfs_release)(dfs_obj_t *obj) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; struct dfs_file_record_ref *rec_ref = NULL; @@ -537,7 +537,7 @@ int darshan_dfs_read_comp_cb(void *arg, daos_event_t *ev, int ret) int DARSHAN_DECL(dfs_read)(dfs_t *dfs, dfs_obj_t *obj, d_sg_list_t *sgl, daos_off_t off, daos_size_t *read_size, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; daos_size_t rdsize; @@ -576,7 +576,7 @@ int DARSHAN_DECL(dfs_read)(dfs_t *dfs, dfs_obj_t *obj, d_sg_list_t *sgl, daos_of int DARSHAN_DECL(dfs_readx)(dfs_t *dfs, dfs_obj_t *obj, dfs_iod_t *iod, d_sg_list_t *sgl, daos_size_t *read_size, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; daos_size_t rdsize; @@ -638,7 +638,7 @@ int darshan_dfs_write_comp_cb(void *arg, daos_event_t *ev, int ret) int DARSHAN_DECL(dfs_write)(dfs_t *dfs, dfs_obj_t *obj, d_sg_list_t *sgl, daos_off_t off, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; daos_size_t wrsize; int i; @@ -680,7 +680,7 @@ int DARSHAN_DECL(dfs_write)(dfs_t *dfs, dfs_obj_t *obj, d_sg_list_t *sgl, daos_o int DARSHAN_DECL(dfs_writex)(dfs_t *dfs, dfs_obj_t *obj, dfs_iod_t *iod, d_sg_list_t *sgl, daos_event_t *ev) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; daos_size_t wrsize; int i; @@ -722,7 +722,7 @@ int DARSHAN_DECL(dfs_writex)(dfs_t *dfs, dfs_obj_t *obj, dfs_iod_t *iod, d_sg_li int DARSHAN_DECL(dfs_get_size)(dfs_t *dfs, dfs_obj_t *obj, daos_size_t *size) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; struct dfs_file_record_ref *rec_ref = NULL; @@ -748,7 +748,7 @@ int DARSHAN_DECL(dfs_get_size)(dfs_t *dfs, dfs_obj_t *obj, daos_size_t *size) int DARSHAN_DECL(dfs_punch)(dfs_t *dfs, dfs_obj_t *obj, daos_off_t offset, daos_size_t len) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; struct dfs_file_record_ref *rec_ref = NULL; @@ -775,7 +775,7 @@ int DARSHAN_DECL(dfs_punch)(dfs_t *dfs, dfs_obj_t *obj, daos_off_t offset, daos_ int DARSHAN_DECL(dfs_remove)(dfs_t *dfs, dfs_obj_t *parent, const char *name, bool force, daos_obj_id_t *oid) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; daos_obj_id_t the_oid; struct dfs_mount_info *mnt_info; @@ -825,7 +825,7 @@ int DARSHAN_DECL(dfs_remove)(dfs_t *dfs, dfs_obj_t *parent, const char *name, bo */ int DARSHAN_DECL(dfs_stat)(dfs_t *dfs, dfs_obj_t *parent, const char *name, struct stat *stbuf) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; struct dfs_file_record_ref *rec_ref = NULL; char *parent_rec_name, *rec_name; @@ -871,7 +871,7 @@ int DARSHAN_DECL(dfs_stat)(dfs_t *dfs, dfs_obj_t *parent, const char *name, stru int DARSHAN_DECL(dfs_ostat)(dfs_t *dfs, dfs_obj_t *obj, struct stat *stbuf) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; struct dfs_file_record_ref *rec_ref = NULL; @@ -897,7 +897,7 @@ int DARSHAN_DECL(dfs_ostat)(dfs_t *dfs, dfs_obj_t *obj, struct stat *stbuf) int DARSHAN_DECL(dfs_osetattr)(dfs_t *dfs, dfs_obj_t *obj, struct stat *stbuf, int flags) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; struct dfs_file_record_ref *rec_ref = NULL; diff --git a/darshan-runtime/lib/darshan-hdf5.c b/darshan-runtime/lib/darshan-hdf5.c index 51a420064..c0412f295 100644 --- a/darshan-runtime/lib/darshan-hdf5.c +++ b/darshan-runtime/lib/darshan-hdf5.c @@ -200,7 +200,7 @@ hid_t DARSHAN_DECL(H5Fcreate)(const char *filename, unsigned flags, double tm1, tm2; unsigned majnum, minnum, relnum; int tmp_rank = my_rank; - int use_mpio = 0; + int use_mpio = 0, __darshan_disabled; H5get_libversion(&majnum, &minnum, &relnum); #ifdef DARSHAN_HDF5_VERS_1_10_PLUS @@ -292,7 +292,7 @@ hid_t DARSHAN_DECL(H5Fopen)(const char *filename, unsigned flags, double tm1, tm2; unsigned majnum, minnum, relnum; int tmp_rank = my_rank; - int use_mpio = 0; + int use_mpio = 0, __darshan_disabled; H5get_libversion(&majnum, &minnum, &relnum); #ifdef DARSHAN_HDF5_VERS_1_10_PLUS @@ -383,6 +383,7 @@ herr_t DARSHAN_DECL(H5Fflush)(hid_t object_id, H5F_scope_t scope) hid_t file_id; double tm1, tm2; herr_t ret; + int __darshan_disabled; MAP_OR_FAIL(H5Fflush); @@ -421,6 +422,7 @@ herr_t DARSHAN_DECL(H5Fclose)(hid_t file_id) struct hdf5_file_record_ref *rec_ref; double tm1, tm2; herr_t ret; + int __darshan_disabled; MAP_OR_FAIL(H5Fclose); @@ -552,6 +554,7 @@ hid_t DARSHAN_DECL(H5Dcreate1)(hid_t loc_id, const char *name, hid_t type_id, hi { double tm1, tm2; hid_t ret; + int __darshan_disabled; MAP_OR_FAIL(H5Dcreate1); @@ -574,6 +577,7 @@ hid_t DARSHAN_DECL(H5Dcreate2)(hid_t loc_id, const char *name, hid_t dtype_id, h { double tm1, tm2; hid_t ret; + int __darshan_disabled; MAP_OR_FAIL(H5Dcreate2); @@ -598,6 +602,7 @@ hid_t DARSHAN_DECL(H5Dopen1)(hid_t loc_id, const char *name) hid_t dcpl_id; double tm1, tm2; hid_t ret; + int __darshan_disabled; MAP_OR_FAIL(H5Dopen1); @@ -644,6 +649,7 @@ hid_t DARSHAN_DECL(H5Dopen2)(hid_t loc_id, const char *name, hid_t dapl_id) hid_t dcpl_id; double tm1, tm2; hid_t ret; + int __darshan_disabled; MAP_OR_FAIL(H5Dopen2); @@ -693,7 +699,7 @@ herr_t DARSHAN_DECL(H5Dread)(hid_t dataset_id, hid_t mem_type_id, hid_t mem_spac H5S_sel_type file_sel_type; int64_t common_access_vals[H5D_MAX_NDIMS+H5D_MAX_NDIMS+1] = {0}; struct darshan_common_val_counter *cvc; - int i; + int i, __darshan_disabled; double tm1, tm2, elapsed; herr_t ret; @@ -824,7 +830,7 @@ herr_t DARSHAN_DECL(H5Dwrite)(hid_t dataset_id, hid_t mem_type_id, hid_t mem_spa H5S_sel_type file_sel_type; int64_t common_access_vals[H5D_MAX_NDIMS+H5D_MAX_NDIMS+1] = {0}; struct darshan_common_val_counter *cvc; - int i; + int i, __darshan_disabled; double tm1, tm2, elapsed; herr_t ret; @@ -951,6 +957,7 @@ herr_t DARSHAN_DECL(H5Dflush)(hid_t dataset_id) struct hdf5_dataset_record_ref *rec_ref; double tm1, tm2; herr_t ret; + int __darshan_disabled; MAP_OR_FAIL(H5Dflush); @@ -982,6 +989,7 @@ herr_t DARSHAN_DECL(H5Dclose)(hid_t dataset_id) struct hdf5_dataset_record_ref *rec_ref; double tm1, tm2; herr_t ret; + int __darshan_disabled; MAP_OR_FAIL(H5Dclose); @@ -1028,6 +1036,7 @@ hid_t DARSHAN_DECL(H5Oopen)(hid_t loc_id, const char *name, hid_t lapl_id) hid_t dcpl_id; double tm1, tm2; hid_t ret; + int __darshan_disabled; MAP_OR_FAIL(H5Oopen); @@ -1080,6 +1089,7 @@ hid_t DARSHAN_DECL(H5Oopen_by_addr)(hid_t loc_id, haddr_t addr) double tm1, tm2; size_t sz; hid_t ret; + int __darshan_disabled; MAP_OR_FAIL(H5Oopen_by_addr); @@ -1143,6 +1153,7 @@ hid_t DARSHAN_DECL(H5Oopen_by_idx)(hid_t loc_id, const char * group_name, double tm1, tm2; size_t sz; hid_t ret; + int __darshan_disabled; MAP_OR_FAIL(H5Oopen_by_idx); @@ -1206,6 +1217,7 @@ hid_t DARSHAN_DECL(H5Oopen_by_token)(hid_t loc_id, H5O_token_t token) double tm1, tm2; size_t sz; hid_t ret; + int __darshan_disabled; MAP_OR_FAIL(H5Oopen_by_token); @@ -1265,6 +1277,7 @@ herr_t DARSHAN_DECL(H5Oclose)(hid_t object_id) struct hdf5_dataset_record_ref *rec_ref; double tm1, tm2; herr_t ret; + int __darshan_disabled; MAP_OR_FAIL(H5Oclose); diff --git a/darshan-runtime/lib/darshan-mdhim.c b/darshan-runtime/lib/darshan-mdhim.c index 21f4a9896..597f8319a 100644 --- a/darshan-runtime/lib/darshan-mdhim.c +++ b/darshan-runtime/lib/darshan-mdhim.c @@ -223,7 +223,7 @@ int DARSHAN_DECL(mdhimInit)(mdhim_t *md, mdhim_options_t *opts) /* not counting or tracking anything in this routine, but grabbing a * bit of information about the mdhim instance */ - int ret; + int ret, __darshan_disabled; darshan_record_id rec_id; struct mdhim_record_ref *rec_ref; int nr_servers; @@ -259,6 +259,7 @@ mdhim_rm_t *DARSHAN_DECL(mdhimPut)(mdhim_t *md, { mdhim_rm_t *ret; double tm1, tm2; + int __darshan_disabled; /* The MAP_OR_FAIL macro attempts to obtain the address of the actual * underlying put function call (__real_put), in the case of LD_PRELOADing @@ -293,6 +294,7 @@ mdhim_grm_t * DARSHAN_DECL(mdhimGet)(mdhim_t *md, { mdhim_grm_t *ret; double tm1, tm2; + int __darshan_disabled; MAP_OR_FAIL(mdhimGet); diff --git a/darshan-runtime/lib/darshan-mpiio.c b/darshan-runtime/lib/darshan-mpiio.c index 18f4fd807..1010622b9 100644 --- a/darshan-runtime/lib/darshan-mpiio.c +++ b/darshan-runtime/lib/darshan-mpiio.c @@ -374,7 +374,7 @@ int DARSHAN_DECL(MPI_File_open)(MPI_Comm comm, const char *filename, int amode, int DARSHAN_DECL(MPI_File_open)(MPI_Comm comm, char *filename, int amode, MPI_Info info, MPI_File *fh) #endif { - int ret; + int ret, __darshan_disabled; MPI_File tmp_fh; char* tmp; double tm1, tm2; @@ -411,7 +411,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_open, int, (MPI_Comm comm, char *filename, int am int DARSHAN_DECL(MPI_File_read)(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -439,7 +439,7 @@ int DARSHAN_DECL(MPI_File_write)(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status) #endif { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -467,7 +467,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_write, int, (MPI_File fh, void *buf, int count, int DARSHAN_DECL(MPI_File_read_at)(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(PMPI_File_read_at); @@ -494,7 +494,7 @@ int DARSHAN_DECL(MPI_File_write_at)(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status) #endif { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(PMPI_File_write_at); @@ -520,7 +520,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_write_at, int, (MPI_File fh, MPI_Offset offset, vo int DARSHAN_DECL(MPI_File_read_all)(MPI_File fh, void * buf, int count, MPI_Datatype datatype, MPI_Status *status) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -547,7 +547,7 @@ int DARSHAN_DECL(MPI_File_write_all)(MPI_File fh, const void * buf, int count, M int DARSHAN_DECL(MPI_File_write_all)(MPI_File fh, void * buf, int count, MPI_Datatype datatype, MPI_Status *status) #endif { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -576,7 +576,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_write_all, int, (MPI_File fh, void * buf, int coun int DARSHAN_DECL(MPI_File_read_at_all)(MPI_File fh, MPI_Offset offset, void * buf, int count, MPI_Datatype datatype, MPI_Status * status) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(PMPI_File_read_at_all); @@ -604,7 +604,7 @@ int DARSHAN_DECL(MPI_File_write_at_all)(MPI_File fh, MPI_Offset offset, void * b int count, MPI_Datatype datatype, MPI_Status * status) #endif { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(PMPI_File_write_at_all); @@ -632,7 +632,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_write_at_all, int, (MPI_File fh, MPI_Offset offset int DARSHAN_DECL(MPI_File_read_shared)(MPI_File fh, void * buf, int count, MPI_Datatype datatype, MPI_Status *status) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -659,7 +659,7 @@ int DARSHAN_DECL(MPI_File_write_shared)(MPI_File fh, const void * buf, int count int DARSHAN_DECL(MPI_File_write_shared)(MPI_File fh, void * buf, int count, MPI_Datatype datatype, MPI_Status *status) #endif { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -689,7 +689,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_write_shared, int, (MPI_File fh, void * buf, int c int DARSHAN_DECL(MPI_File_read_ordered)(MPI_File fh, void * buf, int count, MPI_Datatype datatype, MPI_Status * status) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -719,7 +719,7 @@ int DARSHAN_DECL(MPI_File_write_ordered)(MPI_File fh, void * buf, int count, MPI_Datatype datatype, MPI_Status * status) #endif { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -749,7 +749,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_write_ordered, int, (MPI_File fh, void * buf, int int DARSHAN_DECL(MPI_File_read_all_begin)(MPI_File fh, void * buf, int count, MPI_Datatype datatype) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -775,7 +775,7 @@ int DARSHAN_DECL(MPI_File_write_all_begin)(MPI_File fh, const void * buf, int co int DARSHAN_DECL(MPI_File_write_all_begin)(MPI_File fh, void * buf, int count, MPI_Datatype datatype) #endif { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -804,7 +804,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_write_all_begin, int, (MPI_File fh, void * buf, in int DARSHAN_DECL(MPI_File_read_at_all_begin)(MPI_File fh, MPI_Offset offset, void * buf, int count, MPI_Datatype datatype) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(PMPI_File_read_at_all_begin); @@ -831,7 +831,7 @@ int DARSHAN_DECL(MPI_File_write_at_all_begin)(MPI_File fh, MPI_Offset offset, vo int count, MPI_Datatype datatype) #endif { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(PMPI_File_write_at_all_begin); @@ -857,7 +857,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_write_at_all_begin, int, (MPI_File fh, MPI_Offset int DARSHAN_DECL(MPI_File_read_ordered_begin)(MPI_File fh, void * buf, int count, MPI_Datatype datatype) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -884,7 +884,7 @@ int DARSHAN_DECL(MPI_File_write_ordered_begin)(MPI_File fh, const void * buf, in int DARSHAN_DECL(MPI_File_write_ordered_begin)(MPI_File fh, void * buf, int count, MPI_Datatype datatype) #endif { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -912,7 +912,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_write_ordered_begin, int, (MPI_File fh, void * buf int DARSHAN_DECL(MPI_File_iread)(MPI_File fh, void * buf, int count, MPI_Datatype datatype, __D_MPI_REQUEST * request) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -934,7 +934,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_iread, int, (MPI_File fh, void * buf, int count, M int DARSHAN_DECL(MPI_File_iread_all)(MPI_File fh, void * buf, int count, MPI_Datatype datatype, __D_MPI_REQUEST * request) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -962,7 +962,7 @@ int DARSHAN_DECL(MPI_File_iwrite)(MPI_File fh, void * buf, int count, MPI_Datatype datatype, __D_MPI_REQUEST * request) #endif { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -997,7 +997,7 @@ int DARSHAN_DECL(MPI_File_iwrite_all)(MPI_File fh, void * buf, int count, MPI_Datatype datatype, __D_MPI_REQUEST * request) #endif { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -1027,7 +1027,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_iwrite_all, int, (MPI_File fh, void * buf, int cou int DARSHAN_DECL(MPI_File_iread_at)(MPI_File fh, MPI_Offset offset, void * buf, int count, MPI_Datatype datatype, __D_MPI_REQUEST *request) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(PMPI_File_iread_at); @@ -1050,7 +1050,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_iread_at, int, (MPI_File fh, MPI_Offset offset, vo int DARSHAN_DECL(MPI_File_iread_at_all)(MPI_File fh, MPI_Offset offset, void * buf, int count, MPI_Datatype datatype, __D_MPI_REQUEST *request) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(PMPI_File_iread_at_all); @@ -1078,7 +1078,7 @@ int DARSHAN_DECL(MPI_File_iwrite_at)(MPI_File fh, MPI_Offset offset, void * buf, int count, MPI_Datatype datatype, __D_MPI_REQUEST *request) #endif { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(PMPI_File_iwrite_at); @@ -1112,7 +1112,7 @@ int DARSHAN_DECL(MPI_File_iwrite_at_all)(MPI_File fh, MPI_Offset offset, void * int count, MPI_Datatype datatype, __D_MPI_REQUEST *request) #endif { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(PMPI_File_iwrite_at_all); @@ -1141,7 +1141,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_iwrite_at_all, int, (MPI_File fh, MPI_Offset offse int DARSHAN_DECL(MPI_File_iread_shared)(MPI_File fh, void * buf, int count, MPI_Datatype datatype, __D_MPI_REQUEST * request) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -1171,7 +1171,7 @@ int DARSHAN_DECL(MPI_File_iwrite_shared)(MPI_File fh, void * buf, int count, MPI_Datatype datatype, __D_MPI_REQUEST * request) #endif { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -1201,7 +1201,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_iwrite_shared, int, (MPI_File fh, void * buf, int int DARSHAN_DECL(MPI_File_sync)(MPI_File fh) { - int ret; + int ret, __darshan_disabled; struct mpiio_file_record_ref *rec_ref; double tm1, tm2; @@ -1238,7 +1238,7 @@ int DARSHAN_DECL(MPI_File_set_view)(MPI_File fh, MPI_Offset disp, MPI_Datatype e MPI_Datatype filetype, char *datarep, MPI_Info info) #endif { - int ret; + int ret, __darshan_disabled; struct mpiio_file_record_ref *rec_ref; double tm1, tm2; @@ -1280,7 +1280,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_set_view, int, (MPI_File fh, MPI_Offset disp, MPI_ int DARSHAN_DECL(MPI_File_close)(MPI_File *fh) { - int ret; + int ret, __darshan_disabled; struct mpiio_file_record_ref *rec_ref; MPI_File tmp_fh = *fh; double tm1, tm2; @@ -1971,7 +1971,7 @@ DARSHAN_FORWARD_DECL(PMPI_File_write_shared_c, int, (MPI_File fh, const void *bu int DARSHAN_DECL(MPI_File_iread_all_c)(MPI_File fh, void * buf, MPI_Count count, MPI_Datatype datatype, __D_MPI_REQUEST * request) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -1994,7 +1994,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_iread_all_c, int, (MPI_File fh, void * buf, MPI_Co int DARSHAN_DECL(MPI_File_iread_at_all_c)(MPI_File fh, MPI_Offset offset, void * buf, MPI_Count count, MPI_Datatype datatype, __D_MPI_REQUEST *request) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(PMPI_File_iread_at_all_c); @@ -2017,7 +2017,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_iread_at_all_c, int, (MPI_File fh, MPI_Offset offs int DARSHAN_DECL(MPI_File_iread_at_c)(MPI_File fh, MPI_Offset offset, void * buf, MPI_Count count, MPI_Datatype datatype, __D_MPI_REQUEST *request) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(PMPI_File_iread_at_c); @@ -2039,7 +2039,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_iread_at_c, int, (MPI_File fh, MPI_Offset offset, int DARSHAN_DECL(MPI_File_iread_c)(MPI_File fh, void * buf, MPI_Count count, MPI_Datatype datatype, __D_MPI_REQUEST * request) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -2062,7 +2062,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_iread_c, int, (MPI_File fh, void * buf, MPI_Count int DARSHAN_DECL(MPI_File_iread_shared_c)(MPI_File fh, void * buf, MPI_Count count, MPI_Datatype datatype, __D_MPI_REQUEST * request) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -2087,7 +2087,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_iread_shared_c, int, (MPI_File fh, void * buf, MPI int DARSHAN_DECL(MPI_File_iwrite_all_c)(MPI_File fh, const void * buf, MPI_Count count, MPI_Datatype datatype, __D_MPI_REQUEST * request) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -2111,7 +2111,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_iwrite_all_c, int, (MPI_File fh, const void * buf, int DARSHAN_DECL(MPI_File_iwrite_at_all_c)(MPI_File fh, MPI_Offset offset, const void * buf, MPI_Count count, MPI_Datatype datatype, __D_MPI_REQUEST *request) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(PMPI_File_iwrite_at_all_c); @@ -2134,7 +2134,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_iwrite_at_all_c, int, (MPI_File fh, MPI_Offset off int DARSHAN_DECL(MPI_File_iwrite_at_c)(MPI_File fh, MPI_Offset offset, const void * buf, MPI_Count count, MPI_Datatype datatype, __D_MPI_REQUEST *request) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(PMPI_File_iwrite_at_c); @@ -2157,7 +2157,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_iwrite_at_c, int, (MPI_File fh, MPI_Offset offset, int DARSHAN_DECL(MPI_File_iwrite_c)(MPI_File fh, const void * buf, MPI_Count count, MPI_Datatype datatype, __D_MPI_REQUEST * request) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -2181,7 +2181,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_iwrite_c, int, (MPI_File fh, const void * buf, MPI int DARSHAN_DECL(MPI_File_iwrite_shared_c)(MPI_File fh, const void * buf, MPI_Count count, MPI_Datatype datatype, __D_MPI_REQUEST * request) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -2205,7 +2205,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_iwrite_shared_c, int, (MPI_File fh, const void * b int DARSHAN_DECL(MPI_File_read_all_begin_c)(MPI_File fh, void * buf, MPI_Count count, MPI_Datatype datatype) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -2227,7 +2227,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_read_all_begin_c, int, (MPI_File fh, void * buf, M int DARSHAN_DECL(MPI_File_read_all_c)(MPI_File fh, void * buf, MPI_Count count, MPI_Datatype datatype, MPI_Status *status) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -2251,7 +2251,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_read_all_c, int, (MPI_File fh, void * buf, MPI_Cou int DARSHAN_DECL(MPI_File_read_at_all_begin_c)(MPI_File fh, MPI_Offset offset, void * buf, MPI_Count count, MPI_Datatype datatype) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(PMPI_File_read_at_all_begin_c); @@ -2273,7 +2273,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_read_at_all_begin_c, int, (MPI_File fh, MPI_Offset int DARSHAN_DECL(MPI_File_read_at_all_c)(MPI_File fh, MPI_Offset offset, void * buf, MPI_Count count, MPI_Datatype datatype, MPI_Status * status) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(PMPI_File_read_at_all_c); @@ -2296,7 +2296,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_read_at_all_c, int, (MPI_File fh, MPI_Offset offse int DARSHAN_DECL(MPI_File_read_at_c)(MPI_File fh, MPI_Offset offset, void *buf, MPI_Count count, MPI_Datatype datatype, MPI_Status *status) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(PMPI_File_read_at_c); @@ -2318,7 +2318,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_read_at_c, int, (MPI_File fh, MPI_Offset offset, v int DARSHAN_DECL(MPI_File_read_c)(MPI_File fh, void *buf, MPI_Count count, MPI_Datatype datatype, MPI_Status *status) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -2340,7 +2340,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_read_c, int, (MPI_File fh, void *buf, MPI_Count co int DARSHAN_DECL(MPI_File_read_ordered_begin_c)(MPI_File fh, void * buf, MPI_Count count, MPI_Datatype datatype) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -2364,7 +2364,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_read_ordered_begin_c, int, (MPI_File fh, void * bu int DARSHAN_DECL(MPI_File_read_ordered_c)(MPI_File fh, void * buf, MPI_Count count, MPI_Datatype datatype, MPI_Status * status) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -2388,7 +2388,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_read_ordered_c, int, (MPI_File fh, void * buf, MPI int DARSHAN_DECL(MPI_File_read_shared_c)(MPI_File fh, void * buf, MPI_Count count, MPI_Datatype datatype, MPI_Status *status) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -2411,7 +2411,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_read_shared_c, int, (MPI_File fh, void * buf, MPI_ int DARSHAN_DECL(MPI_File_write_all_begin_c)(MPI_File fh, const void * buf, MPI_Count count, MPI_Datatype datatype) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -2434,7 +2434,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_write_all_begin_c, int, (MPI_File fh, const void * int DARSHAN_DECL(MPI_File_write_all_c)(MPI_File fh, const void * buf, MPI_Count count, MPI_Datatype datatype, MPI_Status *status) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -2458,7 +2458,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_write_all_c, int, (MPI_File fh, const void * buf, int DARSHAN_DECL(MPI_File_write_at_all_begin_c)(MPI_File fh, MPI_Offset offset, const void * buf, MPI_Count count, MPI_Datatype datatype) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(PMPI_File_write_at_all_begin_c); @@ -2480,7 +2480,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_write_at_all_begin_c, int, (MPI_File fh, MPI_Offse int DARSHAN_DECL(MPI_File_write_at_all_c)(MPI_File fh, MPI_Offset offset, const void * buf, MPI_Count count, MPI_Datatype datatype, MPI_Status * status) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(PMPI_File_write_at_all_c); @@ -2503,7 +2503,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_write_at_all_c, int, (MPI_File fh, MPI_Offset offs int DARSHAN_DECL(MPI_File_write_at_c)(MPI_File fh, MPI_Offset offset, const void *buf, MPI_Count count, MPI_Datatype datatype, MPI_Status *status) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(PMPI_File_write_at_c); @@ -2525,7 +2525,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_write_at_c, int, (MPI_File fh, MPI_Offset offset, int DARSHAN_DECL(MPI_File_write_c)(MPI_File fh, const void *buf, MPI_Count count, MPI_Datatype datatype, MPI_Status *status) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -2547,7 +2547,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_write_c, int, (MPI_File fh, const void *buf, MPI_C int DARSHAN_DECL(MPI_File_write_ordered_begin_c)(MPI_File fh, const void * buf, MPI_Count count, MPI_Datatype datatype) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -2571,7 +2571,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_write_ordered_begin_c, int, (MPI_File fh, const vo int DARSHAN_DECL(MPI_File_write_ordered_c)(MPI_File fh, const void * buf, MPI_Count count, MPI_Datatype datatype, MPI_Status * status) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; @@ -2595,7 +2595,7 @@ DARSHAN_WRAPPER_MAP(PMPI_File_write_ordered_c, int, (MPI_File fh, const void * b int DARSHAN_DECL(MPI_File_write_shared_c)(MPI_File fh, const void * buf, MPI_Count count, MPI_Datatype datatype, MPI_Status *status) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset offset; diff --git a/darshan-runtime/lib/darshan-null.c b/darshan-runtime/lib/darshan-null.c index f811d9714..1cbd7da06 100644 --- a/darshan-runtime/lib/darshan-null.c +++ b/darshan-runtime/lib/darshan-null.c @@ -180,6 +180,7 @@ int DARSHAN_DECL(foo)(const char* name, int arg1) { ssize_t ret; double tm1, tm2; + int __darshan_disabled; /* The MAP_OR_FAIL macro attempts to obtain the address of the actual * underlying foo function call (__real_foo), in the case of LD_PRELOADing diff --git a/darshan-runtime/lib/darshan-pnetcdf-api.m4 b/darshan-runtime/lib/darshan-pnetcdf-api.m4 index 9f1f79390..2bf6530e5 100644 --- a/darshan-runtime/lib/darshan-pnetcdf-api.m4 +++ b/darshan-runtime/lib/darshan-pnetcdf-api.m4 @@ -227,7 +227,7 @@ DARSHAN_FORWARD_DECL(APINAME($1,$2,$3,$4), int, (int ncid, int varid, ArgKind($2 int DARSHAN_DECL(APINAME($1,$2,$3,$4))(int ncid, int varid, ArgKind($2)BufArgs($1,$3)) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(APINAME($1,$2,$3,$4)); @@ -270,7 +270,7 @@ DARSHAN_FORWARD_DECL(APINAME($1,n,$2,$3), int, (int ncid, int varid, int num, MP int DARSHAN_DECL(APINAME($1,n,$2,$3))(int ncid, int varid, int num, MPI_Offset* const *starts, MPI_Offset* const *counts, BufArgs($1,$2)) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(APINAME($1,n,$2,$3)); @@ -312,7 +312,7 @@ DARSHAN_FORWARD_DECL(ncmpi_$1_vard$2, int, (int ncid, int varid, MPI_Datatype fi int DARSHAN_DECL(ncmpi_$1_vard$2)(int ncid, int varid, MPI_Datatype filetype, ifelse($1,`put',`const ')void *buf, MPI_Offset bufcount, MPI_Datatype buftype) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(ncmpi_$1_vard$2); @@ -353,7 +353,7 @@ DARSHAN_FORWARD_DECL(APINAME($1,$2,$3), int, (int ncid, int varid, ArgKind($2)Bu int DARSHAN_DECL(APINAME($1,$2,$3))(int ncid, int varid, ArgKind($2)BufArgs($1,$3), int *reqid) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(APINAME($1,$2,$3)); @@ -397,7 +397,7 @@ DARSHAN_FORWARD_DECL(APINAME($1,n,$2), int, (int ncid, int varid, int num, MPI_O int DARSHAN_DECL(APINAME($1,n,$2))(int ncid, int varid, int num, MPI_Offset* const *starts, MPI_Offset* const *counts, BufArgs($1,$2), int *reqid) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(APINAME($1,n,$2)); @@ -464,7 +464,7 @@ DARSHAN_FORWARD_DECL(ncmpi_create, int, (MPI_Comm comm, const char *path, int cm int DARSHAN_DECL(ncmpi_create)(MPI_Comm comm, const char *path, int cmode, MPI_Info info, int *ncidp) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(ncmpi_create); @@ -495,7 +495,7 @@ DARSHAN_FORWARD_DECL(ncmpi_open, int, (MPI_Comm comm, const char *path, int omod int DARSHAN_DECL(ncmpi_open)(MPI_Comm comm, const char *path, int omode, MPI_Info info, int *ncidp) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(ncmpi_open); @@ -525,7 +525,7 @@ DARSHAN_FORWARD_DECL(ncmpi_close, int, (int ncid)); int DARSHAN_DECL(ncmpi_close)(int ncid) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MPI_Offset put_size, get_size; struct pnetcdf_file_record_ref *rec_ref; @@ -574,7 +574,7 @@ DARSHAN_FORWARD_DECL(ncmpi_enddef, int, (int ncid)); int DARSHAN_DECL(ncmpi_enddef)(int ncid) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(ncmpi_enddef); @@ -601,7 +601,7 @@ DARSHAN_FORWARD_DECL(ncmpi_redef, int, (int ncid)); int DARSHAN_DECL(ncmpi_redef)(int ncid) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(ncmpi_redef); @@ -630,7 +630,7 @@ DARSHAN_FORWARD_DECL(ncmpi_wait, int, (int ncid, int num, int array_of_requests[ int DARSHAN_DECL(ncmpi_wait)(int ncid, int num, int array_of_requests[], int array_of_statuses[]) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(ncmpi_wait); @@ -666,7 +666,7 @@ DARSHAN_FORWARD_DECL(ncmpi_wait_all, int, (int ncid, int num, int array_of_reque int DARSHAN_DECL(ncmpi_wait_all)(int ncid, int num, int array_of_requests[], int array_of_statuses[]) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(ncmpi_wait_all); @@ -701,7 +701,7 @@ DARSHAN_FORWARD_DECL(ncmpi_sync, int, (int ncid)); int DARSHAN_DECL(ncmpi_sync)(int ncid) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(ncmpi_sync); @@ -794,7 +794,7 @@ DARSHAN_FORWARD_DECL(ncmpi_def_var, int, (int ncid, const char *name, nc_type xt int DARSHAN_DECL(ncmpi_def_var)(int ncid, const char *name, nc_type xtype, int ndims, const int dimids[], int *varidp) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(ncmpi_def_var); @@ -815,7 +815,7 @@ DARSHAN_FORWARD_DECL(ncmpi_inq_varid, int, (int ncid, const char *name, int *var int DARSHAN_DECL(ncmpi_inq_varid)(int ncid, const char *name, int *varidp) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(ncmpi_inq_varid); diff --git a/darshan-runtime/lib/darshan-posix.c b/darshan-runtime/lib/darshan-posix.c index 59b455282..21bcbd762 100644 --- a/darshan-runtime/lib/darshan-posix.c +++ b/darshan-runtime/lib/darshan-posix.c @@ -446,7 +446,7 @@ static int darshan_mem_alignment = 1; int DARSHAN_DECL(open)(const char *path, int flags, ...) { int mode = 0; - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(open); @@ -478,7 +478,7 @@ int DARSHAN_DECL(open)(const char *path, int flags, ...) int DARSHAN_DECL(__open_2)(const char *path, int oflag) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(__open_2); @@ -497,7 +497,7 @@ int DARSHAN_DECL(__open_2)(const char *path, int oflag) int DARSHAN_DECL(open64)(const char *path, int flags, ...) { int mode = 0; - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(open64); @@ -530,7 +530,7 @@ int DARSHAN_DECL(open64)(const char *path, int flags, ...) int DARSHAN_DECL(openat)(int dirfd, const char *pathname, int flags, ...) { int mode = 0; - int ret; + int ret, __darshan_disabled; double tm1, tm2; struct posix_file_record_ref *rec_ref; char tmp_path[__DARSHAN_PATH_MAX] = {0}; @@ -607,7 +607,7 @@ int DARSHAN_DECL(openat)(int dirfd, const char *pathname, int flags, ...) int DARSHAN_DECL(openat64)(int dirfd, const char *pathname, int flags, ...) { int mode = 0; - int ret; + int ret, __darshan_disabled; double tm1, tm2; struct posix_file_record_ref *rec_ref; char tmp_path[__DARSHAN_PATH_MAX] = {0}; @@ -683,7 +683,7 @@ int DARSHAN_DECL(openat64)(int dirfd, const char *pathname, int flags, ...) int DARSHAN_DECL(creat)(const char* path, mode_t mode) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(creat); @@ -701,7 +701,7 @@ int DARSHAN_DECL(creat)(const char* path, mode_t mode) int DARSHAN_DECL(creat64)(const char* path, mode_t mode) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(creat64); @@ -719,7 +719,7 @@ int DARSHAN_DECL(creat64)(const char* path, mode_t mode) int DARSHAN_DECL(dup)(int oldfd) { - int ret; + int ret, __darshan_disabled; struct posix_file_record_ref *rec_ref; double tm1, tm2; @@ -743,7 +743,7 @@ int DARSHAN_DECL(dup)(int oldfd) int DARSHAN_DECL(dup2)(int oldfd, int newfd) { - int ret; + int ret, __darshan_disabled; struct posix_file_record_ref *rec_ref; double tm1, tm2; @@ -767,7 +767,7 @@ int DARSHAN_DECL(dup2)(int oldfd, int newfd) int DARSHAN_DECL(dup3)(int oldfd, int newfd, int flags) { - int ret; + int ret, __darshan_disabled; struct posix_file_record_ref *rec_ref; double tm1, tm2; @@ -804,7 +804,7 @@ int DARSHAN_DECL(dup3)(int oldfd, int newfd, int flags) int DARSHAN_DECL(fcntl)(int fd, int cmd, ...) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; va_list arg; void *next; @@ -837,7 +837,7 @@ int DARSHAN_DECL(fcntl)(int fd, int cmd, ...) int DARSHAN_DECL(fcntl64)(int fd, int cmd, ...) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; va_list arg; void *next; @@ -870,7 +870,7 @@ int DARSHAN_DECL(fcntl64)(int fd, int cmd, ...) } int DARSHAN_DECL(fileno)(FILE *stream) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; darshan_record_id rec_id; struct posix_file_record_ref *rec_ref; @@ -903,7 +903,7 @@ int DARSHAN_DECL(fileno)(FILE *stream) int DARSHAN_DECL(mkstemp)(char* template) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(mkstemp); @@ -921,7 +921,7 @@ int DARSHAN_DECL(mkstemp)(char* template) int DARSHAN_DECL(mkostemp)(char* template, int flags) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(mkostemp); @@ -939,7 +939,7 @@ int DARSHAN_DECL(mkostemp)(char* template, int flags) int DARSHAN_DECL(mkstemps)(char* template, int suffixlen) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(mkstemps); @@ -957,7 +957,7 @@ int DARSHAN_DECL(mkstemps)(char* template, int suffixlen) int DARSHAN_DECL(mkostemps)(char* template, int suffixlen, int flags) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(mkostemps); @@ -977,6 +977,7 @@ ssize_t DARSHAN_DECL(read)(int fd, void *buf, size_t count) { ssize_t ret; int aligned_flag = 0; + int __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(read); @@ -998,6 +999,7 @@ ssize_t DARSHAN_DECL(write)(int fd, const void *buf, size_t count) { ssize_t ret; int aligned_flag = 0; + int __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(write); @@ -1019,6 +1021,7 @@ ssize_t DARSHAN_DECL(pread)(int fd, void *buf, size_t count, off_t offset) { ssize_t ret; int aligned_flag = 0; + int __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(pread); @@ -1040,6 +1043,7 @@ ssize_t DARSHAN_DECL(pwrite)(int fd, const void *buf, size_t count, off_t offset { ssize_t ret; int aligned_flag = 0; + int __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(pwrite); @@ -1061,6 +1065,7 @@ ssize_t DARSHAN_DECL(pread64)(int fd, void *buf, size_t count, off64_t offset) { ssize_t ret; int aligned_flag = 0; + int __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(pread64); @@ -1082,6 +1087,7 @@ ssize_t DARSHAN_DECL(pwrite64)(int fd, const void *buf, size_t count, off64_t of { ssize_t ret; int aligned_flag = 0; + int __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(pwrite64); @@ -1103,6 +1109,7 @@ ssize_t DARSHAN_DECL(readv)(int fd, const struct iovec *iov, int iovcnt) { ssize_t ret; int aligned_flag = 1; + int __darshan_disabled; int i; double tm1, tm2; @@ -1130,6 +1137,7 @@ ssize_t DARSHAN_DECL(preadv)(int fd, const struct iovec *iov, int iovcnt, off_t { ssize_t ret; int aligned_flag = 1; + int __darshan_disabled; int i; double tm1, tm2; @@ -1156,6 +1164,7 @@ ssize_t DARSHAN_DECL(preadv64)(int fd, const struct iovec *iov, int iovcnt, off6 { ssize_t ret; int aligned_flag = 1; + int __darshan_disabled; int i; double tm1, tm2; @@ -1185,6 +1194,7 @@ ssize_t DARSHAN_DECL(preadv2)(int fd, const struct iovec *iov, int iovcnt, off_t { ssize_t ret; int aligned_flag = 1; + int __darshan_disabled; int i; double tm1, tm2; @@ -1211,6 +1221,7 @@ ssize_t DARSHAN_DECL(preadv64v2)(int fd, const struct iovec *iov, int iovcnt, of { ssize_t ret; int aligned_flag = 1; + int __darshan_disabled; int i; double tm1, tm2; @@ -1238,6 +1249,7 @@ ssize_t DARSHAN_DECL(writev)(int fd, const struct iovec *iov, int iovcnt) { ssize_t ret; int aligned_flag = 1; + int __darshan_disabled; int i; double tm1, tm2; @@ -1265,6 +1277,7 @@ ssize_t DARSHAN_DECL(pwritev)(int fd, const struct iovec *iov, int iovcnt, off_t { ssize_t ret; int aligned_flag = 1; + int __darshan_disabled; int i; double tm1, tm2; @@ -1291,6 +1304,7 @@ ssize_t DARSHAN_DECL(pwritev64)(int fd, const struct iovec *iov, int iovcnt, off { ssize_t ret; int aligned_flag = 1; + int __darshan_disabled; int i; double tm1, tm2; @@ -1319,6 +1333,7 @@ ssize_t DARSHAN_DECL(pwritev2)(int fd, const struct iovec *iov, int iovcnt, off_ { ssize_t ret; int aligned_flag = 1; + int __darshan_disabled; int i; double tm1, tm2; @@ -1345,6 +1360,7 @@ ssize_t DARSHAN_DECL(pwritev64v2)(int fd, const struct iovec *iov, int iovcnt, o { ssize_t ret; int aligned_flag = 1; + int __darshan_disabled; int i; double tm1, tm2; @@ -1374,6 +1390,7 @@ off_t DARSHAN_DECL(lseek)(int fd, off_t offset, int whence) off_t ret; struct posix_file_record_ref *rec_ref; double tm1, tm2; + int __darshan_disabled; MAP_OR_FAIL(lseek); @@ -1404,6 +1421,7 @@ off64_t DARSHAN_DECL(lseek64)(int fd, off64_t offset, int whence) off_t ret; struct posix_file_record_ref *rec_ref; double tm1, tm2; + int __darshan_disabled; MAP_OR_FAIL(lseek64); @@ -1431,7 +1449,7 @@ off64_t DARSHAN_DECL(lseek64)(int fd, off64_t offset, int whence) int DARSHAN_DECL(__xstat)(int vers, const char *path, struct stat *buf) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(__xstat); @@ -1452,7 +1470,7 @@ int DARSHAN_DECL(__xstat)(int vers, const char *path, struct stat *buf) int DARSHAN_DECL(__xstat64)(int vers, const char *path, struct stat64 *buf) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(__xstat64); @@ -1473,7 +1491,7 @@ int DARSHAN_DECL(__xstat64)(int vers, const char *path, struct stat64 *buf) int DARSHAN_DECL(__lxstat)(int vers, const char *path, struct stat *buf) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(__lxstat); @@ -1494,7 +1512,7 @@ int DARSHAN_DECL(__lxstat)(int vers, const char *path, struct stat *buf) int DARSHAN_DECL(__lxstat64)(int vers, const char *path, struct stat64 *buf) { - int ret; + int ret, __darshan_disabled; double tm1, tm2; MAP_OR_FAIL(__lxstat64); @@ -1515,7 +1533,7 @@ int DARSHAN_DECL(__lxstat64)(int vers, const char *path, struct stat64 *buf) int DARSHAN_DECL(__fxstat)(int vers, int fd, struct stat *buf) { - int ret; + int ret, __darshan_disabled; struct posix_file_record_ref *rec_ref; double tm1, tm2; @@ -1541,7 +1559,7 @@ int DARSHAN_DECL(__fxstat)(int vers, int fd, struct stat *buf) int DARSHAN_DECL(__fxstat64)(int vers, int fd, struct stat64 *buf) { - int ret; + int ret, __darshan_disabled; struct posix_file_record_ref *rec_ref; double tm1, tm2; @@ -1571,6 +1589,7 @@ void* DARSHAN_DECL(mmap)(void *addr, size_t length, int prot, int flags, { void* ret; struct posix_file_record_ref *rec_ref; + int __darshan_disabled; MAP_OR_FAIL(mmap); (void)__darshan_disabled; @@ -1605,6 +1624,7 @@ void* DARSHAN_DECL(mmap64)(void *addr, size_t length, int prot, int flags, { void* ret; struct posix_file_record_ref *rec_ref; + int __darshan_disabled; MAP_OR_FAIL(mmap64); @@ -1634,7 +1654,7 @@ void* DARSHAN_DECL(mmap64)(void *addr, size_t length, int prot, int flags, int DARSHAN_DECL(fsync)(int fd) { - int ret; + int ret, __darshan_disabled; struct posix_file_record_ref *rec_ref; double tm1, tm2; @@ -1663,7 +1683,7 @@ int DARSHAN_DECL(fsync)(int fd) int DARSHAN_DECL(fdatasync)(int fd) { - int ret; + int ret, __darshan_disabled; struct posix_file_record_ref *rec_ref; double tm1, tm2; @@ -1692,7 +1712,7 @@ int DARSHAN_DECL(fdatasync)(int fd) int DARSHAN_DECL(close)(int fd) { - int ret; + int ret, __darshan_disabled; struct posix_file_record_ref *rec_ref; double tm1, tm2; @@ -1748,7 +1768,7 @@ int DARSHAN_DECL(close)(int fd) int DARSHAN_DECL(aio_read)(struct aiocb *aiocbp) { - int ret; + int ret, __darshan_disabled; MAP_OR_FAIL(aio_read); @@ -1765,7 +1785,7 @@ int DARSHAN_DECL(aio_read)(struct aiocb *aiocbp) int DARSHAN_DECL(aio_write)(struct aiocb *aiocbp) { - int ret; + int ret, __darshan_disabled; MAP_OR_FAIL(aio_write); @@ -1782,7 +1802,7 @@ int DARSHAN_DECL(aio_write)(struct aiocb *aiocbp) int DARSHAN_DECL(aio_read64)(struct aiocb64 *aiocbp) { - int ret; + int ret, __darshan_disabled; MAP_OR_FAIL(aio_read64); @@ -1799,7 +1819,7 @@ int DARSHAN_DECL(aio_read64)(struct aiocb64 *aiocbp) int DARSHAN_DECL(aio_write64)(struct aiocb64 *aiocbp) { - int ret; + int ret, __darshan_disabled; MAP_OR_FAIL(aio_write64); @@ -1820,6 +1840,7 @@ ssize_t DARSHAN_DECL(aio_return)(struct aiocb *aiocbp) double tm2; struct posix_aio_tracker *tmp; int aligned_flag = 0; + int __darshan_disabled; MAP_OR_FAIL(aio_return); @@ -1857,6 +1878,7 @@ ssize_t DARSHAN_DECL(aio_return64)(struct aiocb64 *aiocbp) double tm2; struct posix_aio_tracker *tmp; int aligned_flag = 0; + int __darshan_disabled; MAP_OR_FAIL(aio_return64); @@ -1891,7 +1913,7 @@ ssize_t DARSHAN_DECL(aio_return64)(struct aiocb64 *aiocbp) int DARSHAN_DECL(lio_listio)(int mode, struct aiocb *const aiocb_list[], int nitems, struct sigevent *sevp) { - int ret; + int ret, __darshan_disabled; int i; MAP_OR_FAIL(lio_listio); @@ -1913,7 +1935,7 @@ int DARSHAN_DECL(lio_listio)(int mode, struct aiocb *const aiocb_list[], int DARSHAN_DECL(lio_listio64)(int mode, struct aiocb64 *const aiocb_list[], int nitems, struct sigevent *sevp) { - int ret; + int ret, __darshan_disabled; int i; MAP_OR_FAIL(lio_listio64); @@ -1940,6 +1962,7 @@ int DARSHAN_DECL(rename)(const char *oldpath, const char *newpath) darshan_record_id old_rec_id, new_rec_id; struct posix_file_record_ref *old_rec_ref, *new_rec_ref; int disabled = 0; + int __darshan_disabled; /* This is a special case to avoid attempting to instrument final rename * performed by darshan itself when finalizing diff --git a/darshan-runtime/lib/darshan-stdio.c b/darshan-runtime/lib/darshan-stdio.c index e3c959ccf..02cfa108e 100644 --- a/darshan-runtime/lib/darshan-stdio.c +++ b/darshan-runtime/lib/darshan-stdio.c @@ -316,6 +316,7 @@ FILE* DARSHAN_DECL(fopen)(const char *path, const char *mode) { FILE* ret; double tm1, tm2; + int __darshan_disabled; MAP_OR_FAIL(fopen); @@ -334,6 +335,7 @@ FILE* DARSHAN_DECL(fopen64)(const char *path, const char *mode) { FILE* ret; double tm1, tm2; + int __darshan_disabled; MAP_OR_FAIL(fopen64); @@ -354,6 +356,7 @@ FILE* DARSHAN_DECL(fdopen)(int fd, const char *mode) double tm1, tm2; darshan_record_id rec_id; struct stdio_file_record_ref *rec_ref; + int __darshan_disabled; MAP_OR_FAIL(fdopen); @@ -386,6 +389,7 @@ FILE* DARSHAN_DECL(freopen)(const char *path, const char *mode, FILE *stream) { FILE* ret; double tm1, tm2; + int __darshan_disabled; MAP_OR_FAIL(freopen); @@ -404,6 +408,7 @@ FILE* DARSHAN_DECL(freopen64)(const char *path, const char *mode, FILE *stream) { FILE* ret; double tm1, tm2; + int __darshan_disabled; MAP_OR_FAIL(freopen64); @@ -423,6 +428,7 @@ int DARSHAN_DECL(fflush)(FILE *fp) { double tm1, tm2; int ret; + int __darshan_disabled; MAP_OR_FAIL(fflush); @@ -443,6 +449,7 @@ int DARSHAN_DECL(fclose)(FILE *fp) double tm1, tm2; int ret; struct stdio_file_record_ref *rec_ref; + int __darshan_disabled; MAP_OR_FAIL(fclose); @@ -497,6 +504,7 @@ size_t DARSHAN_DECL(fwrite)(const void *ptr, size_t size, size_t nmemb, FILE *st { size_t ret; double tm1, tm2; + int __darshan_disabled; MAP_OR_FAIL(fwrite); @@ -517,6 +525,7 @@ int DARSHAN_DECL(fputc)(int c, FILE *stream) { int ret; double tm1, tm2; + int __darshan_disabled; MAP_OR_FAIL(fputc); @@ -536,6 +545,7 @@ int DARSHAN_DECL(putw)(int w, FILE *stream) { int ret; double tm1, tm2; + int __darshan_disabled; MAP_OR_FAIL(putw); @@ -557,6 +567,7 @@ int DARSHAN_DECL(fputs)(const char *s, FILE *stream) { int ret; double tm1, tm2; + int __darshan_disabled; MAP_OR_FAIL(fputs); @@ -576,6 +587,7 @@ int DARSHAN_DECL(vprintf)(const char *format, va_list ap) { int ret; double tm1, tm2; + int __darshan_disabled; MAP_OR_FAIL(vprintf); @@ -595,6 +607,7 @@ int DARSHAN_DECL(vfprintf)(FILE *stream, const char *format, va_list ap) { int ret; double tm1, tm2; + int __darshan_disabled; MAP_OR_FAIL(vfprintf); @@ -616,6 +629,7 @@ int DARSHAN_DECL(printf)(const char *format, ...) int ret; double tm1, tm2; va_list ap; + int __darshan_disabled; MAP_OR_FAIL(vprintf); @@ -641,6 +655,7 @@ int DARSHAN_DECL(fprintf)(FILE *stream, const char *format, ...) int ret; double tm1, tm2; va_list ap; + int __darshan_disabled; MAP_OR_FAIL(vfprintf); @@ -665,6 +680,7 @@ size_t DARSHAN_DECL(fread)(void *ptr, size_t size, size_t nmemb, FILE *stream) { size_t ret; double tm1, tm2; + int __darshan_disabled; MAP_OR_FAIL(fread); @@ -684,6 +700,7 @@ int DARSHAN_DECL(fgetc)(FILE *stream) { int ret; double tm1, tm2; + int __darshan_disabled; MAP_OR_FAIL(fgetc); @@ -704,6 +721,7 @@ int DARSHAN_DECL(_IO_getc)(FILE *stream) { int ret; double tm1, tm2; + int __darshan_disabled; MAP_OR_FAIL(_IO_getc); @@ -724,6 +742,7 @@ int DARSHAN_DECL(_IO_putc)(int c, FILE *stream) { int ret; double tm1, tm2; + int __darshan_disabled; MAP_OR_FAIL(_IO_putc); @@ -743,6 +762,7 @@ int DARSHAN_DECL(getw)(FILE *stream) { int ret; double tm1, tm2; + int __darshan_disabled; MAP_OR_FAIL(getw); @@ -768,6 +788,7 @@ int DARSHAN_DECL(__isoc99_fscanf)(FILE *stream, const char *format, ...) double tm1, tm2; va_list ap; long start_off, end_off; + int __darshan_disabled; MAP_OR_FAIL(vfscanf); @@ -796,6 +817,7 @@ int DARSHAN_DECL(fscanf)(FILE *stream, const char *format, ...) double tm1, tm2; va_list ap; long start_off, end_off; + int __darshan_disabled; MAP_OR_FAIL(vfscanf); @@ -824,6 +846,7 @@ int DARSHAN_DECL(vfscanf)(FILE *stream, const char *format, va_list ap) int ret; double tm1, tm2; long start_off, end_off; + int __darshan_disabled; MAP_OR_FAIL(vfscanf); @@ -846,6 +869,7 @@ char* DARSHAN_DECL(fgets)(char *s, int size, FILE *stream) { char *ret; double tm1, tm2; + int __darshan_disabled; MAP_OR_FAIL(fgets); @@ -866,6 +890,7 @@ void DARSHAN_DECL(rewind)(FILE *stream) { double tm1, tm2; struct stdio_file_record_ref *rec_ref; + int __darshan_disabled; MAP_OR_FAIL(rewind); @@ -907,6 +932,7 @@ int DARSHAN_DECL(fseek)(FILE *stream, long offset, int whence) int ret; struct stdio_file_record_ref *rec_ref; double tm1, tm2; + int __darshan_disabled; MAP_OR_FAIL(fseek); @@ -937,6 +963,7 @@ int DARSHAN_DECL(fseeko)(FILE *stream, off_t offset, int whence) int ret; struct stdio_file_record_ref *rec_ref; double tm1, tm2; + int __darshan_disabled; MAP_OR_FAIL(fseeko); @@ -967,6 +994,7 @@ int DARSHAN_DECL(fseeko64)(FILE *stream, off64_t offset, int whence) int ret; struct stdio_file_record_ref *rec_ref; double tm1, tm2; + int __darshan_disabled; MAP_OR_FAIL(fseeko64); @@ -997,6 +1025,7 @@ int DARSHAN_DECL(fsetpos)(FILE *stream, const fpos_t *pos) int ret; struct stdio_file_record_ref *rec_ref; double tm1, tm2; + int __darshan_disabled; MAP_OR_FAIL(fsetpos); @@ -1027,6 +1056,7 @@ int DARSHAN_DECL(fsetpos64)(FILE *stream, const fpos64_t *pos) int ret; struct stdio_file_record_ref *rec_ref; double tm1, tm2; + int __darshan_disabled; MAP_OR_FAIL(fsetpos64); @@ -1059,7 +1089,7 @@ int DARSHAN_DECL(fsetpos64)(FILE *stream, const fpos64_t *pos) /* initialize internal STDIO module data structures and register with darshan-core */ static void stdio_runtime_initialize() { - int ret; + int ret, __darshan_disabled; size_t stdio_rec_count; darshan_module_funcs mod_funcs = { #ifdef HAVE_MPI diff --git a/darshan-runtime/lib/darshan.h b/darshan-runtime/lib/darshan.h index 7e3692c80..84b0a35b8 100644 --- a/darshan-runtime/lib/darshan.h +++ b/darshan-runtime/lib/darshan.h @@ -205,7 +205,7 @@ extern pthread_mutex_t __darshan_core_mutex; exit(1); \ } \ } \ - int __darshan_disabled = darshan_core_disabled_instrumentation(); + __darshan_disabled = darshan_core_disabled_instrumentation(); #else #define DARSHAN_FORWARD_DECL(__name,__ret,__args) \ @@ -224,7 +224,7 @@ extern pthread_mutex_t __darshan_core_mutex; __ret __wrap_ ## __func __args __attribute__ ((alias ("__wrap_" #__fcall))); #define MAP_OR_FAIL(__func) \ - int __darshan_disabled = darshan_core_disabled_instrumentation() + __darshan_disabled = darshan_core_disabled_instrumentation() #endif diff --git a/darshan-util/tests/unit-tests/munit/munit.c b/darshan-util/tests/unit-tests/munit/munit.c index 00ede07ca..b5db721b5 100644 --- a/darshan-util/tests/unit-tests/munit/munit.c +++ b/darshan-util/tests/unit-tests/munit/munit.c @@ -1296,7 +1296,6 @@ munit_test_runner_run_test_with_params(MunitTestRunner* runner, const MunitTest* #if !defined(MUNIT_NO_FORK) int pipefd[2]; pid_t fork_pid; - int orig_stderr; ssize_t bytes_written = 0; ssize_t write_res; ssize_t bytes_read = 0; @@ -1352,7 +1351,7 @@ munit_test_runner_run_test_with_params(MunitTestRunner* runner, const MunitTest* if (fork_pid == 0) { close(pipefd[0]); - orig_stderr = munit_replace_stderr(stderr_buf); + int orig_stderr = munit_replace_stderr(stderr_buf); munit_test_runner_exec(runner, test, params, &report); /* Note that we don't restore stderr. This is so we can buffer diff --git a/modules/Makefile.am b/modules/Makefile.am index 56ee660e5..f992f73ec 100644 --- a/modules/Makefile.am +++ b/modules/Makefile.am @@ -4,20 +4,21 @@ # @configure_input@ apmpi_c_src = $(srcdir)/autoperf/apmpi/lib/darshan-apmpi.c -apmpi_c_saved = $(srcdir)/autoperf/apmpi/lib/saved_darshan-apmpi.c -apmpi_c_patch = $(srcdir)/apmpi.patch +apmpi_c_patched = $(srcdir)/patched_darshan-apmpi.c +apmpi_c_saved = $(srcdir)/saved_darshan-apmpi.c +apmpi_c_orig = $(srcdir)/orig_darshan-apmpi.c # Rule to apply the patch -$(apmpi_c_saved): $(apmpi_c_src) $(apmpi_c_patch) +$(apmpi_c_saved): $(apmpi_c_src) $(apmpi_c_patched) cp -f $(apmpi_c_src) $(apmpi_c_saved) - patch -f -p0 $(apmpi_c_src) < $(apmpi_c_patch) - touch $@ + cp -f $(apmpi_c_patched) $(apmpi_c_src) + touch $(apmpi_c_saved) BUILT_SOURCES = $(apmpi_c_saved) -EXTRA_DIST = apmpi.patch +EXTRA_DIST = patched_darshan-apmpi.c orig_darshan-apmpi.c -clean: $(apmpi_c_saved) - cp -f $(apmpi_c_saved) $(apmpi_c_src) - rm -f $(apmpi_c_saved) $(apmpi_c_src).* +clean: + rm -f $(apmpi_c_saved) + cp -f $(apmpi_c_orig) $(apmpi_c_src) diff --git a/modules/apmpi.patch b/modules/apmpi.patch index fb3e09180..1b64115ad 100644 --- a/modules/apmpi.patch +++ b/modules/apmpi.patch @@ -1,6 +1,15 @@ --- darshan-apmpi.c.orig 2025-10-03 14:11:57.395296967 -0500 -+++ darshan-apmpi.c 2025-10-03 14:22:12.684565527 -0500 -@@ -29,14 +29,16 @@ ++++ darshan-apmpi.c 2025-10-04 12:03:16.352785800 -0500 +@@ -19,6 +19,8 @@ + #include "darshan-dynamic.h" + #include "darshan-apmpi-log-format.h" + ++static int __darshan_disabled; ++ + typedef long long ap_bytes_t; + #define MAX(x,y) ((x>y)?x:y) + #define MIN(x,y) ((x==0.0)?y:((x +#include +#include +#include +#include + +#include "uthash.h" +#include "darshan.h" +#include "darshan-dynamic.h" +#include "darshan-apmpi-log-format.h" + +typedef long long ap_bytes_t; +#define MAX(x,y) ((x>y)?x:y) +#define MIN(x,y) ((x==0.0)?y:((x 0) && (TYPE != MPI_DATATYPE_NULL)) { \ + PMPI_Type_size(TYPE, &tsize); \ + bytes = (COUNT) * tsize; \ + } + +#define BYTECOUNTND(TYPE, COUNT) \ + int tsize2; \ + bytes = 0; \ + if((COUNT > 0) && (TYPE != MPI_DATATYPE_NULL)) { \ + PMPI_Type_size(TYPE, &tsize2); \ + bytes = (COUNT) * tsize2; \ + } + + + +/* increment histogram bucket depending on the given __value + * + * NOTE: This macro can be used to build a histogram of access + * sizes, offsets, etc. It assumes a 6-bucket histogram, with + * __bucket_base_p pointing to the first counter in the sequence + * of buckets (i.e., the smallest bucket). The size ranges of each + * bucket are: + * * 0 - 256 bytes + * * 256 - 1 KiB + * * 1 KiB - 8 KiB + * * 32 KiB - 256 KiB + * * 256 KiB - 1 MiB + * * 1 MiB + + */ +#define DARSHAN_MSG_BUCKET_INC(__bucket_base_p, __value) do {\ + if(__value < 257) \ + *(__bucket_base_p) += 1; \ + else if(__value < 1025) \ + *(__bucket_base_p + 1) += 1; \ + else if(__value < 8193) \ + *(__bucket_base_p + 2) += 1; \ + else if(__value < 262145) \ + *(__bucket_base_p + 3) += 1; \ + else if(__value < 1048577) \ + *(__bucket_base_p + 4) += 1; \ + else \ + *(__bucket_base_p + 5) += 1; \ +} while(0) + + +DARSHAN_FORWARD_DECL(PMPI_Send, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Ssend, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Rsend, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Bsend, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Recv, int, (void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status)); +DARSHAN_FORWARD_DECL(PMPI_Sendrecv, int, (const void *sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int sendtag, + void *recvbuf, int recvcount, MPI_Datatype recvtype, + int source, int recvtag, MPI_Comm comm, MPI_Status * status)); +DARSHAN_FORWARD_DECL(PMPI_Sendrecv_replace, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int sendtag, + int source, int recvtag, MPI_Comm comm, MPI_Status * status)); +DARSHAN_FORWARD_DECL(PMPI_Isend, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request)); +DARSHAN_FORWARD_DECL(PMPI_Issend, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request)); +DARSHAN_FORWARD_DECL(PMPI_Irsend, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request)); +DARSHAN_FORWARD_DECL(PMPI_Ibsend, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request)); +DARSHAN_FORWARD_DECL(PMPI_Irecv, int, (void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Request *request)); +/* +DARSHAN_FORWARD_DECL(PMPI_Isendrecv, int, (const void *sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int sendtag, void *recvbuf, +int recvcount, MPI_Datatype recvtype, int source, int recvtag, MPI_Comm comm, MPI_Request *request)); +DARSHAN_FORWARD_DECL(PMPI_Isendrecv_replace, int, (void *buf, int count, MPI_Datatype datatype, int dest, int sendtag, int source, int recvtag, MPI_Comm comm, MPI_Request *request)); +*/ +DARSHAN_FORWARD_DECL(PMPI_Probe, int, (int source, int tag, MPI_Comm comm, MPI_Status * status)); +DARSHAN_FORWARD_DECL(PMPI_Iprobe, int, (int source, int tag, MPI_Comm comm, int *flag, MPI_Status * status)); +DARSHAN_FORWARD_DECL(PMPI_Test, int, (MPI_Request *request, int *flag, MPI_Status *status)); +DARSHAN_FORWARD_DECL(PMPI_Testany, int, (int count, MPI_Request array_of_requests[], int *indx, + int *flag, MPI_Status *status)); +DARSHAN_FORWARD_DECL(PMPI_Testall, int, (int count, MPI_Request array_of_requests[], int *flag, + MPI_Status array_of_statuses[])); +DARSHAN_FORWARD_DECL(PMPI_Testsome, int, (int incount, MPI_Request array_of_requests[], int *outcount, + int array_of_indices[], MPI_Status array_of_statuses[])); +DARSHAN_FORWARD_DECL(PMPI_Wait, int, (MPI_Request * request, MPI_Status * status)); +DARSHAN_FORWARD_DECL(PMPI_Waitany, int, (int count, MPI_Request array_of_requests[], int *indx, MPI_Status * status)); +DARSHAN_FORWARD_DECL(PMPI_Waitall, int, (int count, MPI_Request array_of_requests[], + MPI_Status array_of_statuses[])); +DARSHAN_FORWARD_DECL(PMPI_Waitsome, int, (int incount, MPI_Request array_of_requests[], + int *outcount, int array_of_indices[], MPI_Status array_of_statuses[])); +DARSHAN_FORWARD_DECL(PMPI_Put, int, (const void *origin_addr, int origin_count, MPI_Datatype + origin_datatype, int target_rank, MPI_Aint target_disp, + int target_count, MPI_Datatype target_datatype, MPI_Win win)); +DARSHAN_FORWARD_DECL(PMPI_Get, int, (void *origin_addr, int origin_count, MPI_Datatype + origin_datatype, int target_rank, MPI_Aint target_disp, + int target_count, MPI_Datatype target_datatype, MPI_Win win)); +DARSHAN_FORWARD_DECL(PMPI_Barrier, int, (MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Bcast, int, (void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Reduce, int, (const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Allreduce, int, (const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Alltoall, int, (const void *sendbuf, int sendcount, MPI_Datatype sendtype, + void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Alltoallv, int, (const void *sendbuf, const int *sendcounts, const int *sdispls, + MPI_Datatype sendtype, void *recvbuf, const int *recvcounts, const int *rdispls, + MPI_Datatype recvtype, MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Alltoallw, int, (const void *sendbuf, const int sendcounts[], const int sdispls[], + const MPI_Datatype sendtypes[], void *recvbuf, const int recvcounts[], const int rdispls[], + const MPI_Datatype recvtypes[], MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Allgather, int, (const void *sendbuf, int sendcount, MPI_Datatype sendtype, + void *recvbuf, int recvcount, MPI_Datatype recvtype, + MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Allgatherv, int, ()); +DARSHAN_FORWARD_DECL(PMPI_Gather , int, (const void *sendbuf, int sendcount, MPI_Datatype sendtype, + void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Gatherv , int, (const void *sendbuf, int sendcount, MPI_Datatype sendtype, + void *recvbuf, const int *recvcounts, const int *displs, + MPI_Datatype recvtype, int root, MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Scatter, int, (const void *sendbuf, int sendcount, MPI_Datatype sendtype, + void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, + MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Scatterv, int, (const void *sendbuf, const int *sendcounts, const int *displs, + MPI_Datatype sendtype, void *recvbuf, int recvcount, + MPI_Datatype recvtype, + int root, MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Reduce_scatter, int, (const void *sendbuf, void *recvbuf, const int recvcounts[], + MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Scan, int, (const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, + MPI_Op op, MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Exscan, int, (const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, + MPI_Op op, MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Ibarrier, int, (MPI_Comm comm, MPI_Request * request)); +DARSHAN_FORWARD_DECL(PMPI_Ibcast, int, (void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm, MPI_Request * request)); +DARSHAN_FORWARD_DECL(PMPI_Ireduce, int, (const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm, MPI_Request * request)); +DARSHAN_FORWARD_DECL(PMPI_Iallreduce, int, (const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, MPI_Request * request)); +DARSHAN_FORWARD_DECL(PMPI_Ialltoall, int, (const void *sendbuf, int sendcount, MPI_Datatype sendtype, + void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm, MPI_Request * request)); +DARSHAN_FORWARD_DECL(PMPI_Ialltoallv, int, (const void *sendbuf, const int *sendcounts, const int *sdispls, + MPI_Datatype sendtype, void *recvbuf, const int *recvcounts, const int *rdispls, + MPI_Datatype recvtype, MPI_Comm comm, MPI_Request * request)); +DARSHAN_FORWARD_DECL(PMPI_Ialltoallw, int, (const void *sendbuf, const int sendcounts[], const int sdispls[], + const MPI_Datatype sendtypes[], void *recvbuf, const int recvcounts[], const int rdispls[], + const MPI_Datatype recvtypes[], MPI_Comm comm, MPI_Request * request)); +DARSHAN_FORWARD_DECL(PMPI_Iallgather, int, (const void *sendbuf, int sendcount, MPI_Datatype sendtype, + void *recvbuf, int recvcount, MPI_Datatype recvtype, + MPI_Comm comm, MPI_Request * request)); +DARSHAN_FORWARD_DECL(PMPI_Iallgatherv, int, ()); +DARSHAN_FORWARD_DECL(PMPI_Igather , int, (const void *sendbuf, int sendcount, MPI_Datatype sendtype, + void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm, MPI_Request * request)); +DARSHAN_FORWARD_DECL(PMPI_Igatherv , int, (const void *sendbuf, int sendcount, MPI_Datatype sendtype, + void *recvbuf, const int *recvcounts, const int *displs, + MPI_Datatype recvtype, int root, MPI_Comm comm, MPI_Request * request)); +DARSHAN_FORWARD_DECL(PMPI_Iscatter, int, (const void *sendbuf, int sendcount, MPI_Datatype sendtype, + void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, + MPI_Comm comm, MPI_Request * request)); +DARSHAN_FORWARD_DECL(PMPI_Iscatterv, int, (const void *sendbuf, const int *sendcounts, const int *displs, + MPI_Datatype sendtype, void *recvbuf, int recvcount, + MPI_Datatype recvtype, + int root, MPI_Comm comm, MPI_Request * request)); +DARSHAN_FORWARD_DECL(PMPI_Ireduce_scatter, int, (const void *sendbuf, void *recvbuf, const int recvcounts[], + MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, MPI_Request * request)); +DARSHAN_FORWARD_DECL(PMPI_Iscan, int, (const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, + MPI_Op op, MPI_Comm comm, MPI_Request * request)); +DARSHAN_FORWARD_DECL(PMPI_Iexscan, int, (const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, + MPI_Op op, MPI_Comm comm, MPI_Request * request)); + +DARSHAN_FORWARD_DECL(PMPI_Accumulate, int, (const void *origin_addr, int origin_count, MPI_Datatype + origin_datatype, int target_rank, MPI_Aint + target_disp, int target_count, MPI_Datatype + target_datatype, MPI_Op op, MPI_Win win)); + +DARSHAN_FORWARD_DECL(PMPI_Get_accumulate, int, (const void *origin_addr, int origin_count, + MPI_Datatype origin_datatype, void *result_addr, int result_count, + MPI_Datatype result_datatype, int target_rank, MPI_Aint target_disp, + int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win)); + +DARSHAN_FORWARD_DECL(PMPI_Fetch_and_op, int, (const void *origin_addr, void *result_addr, + MPI_Datatype datatype, int target_rank, MPI_Aint target_disp, + MPI_Op op, MPI_Win win)); + +DARSHAN_FORWARD_DECL(PMPI_Compare_and_swap, int, (const void *origin_addr, const void *compare_addr, + void *result_addr, MPI_Datatype datatype, int target_rank, + MPI_Aint target_disp, MPI_Win win)); + +DARSHAN_FORWARD_DECL(PMPI_Win_fence, int, (int assert, MPI_Win win)); + +DARSHAN_FORWARD_DECL(PMPI_Win_start, int, (MPI_Group group, int assert, MPI_Win win)); + +DARSHAN_FORWARD_DECL(PMPI_Win_complete, int, (MPI_Win win)); + +DARSHAN_FORWARD_DECL(PMPI_Win_post, int, (MPI_Group group, int assert, MPI_Win win)); + +DARSHAN_FORWARD_DECL(PMPI_Win_wait, int, (MPI_Win win)); + +DARSHAN_FORWARD_DECL(PMPI_Win_test, int, (MPI_Win win, int *flag)); + +DARSHAN_FORWARD_DECL(PMPI_Win_lock, int, (int lock_type, int rank, int assert, MPI_Win win)); + +DARSHAN_FORWARD_DECL(PMPI_Win_unlock, int, (int rank, MPI_Win win)); + +DARSHAN_FORWARD_DECL(PMPI_Win_unlock_all, int, (MPI_Win win)); + +DARSHAN_FORWARD_DECL(PMPI_Win_flush, int, (int rank, MPI_Win win)); + +DARSHAN_FORWARD_DECL(PMPI_Win_flush_all, int, (MPI_Win win)); + +DARSHAN_FORWARD_DECL(PMPI_Win_flush_local, int, (int rank, MPI_Win win)); + +DARSHAN_FORWARD_DECL(PMPI_Win_flush_local_all, int, (MPI_Win win)); + +DARSHAN_FORWARD_DECL(PMPI_Win_sync, int, (MPI_Win win)); + +/* + * Global runtime struct for tracking data needed at runtime + */ +struct apmpi_runtime +{ + struct darshan_apmpi_perf_record *perf_record; + struct darshan_apmpi_header_record *header_record; + darshan_record_id rec_id; + darshan_record_id header_id; + int frozen; /* flag to indicate that the counters should no longer be modified */ +}; + +static struct apmpi_runtime *apmpi_runtime = NULL; +static pthread_mutex_t apmpi_runtime_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; + +static int apmpi_runtime_init_attempted = 0; + +/* my_rank indicates the MPI rank of this process */ +static int my_rank = -1; + +/* internal helper functions for the apmpi module */ +static void apmpi_runtime_initialize(void); + +/* forward declaration for shutdown function needed to interface with darshan-core */ +#ifdef HAVE_MPI +static void apmpi_mpi_redux( + void *buffer, + MPI_Comm mod_comm, + darshan_record_id *shared_recs, + int shared_rec_count); +#endif +static void apmpi_output( + void **buffer, + int *size); +static void apmpi_cleanup( + void); + +/* macros for obtaining/releasing the apmpi module lock */ +#define APMPI_LOCK() pthread_mutex_lock(&apmpi_runtime_mutex) +#define APMPI_UNLOCK() pthread_mutex_unlock(&apmpi_runtime_mutex) + +/* + * Initialize counters + */ +static void initialize_counters (void) +{ + int i; + for (i = 0; i < APMPI_NUM_INDICES; i++) + { + apmpi_runtime->perf_record->counters[i] = 0; + } + for (i = 0; i < APMPI_F_MPIOP_TOTALTIME_NUM_INDICES; i++) + { + apmpi_runtime->perf_record->fcounters[i] = 0; + } + for (i = 0; i < APMPI_F_MPIOP_SYNCTIME_NUM_INDICES; i++) + { + apmpi_runtime->perf_record->fsynccounters[i] = 0; + } + for (i = 0; i < APMPI_F_MPI_GLOBAL_NUM_INDICES; i++) + { + apmpi_runtime->perf_record->fsynccounters[i] = 0; + } + return; +} + +static void finalize_counters (void) +{ + + return; +} + +/* + * Function which updates all the counter data + */ +static void capture(struct darshan_apmpi_perf_record *rec, + darshan_record_id rec_id) +{ + rec->base_rec.id = rec_id; + rec->base_rec.rank = my_rank; + int name_len; + char name[MPI_MAX_PROCESSOR_NAME]; + MPI_Get_processor_name(name, &name_len); + strncpy(rec->node_name, name, (name_len < AP_PROCESSOR_NAME_MAX)? name_len : AP_PROCESSOR_NAME_MAX); + + return; +} + +static void apmpi_runtime_initialize() +{ + size_t apmpi_buf_size; + size_t apmpi_rec_count = 1; + int ret; + + darshan_module_funcs mod_funcs = { +#ifdef HAVE_MPI + .mod_redux_func = &apmpi_mpi_redux, +#endif + .mod_output_func = &apmpi_output, + .mod_cleanup_func = &apmpi_cleanup + }; + + APMPI_LOCK(); + + /* if this attempt at initializing fails, we won't try again */ + apmpi_runtime_init_attempted = 1; + + /* don't do anything if already initialized */ + if(apmpi_runtime) + { + APMPI_UNLOCK(); + return; + } + + apmpi_buf_size = sizeof(struct darshan_apmpi_header_record) + + sizeof(struct darshan_apmpi_perf_record); + + /* register the apmpi module with the darshan-core component */ + ret = darshan_core_register_module( + DARSHAN_APMPI_MOD, + mod_funcs, + apmpi_buf_size, + &apmpi_rec_count, + &my_rank, + NULL); + if(ret < 0) + { + APMPI_UNLOCK(); + return; + } + + /* initialize module's global state */ + apmpi_runtime = malloc(sizeof(*apmpi_runtime)); + if(!apmpi_runtime) + { + darshan_core_unregister_module(DARSHAN_APMPI_MOD); + APMPI_UNLOCK(); + return; + } + memset(apmpi_runtime, 0, sizeof(*apmpi_runtime)); + + if (my_rank == 0) + { + apmpi_runtime->header_id = darshan_core_gen_record_id("darshan-apmpi-header"); + + /* register the apmpi record with darshan-core */ + apmpi_runtime->header_record = darshan_core_register_record( + apmpi_runtime->header_id, + //NULL, + "darshan-apmpi-header", + DARSHAN_APMPI_MOD, + sizeof(struct darshan_apmpi_header_record), + NULL); + if(!(apmpi_runtime->header_record)) + { + darshan_core_unregister_module(DARSHAN_APMPI_MOD); + free(apmpi_runtime); + apmpi_runtime = NULL; + APMPI_UNLOCK(); + return; + } + apmpi_runtime->header_record->base_rec.id = apmpi_runtime->header_id; + apmpi_runtime->header_record->base_rec.rank = my_rank; + apmpi_runtime->header_record->magic = APMPI_MAGIC; +#ifdef __APMPI_COLL_SYNC + apmpi_runtime->header_record->sync_flag = 1; +#else + apmpi_runtime->header_record->sync_flag = 0; +#endif + } + + apmpi_runtime->rec_id = darshan_core_gen_record_id("APMPI"); //record name + + apmpi_runtime->perf_record = darshan_core_register_record( + apmpi_runtime->rec_id, + "APMPI", + DARSHAN_APMPI_MOD, + sizeof(struct darshan_apmpi_perf_record), + NULL); + if(!(apmpi_runtime->perf_record)) + { + darshan_core_unregister_module(DARSHAN_APMPI_MOD); + free(apmpi_runtime); + apmpi_runtime = NULL; + APMPI_UNLOCK(); + return; + } + + initialize_counters(); + /* collect perf counters */ + capture(apmpi_runtime->perf_record, apmpi_runtime->rec_id); + + APMPI_UNLOCK(); + + return; +} +#if 0 +static void apmpi_record_reduction_op (void* inrec_v, void* inoutrec_v, + int *len, MPI_Datatype *datatype) +{ + struct darshan_apmpi_perf_record tmp_rec; + struct darshan_apmpi_perf_record *inrec = inrec_v; + struct darshan_apmpi_perf_record *inoutrec = inoutrec_v; + int i, j, k; + + for (i=0; i<*len; i++) + { + memset(&tmp_rec, 0, sizeof(struct darshan_apmpi_perf_record)); + tmp_rec.base_rec.id = inrec->base_rec.id; + tmp_file.base_rec.rank = -1; + } +} +#endif +static void apmpi_shared_record_variance(MPI_Comm mod_comm) +{ + MPI_Datatype var_dt; + MPI_Op var_op; + struct darshan_variance_dt *var_send_buf = NULL; + struct darshan_variance_dt *var_recv_buf = NULL; + + PMPI_Type_contiguous(sizeof(struct darshan_variance_dt), + MPI_BYTE, &var_dt); + PMPI_Type_commit(&var_dt); + + PMPI_Op_create(darshan_variance_reduce, 1, &var_op); + + var_send_buf = malloc(sizeof(struct darshan_variance_dt)); + if(!var_send_buf) + return; + + if(my_rank == 0) + { + var_recv_buf = malloc(sizeof(struct darshan_variance_dt)); + + if(!var_recv_buf) + return; + } + + /* get total mpi time variances across the ranks */ + var_send_buf->n = 1; + var_send_buf->S = 0; + var_send_buf->T = apmpi_runtime->perf_record->fglobalcounters[MPI_TOTAL_COMM_TIME]; + + PMPI_Reduce(var_send_buf, var_recv_buf, 1, + var_dt, var_op, 0, mod_comm); + + if(my_rank == 0) + { + apmpi_runtime->header_record->apmpi_f_variance_total_mpitime = + (var_recv_buf->S / var_recv_buf->n); + } + /* get total mpi sync time variances across the ranks */ + var_send_buf->n = 1; + var_send_buf->S = 0; + var_send_buf->T = apmpi_runtime->perf_record->fglobalcounters[MPI_TOTAL_COMM_SYNC_TIME]; + + PMPI_Reduce(var_send_buf, var_recv_buf, 1, + var_dt, var_op, 0, mod_comm); + + if(my_rank == 0) + { + apmpi_runtime->header_record->apmpi_f_variance_total_mpisynctime = + (var_recv_buf->S / var_recv_buf->n); + } + PMPI_Type_free(&var_dt); + PMPI_Op_free(&var_op); + free(var_send_buf); + free(var_recv_buf); + + return; +} + + +/******************************************************************************** + * shutdown function exported by this module for coordinating with darshan-core * + ********************************************************************************/ + +/* Pass data for the apmpi module back to darshan-core to log to file. */ +//#ifdef HAVE_MPI +static void apmpi_mpi_redux( + void *apmpi_buf, + MPI_Comm mod_comm, + darshan_record_id *shared_recs, + int shared_rec_count) +{ + int i; +#if 0 + struct darshan_apmpi_perf_record *red_send_buf = NULL; + struct darshan_apmpi_perf_record *red_recv_buf = NULL; + struct darshan_apmpi_perf_record *apmpi_rec_buf = (struct darshan_apmpi_perf_record *)apmpi_buf; +#endif + //MPI_Datatype red_type; + //MPI_Op red_op; + + APMPI_LOCK(); + + if (!apmpi_runtime) + { + APMPI_UNLOCK(); + return; + } + double mpisync_time = 0.0; + /* Compute Total MPI time per rank: MPI_TOTAL_COMM_TIME */ + for (i=MPI_SEND_TOTAL_TIME; iperf_record->fglobalcounters[MPI_TOTAL_COMM_TIME] += apmpi_runtime->perf_record->fcounters[i]; + } + for (i=MPI_BARRIER_TOTAL_SYNC_TIME; iperf_record->fsynccounters[i]; + } + apmpi_runtime->perf_record->fglobalcounters[MPI_TOTAL_COMM_TIME] += mpisync_time; + apmpi_runtime->perf_record->fglobalcounters[MPI_TOTAL_COMM_SYNC_TIME] = mpisync_time; +#if 0 + red_send_buf = apmpi_runtime->perf_record; + + if (my_rank == 0){ + red_recv_buf = malloc(sizeof(struct darshan_apmpi_perf_record)); + if(!red_recv_buf) + { + APMPI_UNLOCK(); + return; + } + } + /* construct a datatype for a APMPI file record. This is serving no purpose + * except to make sure we can do a reduction on proper boundaries + */ + PMPI_Type_contiguous(sizeof(struct darshan_apmpi_perf_record), + MPI_BYTE, &red_type); + PMPI_Type_commit(&red_type); + + /* register a APMPI file record reduction operator */ + PMPI_Op_create(apmpi_record_reduction_op, 1, &red_op); + + /* reduce shared APMPI file records */ + PMPI_Reduce(red_send_buf, red_recv_buf, + shared_rec_count, red_type, red_op, 0, mod_comm); +#endif + /* get the time variance across all ranks */ + apmpi_shared_record_variance(mod_comm); +#if 0 + /* clean up reduction state */ + if(my_rank == 0) + { + free(red_recv_buf); + } +#endif + //PMPI_Type_free(&red_type); + //PMPI_Op_free(&red_op); + + APMPI_UNLOCK(); + + return; +} + +//#endif +static void apmpi_output( + void **apmpi_buf, + int *apmpi_buf_sz) +{ + APMPI_LOCK(); + assert(apmpi_runtime); + *apmpi_buf_sz = 0; + if(my_rank == 0) { + *apmpi_buf_sz += sizeof( *apmpi_runtime->header_record); + } + *apmpi_buf_sz += sizeof( *apmpi_runtime->perf_record); + + apmpi_runtime->frozen = 1; + + APMPI_UNLOCK(); + return; +} + +static void apmpi_cleanup() +{ + APMPI_LOCK(); + assert(apmpi_runtime); + + finalize_counters(); + free(apmpi_runtime); + apmpi_runtime = NULL; + + APMPI_UNLOCK(); + return; +} + +/* note that if the break condition is triggered in this macro, then it + * will exit the do/while loop holding a lock that will be released in + * POST_RECORD(). Otherwise it will release the lock here (if held) and + * return immediately without reaching the POST_RECORD() macro. + */ +#define APMPI_PRE_RECORD() do { \ + if(!__darshan_disabled) { \ + APMPI_LOCK(); \ + if(!apmpi_runtime && !apmpi_runtime_init_attempted) \ + apmpi_runtime_initialize(); \ + if(apmpi_runtime && !apmpi_runtime->frozen) break; \ + APMPI_UNLOCK(); \ + } \ + return(ret); \ + } while(0) + +#define APMPI_POST_RECORD() do { \ + APMPI_UNLOCK(); \ + } while(0) + +#define APMPI_RECORD_UPDATE(MPI_OP) do { \ + if(ret != MPI_SUCCESS) break; \ + apmpi_runtime->perf_record->counters[MPI_OP ## _CALL_COUNT]++; \ + apmpi_runtime->perf_record->counters[MPI_OP ## _TOTAL_BYTES] += bytes; \ + DARSHAN_MSG_BUCKET_INC(&(apmpi_runtime->perf_record->counters[MPI_OP ## _MSG_SIZE_AGG_0_256]), bytes); \ + apmpi_runtime->perf_record->fcounters[MPI_OP ## _TOTAL_TIME] += tdiff; \ + apmpi_runtime->perf_record->fcounters[MPI_OP ## _MAX_TIME] = MAX(apmpi_runtime->perf_record->fcounters[Y(MPI_OP ## _MAX_TIME)], tdiff); \ + apmpi_runtime->perf_record->fcounters[MPI_OP ## _MIN_TIME] = MIN(apmpi_runtime->perf_record->fcounters[Y(MPI_OP ## _MIN_TIME)], tdiff); \ + } while(0) + +#define APMPI_RECORD_UPDATE_NOMSG(MPI_OP) do { \ + if(ret != MPI_SUCCESS) break; \ + apmpi_runtime->perf_record->counters[MPI_OP ## _CALL_COUNT]++; \ + apmpi_runtime->perf_record->fcounters[MPI_OP ## _TOTAL_TIME] += tdiff; \ + apmpi_runtime->perf_record->fcounters[MPI_OP ## _MAX_TIME] = MAX(apmpi_runtime->perf_record->fcounters[Y(MPI_OP ## _MAX_TIME)], tdiff); \ + apmpi_runtime->perf_record->fcounters[MPI_OP ## _MIN_TIME] = MIN(apmpi_runtime->perf_record->fcounters[Y(MPI_OP ## _MIN_TIME)], tdiff); \ + } while(0) + +#define APMPI_RECORD_UPDATE_SYNC(MPI_OP) do { \ + if(ret != MPI_SUCCESS) break; \ + apmpi_runtime->perf_record->counters[MPI_OP ## _CALL_COUNT]++; \ + apmpi_runtime->perf_record->counters[MPI_OP ## _TOTAL_BYTES] += bytes; \ + DARSHAN_MSG_BUCKET_INC(&(apmpi_runtime->perf_record->counters[MPI_OP ## _MSG_SIZE_AGG_0_256]), bytes); \ + apmpi_runtime->perf_record->fcounters[MPI_OP ## _TOTAL_TIME] += tdiff; \ + apmpi_runtime->perf_record->fsynccounters[MPI_OP ## _TOTAL_SYNC_TIME] += tsync; \ + apmpi_runtime->perf_record->fcounters[MPI_OP ## _MAX_TIME] = MAX(apmpi_runtime->perf_record->fcounters[Y(MPI_OP ## _MAX_TIME)], tdiff); \ + apmpi_runtime->perf_record->fcounters[MPI_OP ## _MIN_TIME] = MIN(apmpi_runtime->perf_record->fcounters[Y(MPI_OP ## _MIN_TIME)], tdiff); \ + } while(0) + +#define APMPI_RECORD_UPDATE_SYNC_NOMSG(MPI_OP) do { \ + if(ret != MPI_SUCCESS) break; \ + apmpi_runtime->perf_record->counters[MPI_OP ## _CALL_COUNT]++; \ + apmpi_runtime->perf_record->fcounters[MPI_OP ## _TOTAL_TIME] += tdiff; \ + apmpi_runtime->perf_record->fsynccounters[MPI_OP ## _TOTAL_SYNC_TIME] += tsync; \ + apmpi_runtime->perf_record->fcounters[MPI_OP ## _MAX_TIME] = MAX(apmpi_runtime->perf_record->fcounters[Y(MPI_OP ## _MAX_TIME)], tdiff); \ + apmpi_runtime->perf_record->fcounters[MPI_OP ## _MIN_TIME] = MIN(apmpi_runtime->perf_record->fcounters[Y(MPI_OP ## _MIN_TIME)], tdiff); \ + } while(0) +#define Y(a) a + +/********************************************************** + * Wrappers for MPI functions of interest * + **********************************************************/ + +int DARSHAN_DECL(MPI_Send)(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) +{ + MAP_OR_FAIL(PMPI_Send); + TIME(__real_PMPI_Send(buf, count, datatype, dest, tag, comm)); + BYTECOUNT(datatype, count); + APMPI_PRE_RECORD(); + // Potential optimization: Lock around the count - lock only if MPI_THREAD_MULTIPLE is used ... locking mutex + APMPI_RECORD_UPDATE(MPI_SEND); + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Send, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm), MPI_Send) + +int DARSHAN_DECL(MPI_Ssend)(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) +{ + MAP_OR_FAIL(PMPI_Ssend); + TIME(__real_PMPI_Ssend(buf, count, datatype, dest, tag, comm)); + BYTECOUNT(datatype, count); + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_SSEND); + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Ssend, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm), MPI_Ssend) + +int DARSHAN_DECL(MPI_Rsend)(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) +{ + MAP_OR_FAIL(PMPI_Rsend); + TIME(__real_PMPI_Rsend(buf, count, datatype, dest, tag, comm)); + BYTECOUNT(datatype, count); + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_RSEND); + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Rsend, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm), MPI_Rsend) + +int DARSHAN_DECL(MPI_Bsend)(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) +{ + MAP_OR_FAIL(PMPI_Bsend); + TIME(__real_PMPI_Bsend(buf, count, datatype, dest, tag, comm)); + BYTECOUNT(datatype, count); + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_BSEND); + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Bsend, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm), MPI_Bsend) + +int DARSHAN_DECL(MPI_Isend)(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, + MPI_Comm comm, MPI_Request *request) +{ + MAP_OR_FAIL(PMPI_Isend); + TIME(__real_PMPI_Isend(buf, count, datatype, dest, tag, comm, request)); + BYTECOUNT(datatype, count); + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_ISEND); + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Isend, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request), MPI_Isend) + +int DARSHAN_DECL(MPI_Issend)(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, + MPI_Comm comm, MPI_Request *request) +{ + MAP_OR_FAIL(PMPI_Issend); + TIME(__real_PMPI_Issend(buf, count, datatype, dest, tag, comm, request)); + BYTECOUNT(datatype, count); + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_ISSEND); + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Issend, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request), MPI_Issend) + +int DARSHAN_DECL(MPI_Irsend)(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, + MPI_Comm comm, MPI_Request *request) +{ + MAP_OR_FAIL(PMPI_Irsend); + TIME(__real_PMPI_Irsend(buf, count, datatype, dest, tag, comm, request)); + BYTECOUNT(datatype, count); + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_IRSEND); + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Irsend, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request), MPI_Irsend) + +int DARSHAN_DECL(MPI_Ibsend)(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, + MPI_Comm comm, MPI_Request *request) +{ + MAP_OR_FAIL(PMPI_Ibsend); + TIME(__real_PMPI_Ibsend(buf, count, datatype, dest, tag, comm, request)); + BYTECOUNT(datatype, count); + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_IBSEND); + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Ibsend, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request), MPI_Ibsend) + +int DARSHAN_DECL(MPI_Recv)(void *buf, int count, MPI_Datatype datatype, int source, int tag, + MPI_Comm comm, MPI_Status *status) +{ + MAP_OR_FAIL(PMPI_Recv); + TIME(__real_PMPI_Recv(buf, count, datatype, source, tag, comm, status)); + int count_received; //, src; + if (status != MPI_STATUS_IGNORE) { + PMPI_Get_count(status, datatype, &count_received); + if (count_received == MPI_UNDEFINED) count_received = count; + //src = status->MPI_SOURCE; + } + else { + count_received = count; + //src = source; + } + + BYTECOUNT(datatype, count_received); + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_RECV); + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Recv, int, (void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status), MPI_Recv) + +int DARSHAN_DECL(MPI_Irecv)(void *buf, int count, MPI_Datatype datatype, int source, int tag, + MPI_Comm comm, MPI_Request * request) +{ + MAP_OR_FAIL(PMPI_Irecv); + + TIME(__real_PMPI_Irecv(buf, count, datatype, source, tag, comm, request)); + BYTECOUNT(datatype, count); + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_IRECV); + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Irecv, int, (void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Request *request), MPI_Irecv) + +int DARSHAN_DECL(MPI_Sendrecv)(const void *sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int sendtag, + void *recvbuf, int recvcount, MPI_Datatype recvtype, + int source, int recvtag, MPI_Comm comm, MPI_Status * status) +{ + MAP_OR_FAIL(PMPI_Sendrecv); + + TIME(__real_PMPI_Sendrecv(sendbuf, sendcount, sendtype, dest, sendtag, recvbuf, recvcount, recvtype, source, recvtag, comm, status)); + + int count_received; //, src; + if (status != MPI_STATUS_IGNORE) { + PMPI_Get_count(status, recvtype, &count_received); + if (count_received == MPI_UNDEFINED) count_received = recvcount; + //src = status->MPI_SOURCE; + } + else { + count_received = recvcount; + //src = source; + } + BYTECOUNT(sendtype, sendcount); + ap_bytes_t sbytes = bytes; + BYTECOUNTND(recvtype, count_received); + bytes += sbytes; + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_SENDRECV); + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Sendrecv, int, (const void *sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int sendtag, + void *recvbuf, int recvcount, MPI_Datatype recvtype, + int source, int recvtag, MPI_Comm comm, MPI_Status * status), MPI_Sendrecv) +int DARSHAN_DECL(MPI_Sendrecv_replace)(void *buf, int count, MPI_Datatype datatype, int dest, int sendtag, + int source, int recvtag, MPI_Comm comm, MPI_Status * status) +{ + MAP_OR_FAIL(PMPI_Sendrecv_replace); + TIME(__real_PMPI_Sendrecv_replace(buf, count, datatype, dest, sendtag, source, recvtag, comm, status)); + + int count_received; //, src; + if (status != MPI_STATUS_IGNORE) { + PMPI_Get_count(status, datatype, &count_received); + if (count_received == MPI_UNDEFINED) count_received = count; + //src = status->MPI_SOURCE; + } + else { + count_received = count; + //src = source; + } + BYTECOUNT(datatype, count + count_received); + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_SENDRECV_REPLACE); + APMPI_POST_RECORD(); + + return ret; +} +/* +int DARSHAN_DECL(MPI_Isendrecv)(const void *sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int sendtag, + void *recvbuf, int recvcount, MPI_Datatype recvtype, + int source, int recvtag, MPI_Comm comm, MPI_Request *request) +{ + MAP_OR_FAIL(PMPI_Isendrecv); + + TIME(__real_PMPI_Isendrecv(sendbuf, sendcount, sendtype, dest, sendtag, recvbuf, recvcount, recvtype, source, recvtag, comm, request)); + + BYTECOUNT(sendtype, sendcount + recvcount); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_ISENDRECV); + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Isendrecv, int, (const void *sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int sendtag, + void *recvbuf, int recvcount, MPI_Datatype recvtype, + int source, int recvtag, MPI_Comm comm, MPI_Request *request), MPI_Isendrecv) + +int DARSHAN_DECL(MPI_Isendrecv_replace)(void *buf, int count, MPI_Datatype datatype, int dest, int sendtag, + int source, int recvtag, MPI_Comm comm, MPI_Request *request) +{ + MAP_OR_FAIL(PMPI_Isendrecv_replace); + + TIME(__real_PMPI_Isendrecv_replace(buf, count, datatype, dest, sendtag, source, recvtag, comm, request)); + + BYTECOUNT(datatype, count + count); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_ISENDRECV_REPLACE); + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Isendrecv_replace, int, (void *buf, int count, MPI_Datatype datatype, int dest, int sendtag, + int source, int recvtag, MPI_Comm comm, MPI_Request *request), MPI_Isendrecv_replace) +*/ +int DARSHAN_DECL(MPI_Put)(const void *origin_addr, int origin_count, MPI_Datatype + origin_datatype, int target_rank, MPI_Aint target_disp, + int target_count, MPI_Datatype target_datatype, MPI_Win win) +{ + MAP_OR_FAIL(PMPI_Put); + TIME(__real_PMPI_Put(origin_addr, origin_count, origin_datatype, target_rank, + target_disp, target_count, target_datatype, win)); + BYTECOUNT(origin_datatype, origin_count); + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_PUT); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Put, int, (const void *origin_addr, int origin_count, MPI_Datatype + origin_datatype, int target_rank, MPI_Aint target_disp, + int target_count, MPI_Datatype target_datatype, MPI_Win win), MPI_Put) + +int DARSHAN_DECL(MPI_Get)(void *origin_addr, int origin_count, MPI_Datatype + origin_datatype, int target_rank, MPI_Aint target_disp, + int target_count, MPI_Datatype target_datatype, MPI_Win win) +{ + MAP_OR_FAIL(PMPI_Get); + TIME(__real_PMPI_Get(origin_addr, origin_count, origin_datatype, target_rank, + target_disp, target_count, target_datatype, win)); + + BYTECOUNT(target_datatype, target_count); + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_GET); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Get, int, (void *origin_addr, int origin_count, MPI_Datatype + origin_datatype, int target_rank, MPI_Aint target_disp, + int target_count, MPI_Datatype target_datatype, MPI_Win win), MPI_Get) + + +int DARSHAN_DECL(MPI_Accumulate)(const void *origin_addr, int origin_count, MPI_Datatype + origin_datatype, int target_rank, MPI_Aint + target_disp, int target_count, MPI_Datatype + target_datatype, MPI_Op op, MPI_Win win) +{ + MAP_OR_FAIL(PMPI_Accumulate); + TIME(__real_PMPI_Accumulate(origin_addr, origin_count, + origin_datatype, target_rank, + target_disp, target_count, + target_datatype, op, win)); + + BYTECOUNT(target_datatype, target_count); + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_ACCUMULATE); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Accumulate, int, (const void *origin_addr, int origin_count, MPI_Datatype + origin_datatype, int target_rank, MPI_Aint + target_disp, int target_count, MPI_Datatype + target_datatype, MPI_Op op, MPI_Win win), MPI_Accumulate) + +int DARSHAN_DECL(MPI_Get_accumulate)(const void *origin_addr, int origin_count, + MPI_Datatype origin_datatype, void *result_addr, int result_count, + MPI_Datatype result_datatype, int target_rank, MPI_Aint target_disp, + int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win) +{ + MAP_OR_FAIL(PMPI_Get_accumulate); + TIME(__real_PMPI_Get_accumulate(origin_addr, origin_count, + origin_datatype, result_addr, result_count, + result_datatype, target_rank, target_disp, + target_count, target_datatype, op, win)); + + BYTECOUNT(target_datatype, target_count); + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_GET_ACCUMULATE); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Get_accumulate, int, (const void *origin_addr, int origin_count, + MPI_Datatype origin_datatype, void *result_addr, int result_count, + MPI_Datatype result_datatype, int target_rank, MPI_Aint target_disp, + int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win), MPI_Get_accumulate) + +int DARSHAN_DECL(MPI_Fetch_and_op)(const void *origin_addr, void *result_addr, + MPI_Datatype datatype, int target_rank, MPI_Aint target_disp, + MPI_Op op, MPI_Win win) +{ + MAP_OR_FAIL(PMPI_Fetch_and_op); + TIME(__real_PMPI_Fetch_and_op(origin_addr, result_addr, + datatype, target_rank, target_disp, + op, win)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_FETCH_AND_OP); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Fetch_and_op, int, (const void *origin_addr, void *result_addr, + MPI_Datatype datatype, int target_rank, MPI_Aint target_disp, + MPI_Op op, MPI_Win win), MPI_Fetch_and_op) + +int DARSHAN_DECL(MPI_Compare_and_swap)(const void *origin_addr, const void *compare_addr, + void *result_addr, MPI_Datatype datatype, int target_rank, + MPI_Aint target_disp, MPI_Win win) +{ + MAP_OR_FAIL(PMPI_Compare_and_swap); + TIME(__real_PMPI_Compare_and_swap(origin_addr, compare_addr, + result_addr, datatype, target_rank, + target_disp, win)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_COMPARE_AND_SWAP); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Compare_and_swap, int, (const void *origin_addr, const void *compare_addr, + void *result_addr, MPI_Datatype datatype, int target_rank, + MPI_Aint target_disp, MPI_Win win), MPI_Compare_and_swap) + +int DARSHAN_DECL(MPI_Win_fence)(int assert, MPI_Win win) +{ + MAP_OR_FAIL(PMPI_Win_fence); + TIME(__real_PMPI_Win_fence(assert, win)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WIN_FENCE); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Win_fence, int, (int assert, MPI_Win win), MPI_Win_fence) + +int DARSHAN_DECL(MPI_Win_start)(MPI_Group group, int assert, MPI_Win win) +{ + MAP_OR_FAIL(PMPI_Win_start); + TIME(__real_PMPI_Win_start(group, assert, win)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WIN_START); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Win_start, int, (MPI_Group group, int assert, MPI_Win win), MPI_Win_start) + +int DARSHAN_DECL(MPI_Win_complete)(MPI_Win win) +{ + MAP_OR_FAIL(PMPI_Win_complete); + TIME(__real_PMPI_Win_complete(win)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WIN_COMPLETE); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Win_complete, int, (MPI_Win win), MPI_Win_complete) + +int DARSHAN_DECL(MPI_Win_post)(MPI_Group group, int assert, MPI_Win win) +{ + MAP_OR_FAIL(PMPI_Win_post); + TIME(__real_PMPI_Win_post(group, assert, win)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WIN_POST); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Win_post, int, (MPI_Group group, int assert, MPI_Win win), MPI_Win_post) + +int DARSHAN_DECL(MPI_Win_wait)(MPI_Win win) +{ + MAP_OR_FAIL(PMPI_Win_wait); + TIME(__real_PMPI_Win_wait(win)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WIN_WAIT); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Win_wait, int, (MPI_Win win), MPI_Win_wait) + +int DARSHAN_DECL(MPI_Win_test)(MPI_Win win, int *flag) +{ + MAP_OR_FAIL(PMPI_Win_test); + TIME(__real_PMPI_Win_test(win, flag)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WIN_TEST); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Win_test, int, (MPI_Win win, int *flag), MPI_Win_test) + +int DARSHAN_DECL(MPI_Win_lock)(int lock_type, int rank, int assert, MPI_Win win) +{ + MAP_OR_FAIL(PMPI_Win_lock); + TIME(__real_PMPI_Win_lock(lock_type, rank, assert, win)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WIN_LOCK); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Win_lock, int, (int lock_type, int rank, int assert, MPI_Win win), MPI_Win_lock) + +int DARSHAN_DECL(MPI_Win_unlock)(int rank, MPI_Win win) +{ + MAP_OR_FAIL(PMPI_Win_unlock); + TIME(__real_PMPI_Win_unlock(rank, win)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WIN_UNLOCK); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Win_unlock, int, (int rank, MPI_Win win), MPI_Win_unlock) + +int DARSHAN_DECL(MPI_Win_unlock_all)(MPI_Win win) +{ + MAP_OR_FAIL(PMPI_Win_unlock_all); + TIME(__real_PMPI_Win_unlock_all(win)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WIN_UNLOCK_ALL); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Win_unlock_all, int, (MPI_Win win), MPI_Win_unlock_all) + +int DARSHAN_DECL(MPI_Win_flush)(int rank, MPI_Win win) +{ + MAP_OR_FAIL(PMPI_Win_flush); + TIME(__real_PMPI_Win_flush(rank, win)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WIN_FLUSH); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Win_flush, int, (int rank, MPI_Win win), MPI_Win_flush) + +int DARSHAN_DECL(MPI_Win_flush_all)(MPI_Win win) +{ + MAP_OR_FAIL(PMPI_Win_flush_all); + TIME(__real_PMPI_Win_flush_all(win)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WIN_FLUSH_ALL); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Win_flush_all, int, (MPI_Win win), MPI_Win_flush_all) + +int DARSHAN_DECL(MPI_Win_flush_local)(int rank, MPI_Win win) +{ + MAP_OR_FAIL(PMPI_Win_flush_local); + TIME(__real_PMPI_Win_flush_local(rank, win)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WIN_FLUSH_LOCAL); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Win_flush_local, int, (int rank, MPI_Win win), MPI_Win_flush_local) + +int DARSHAN_DECL(MPI_Win_flush_local_all)(MPI_Win win) +{ + MAP_OR_FAIL(PMPI_Win_flush_local_all); + TIME(__real_PMPI_Win_flush_local_all(win)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WIN_FLUSH_LOCAL_ALL); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Win_flush_local_all, int, (MPI_Win win), MPI_Win_flush_local_all) + +int DARSHAN_DECL(MPI_Win_sync)(MPI_Win win) +{ + MAP_OR_FAIL(PMPI_Win_sync); + TIME(__real_PMPI_Win_sync(win)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WIN_SYNC); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Win_sync, int, (MPI_Win win), MPI_Win_sync) + +int DARSHAN_DECL(MPI_Probe)(int source, int tag, MPI_Comm comm, MPI_Status * status) +{ + MAP_OR_FAIL(PMPI_Probe); + TIME(__real_PMPI_Probe(source, tag, comm, status)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_PROBE); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Probe, int, (int source, int tag, MPI_Comm comm, MPI_Status * status), MPI_Probe) + +int DARSHAN_DECL(MPI_Iprobe)(int source, int tag, MPI_Comm comm, int *flag, MPI_Status * status) +{ + MAP_OR_FAIL(PMPI_Iprobe); + TIME(__real_PMPI_Iprobe(source, tag, comm, flag, status)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_IPROBE); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Iprobe, int, (int source, int tag, MPI_Comm comm, int *flag, MPI_Status * status), MPI_Iprobe) + +int DARSHAN_DECL(MPI_Test)(MPI_Request *request, int *flag, MPI_Status *status) +{ + MAP_OR_FAIL(PMPI_Test); + TIME(__real_PMPI_Test(request, flag, status)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_TEST); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Test, int, (MPI_Request *request, int *flag, MPI_Status *status), MPI_Test) + +int DARSHAN_DECL(MPI_Testany)(int count, MPI_Request array_of_requests[], int *indx, + int *flag, MPI_Status *status) +{ + MAP_OR_FAIL(PMPI_Testany); + TIME(__real_PMPI_Testany(count, array_of_requests, indx, flag, status)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_TESTANY); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Testany, int, (int count, MPI_Request array_of_requests[], int *indx, + int *flag, MPI_Status *status), MPI_Testany) + +int DARSHAN_DECL(MPI_Testall)(int count, MPI_Request array_of_requests[], + int *flag, MPI_Status array_of_statuses[]) +{ + MAP_OR_FAIL(PMPI_Testall); + TIME(__real_PMPI_Testall(count, array_of_requests, flag, array_of_statuses)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_TESTALL); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Testall, int, (int count, MPI_Request array_of_requests[], + int *flag, MPI_Status array_of_statuses[]), MPI_Testall) + +int DARSHAN_DECL(MPI_Testsome)(int incount, MPI_Request array_of_requests[], int *outcount, + int array_of_indices[], MPI_Status array_of_statuses[]) +{ + MAP_OR_FAIL(PMPI_Testsome); + TIME(__real_PMPI_Testsome(incount, array_of_requests, outcount, array_of_indices, array_of_statuses)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_TESTSOME); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Testsome, int, (int incount, MPI_Request array_of_requests[], int *outcount, + int array_of_indices[], MPI_Status array_of_statuses[]), MPI_Testsome) + +int DARSHAN_DECL(MPI_Wait)(MPI_Request * request, MPI_Status * status) +{ + MAP_OR_FAIL(PMPI_Wait); + TIME(__real_PMPI_Wait(request, status)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WAIT); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Wait, int, (MPI_Request * request, MPI_Status * status), MPI_Wait) + +int DARSHAN_DECL(MPI_Waitany)(int count, MPI_Request array_of_requests[], int *indx, MPI_Status * status) +{ + MAP_OR_FAIL(PMPI_Waitany); + TIME(__real_PMPI_Waitany(count, array_of_requests, indx, status)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WAITANY); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Waitany, int, (int count, MPI_Request array_of_requests[], int *indx, MPI_Status * status), MPI_Waitany) + +int DARSHAN_DECL(MPI_Waitall)(int count, MPI_Request array_of_requests[], + MPI_Status array_of_statuses[]) +{ + MAP_OR_FAIL(PMPI_Waitall); + TIME(__real_PMPI_Waitall(count, array_of_requests, array_of_statuses)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WAITALL); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Waitall, int, (int count, MPI_Request array_of_requests[], + MPI_Status array_of_statuses[]), MPI_Waitall) + +int DARSHAN_DECL(MPI_Waitsome)(int incount, MPI_Request array_of_requests[], + int *outcount, int array_of_indices[], MPI_Status array_of_statuses[]) +{ + MAP_OR_FAIL(PMPI_Waitsome); + TIME(__real_PMPI_Waitsome(incount, array_of_requests, outcount, array_of_indices, array_of_statuses)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WAITSOME); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Waitsome, int, (int incount, MPI_Request array_of_requests[], + int *outcount, int array_of_indices[], MPI_Status array_of_statuses[]), MPI_Waitsome) + +int DARSHAN_DECL(MPI_Barrier)(MPI_Comm comm) +{ + MAP_OR_FAIL(PMPI_Barrier); + TIME_SYNC(__real_PMPI_Barrier(comm)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_SYNC_NOMSG(MPI_BARRIER); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Barrier, int, (MPI_Comm comm), MPI_Barrier) + +int DARSHAN_DECL(MPI_Bcast)(void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm) +{ + MAP_OR_FAIL(PMPI_Bcast); + + TIME_SYNC(__real_PMPI_Bcast(buffer, count, datatype, root, comm)); + + ap_bytes_t bytes = 0; + if (root != MPI_PROC_NULL) { + BYTECOUNTND(datatype, count); + } + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_SYNC(MPI_BCAST); + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Bcast, int, (void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm), MPI_Bcast) + +int DARSHAN_DECL(MPI_Reduce)(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, + MPI_Comm comm) +{ + MAP_OR_FAIL(PMPI_Reduce); + + TIME_SYNC(__real_PMPI_Reduce(sendbuf, recvbuf, count, datatype, op, root, comm)); + + ap_bytes_t bytes = 0; + if (root != MPI_PROC_NULL) { + BYTECOUNTND(datatype, count); + } + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_SYNC(MPI_REDUCE); + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Reduce, int, (const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm), MPI_Reduce) + +int DARSHAN_DECL(MPI_Allreduce)(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, + MPI_Comm comm) +{ + MAP_OR_FAIL(PMPI_Allreduce); + + TIME_SYNC(__real_PMPI_Allreduce(sendbuf, recvbuf, count, datatype, op, comm)); + + BYTECOUNT(datatype, count); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_SYNC(MPI_ALLREDUCE); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Allreduce, int, (const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm), MPI_Allreduce) + +int DARSHAN_DECL(MPI_Alltoall)(const void *sendbuf, int sendcount, MPI_Datatype sendtype, + void *recvbuf, int recvcount, MPI_Datatype recvtype, + MPI_Comm comm) +{ + MAP_OR_FAIL(PMPI_Alltoall); + + TIME_SYNC(__real_PMPI_Alltoall(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm)); + + BYTECOUNT(recvtype, recvcount); + int tasks; + PMPI_Comm_size(comm, &tasks); + bytes = bytes*tasks; + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_SYNC(MPI_ALLTOALL); + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Alltoall, int, (const void *sendbuf, int sendcount, MPI_Datatype sendtype, + void *recvbuf, int recvcount, MPI_Datatype recvtype, + MPI_Comm comm), MPI_Alltoall) + +int DARSHAN_DECL(MPI_Alltoallv)(const void *sendbuf, const int *sendcounts, const int *sdispls, + MPI_Datatype sendtype, void *recvbuf, const int *recvcounts, const int *rdispls, + MPI_Datatype recvtype, MPI_Comm comm) +{ + MAP_OR_FAIL(PMPI_Alltoallv); + + TIME_SYNC(__real_PMPI_Alltoallv(sendbuf, sendcounts, sdispls, sendtype, recvbuf, recvcounts, rdispls, recvtype, comm)); + + int i, tasks, count = 0; + PMPI_Comm_size(comm, &tasks); + for (i=0; iperf_record->counters[MPI_ _COUNT]++; + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_ , int, (), MPI_ ) +*/ + +#undef Y + +/* + * Local variables: + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + * + * vim: ts=8 sts=4 sw=4 expandtab + */ diff --git a/modules/patched_darshan-apmpi.c b/modules/patched_darshan-apmpi.c new file mode 100644 index 000000000..8fc5e6285 --- /dev/null +++ b/modules/patched_darshan-apmpi.c @@ -0,0 +1,2301 @@ +/* + * Copyright (C) 2017 University of Chicago. + * See COPYRIGHT notice in top-level directory. + * + */ + +#define _XOPEN_SOURCE 500 +#define _GNU_SOURCE + +#include "darshan-runtime-config.h" +#include +#include +#include +#include +#include + +#include "uthash.h" +#include "darshan.h" +#include "darshan-dynamic.h" +#include "darshan-apmpi-log-format.h" + +typedef long long ap_bytes_t; +#define MAX(x,y) ((x>y)?x:y) +#define MIN(x,y) ((x==0.0)?y:((x 0) && (TYPE != MPI_DATATYPE_NULL)) { \ + PMPI_Type_size(TYPE, &tsize); \ + bytes = (COUNT) * tsize; \ + } + +#define BYTECOUNTND(TYPE, COUNT) \ + int tsize2; \ + bytes = 0; \ + if((COUNT > 0) && (TYPE != MPI_DATATYPE_NULL)) { \ + PMPI_Type_size(TYPE, &tsize2); \ + bytes = (COUNT) * tsize2; \ + } + + + +/* increment histogram bucket depending on the given __value + * + * NOTE: This macro can be used to build a histogram of access + * sizes, offsets, etc. It assumes a 6-bucket histogram, with + * __bucket_base_p pointing to the first counter in the sequence + * of buckets (i.e., the smallest bucket). The size ranges of each + * bucket are: + * * 0 - 256 bytes + * * 256 - 1 KiB + * * 1 KiB - 8 KiB + * * 32 KiB - 256 KiB + * * 256 KiB - 1 MiB + * * 1 MiB + + */ +#define DARSHAN_MSG_BUCKET_INC(__bucket_base_p, __value) do {\ + if(__value < 257) \ + *(__bucket_base_p) += 1; \ + else if(__value < 1025) \ + *(__bucket_base_p + 1) += 1; \ + else if(__value < 8193) \ + *(__bucket_base_p + 2) += 1; \ + else if(__value < 262145) \ + *(__bucket_base_p + 3) += 1; \ + else if(__value < 1048577) \ + *(__bucket_base_p + 4) += 1; \ + else \ + *(__bucket_base_p + 5) += 1; \ +} while(0) + + +DARSHAN_FORWARD_DECL(PMPI_Send, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Ssend, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Rsend, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Bsend, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Recv, int, (void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status)); +DARSHAN_FORWARD_DECL(PMPI_Sendrecv, int, (const void *sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int sendtag, + void *recvbuf, int recvcount, MPI_Datatype recvtype, + int source, int recvtag, MPI_Comm comm, MPI_Status * status)); +DARSHAN_FORWARD_DECL(PMPI_Sendrecv_replace, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int sendtag, + int source, int recvtag, MPI_Comm comm, MPI_Status * status)); +DARSHAN_FORWARD_DECL(PMPI_Isend, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request)); +DARSHAN_FORWARD_DECL(PMPI_Issend, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request)); +DARSHAN_FORWARD_DECL(PMPI_Irsend, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request)); +DARSHAN_FORWARD_DECL(PMPI_Ibsend, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request)); +DARSHAN_FORWARD_DECL(PMPI_Irecv, int, (void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Request *request)); +/* +DARSHAN_FORWARD_DECL(PMPI_Isendrecv, int, (const void *sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int sendtag, void *recvbuf, +int recvcount, MPI_Datatype recvtype, int source, int recvtag, MPI_Comm comm, MPI_Request *request)); +DARSHAN_FORWARD_DECL(PMPI_Isendrecv_replace, int, (void *buf, int count, MPI_Datatype datatype, int dest, int sendtag, int source, int recvtag, MPI_Comm comm, MPI_Request *request)); +*/ +DARSHAN_FORWARD_DECL(PMPI_Probe, int, (int source, int tag, MPI_Comm comm, MPI_Status * status)); +DARSHAN_FORWARD_DECL(PMPI_Iprobe, int, (int source, int tag, MPI_Comm comm, int *flag, MPI_Status * status)); +DARSHAN_FORWARD_DECL(PMPI_Test, int, (MPI_Request *request, int *flag, MPI_Status *status)); +DARSHAN_FORWARD_DECL(PMPI_Testany, int, (int count, MPI_Request array_of_requests[], int *indx, + int *flag, MPI_Status *status)); +DARSHAN_FORWARD_DECL(PMPI_Testall, int, (int count, MPI_Request array_of_requests[], int *flag, + MPI_Status array_of_statuses[])); +DARSHAN_FORWARD_DECL(PMPI_Testsome, int, (int incount, MPI_Request array_of_requests[], int *outcount, + int array_of_indices[], MPI_Status array_of_statuses[])); +DARSHAN_FORWARD_DECL(PMPI_Wait, int, (MPI_Request * request, MPI_Status * status)); +DARSHAN_FORWARD_DECL(PMPI_Waitany, int, (int count, MPI_Request array_of_requests[], int *indx, MPI_Status * status)); +DARSHAN_FORWARD_DECL(PMPI_Waitall, int, (int count, MPI_Request array_of_requests[], + MPI_Status array_of_statuses[])); +DARSHAN_FORWARD_DECL(PMPI_Waitsome, int, (int incount, MPI_Request array_of_requests[], + int *outcount, int array_of_indices[], MPI_Status array_of_statuses[])); +DARSHAN_FORWARD_DECL(PMPI_Put, int, (const void *origin_addr, int origin_count, MPI_Datatype + origin_datatype, int target_rank, MPI_Aint target_disp, + int target_count, MPI_Datatype target_datatype, MPI_Win win)); +DARSHAN_FORWARD_DECL(PMPI_Get, int, (void *origin_addr, int origin_count, MPI_Datatype + origin_datatype, int target_rank, MPI_Aint target_disp, + int target_count, MPI_Datatype target_datatype, MPI_Win win)); +DARSHAN_FORWARD_DECL(PMPI_Barrier, int, (MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Bcast, int, (void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Reduce, int, (const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Allreduce, int, (const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Alltoall, int, (const void *sendbuf, int sendcount, MPI_Datatype sendtype, + void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Alltoallv, int, (const void *sendbuf, const int *sendcounts, const int *sdispls, + MPI_Datatype sendtype, void *recvbuf, const int *recvcounts, const int *rdispls, + MPI_Datatype recvtype, MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Alltoallw, int, (const void *sendbuf, const int sendcounts[], const int sdispls[], + const MPI_Datatype sendtypes[], void *recvbuf, const int recvcounts[], const int rdispls[], + const MPI_Datatype recvtypes[], MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Allgather, int, (const void *sendbuf, int sendcount, MPI_Datatype sendtype, + void *recvbuf, int recvcount, MPI_Datatype recvtype, + MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Allgatherv, int, ()); +DARSHAN_FORWARD_DECL(PMPI_Gather , int, (const void *sendbuf, int sendcount, MPI_Datatype sendtype, + void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Gatherv , int, (const void *sendbuf, int sendcount, MPI_Datatype sendtype, + void *recvbuf, const int *recvcounts, const int *displs, + MPI_Datatype recvtype, int root, MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Scatter, int, (const void *sendbuf, int sendcount, MPI_Datatype sendtype, + void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, + MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Scatterv, int, (const void *sendbuf, const int *sendcounts, const int *displs, + MPI_Datatype sendtype, void *recvbuf, int recvcount, + MPI_Datatype recvtype, + int root, MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Reduce_scatter, int, (const void *sendbuf, void *recvbuf, const int recvcounts[], + MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Scan, int, (const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, + MPI_Op op, MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Exscan, int, (const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, + MPI_Op op, MPI_Comm comm)); +DARSHAN_FORWARD_DECL(PMPI_Ibarrier, int, (MPI_Comm comm, MPI_Request * request)); +DARSHAN_FORWARD_DECL(PMPI_Ibcast, int, (void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm, MPI_Request * request)); +DARSHAN_FORWARD_DECL(PMPI_Ireduce, int, (const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm, MPI_Request * request)); +DARSHAN_FORWARD_DECL(PMPI_Iallreduce, int, (const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, MPI_Request * request)); +DARSHAN_FORWARD_DECL(PMPI_Ialltoall, int, (const void *sendbuf, int sendcount, MPI_Datatype sendtype, + void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm, MPI_Request * request)); +DARSHAN_FORWARD_DECL(PMPI_Ialltoallv, int, (const void *sendbuf, const int *sendcounts, const int *sdispls, + MPI_Datatype sendtype, void *recvbuf, const int *recvcounts, const int *rdispls, + MPI_Datatype recvtype, MPI_Comm comm, MPI_Request * request)); +DARSHAN_FORWARD_DECL(PMPI_Ialltoallw, int, (const void *sendbuf, const int sendcounts[], const int sdispls[], + const MPI_Datatype sendtypes[], void *recvbuf, const int recvcounts[], const int rdispls[], + const MPI_Datatype recvtypes[], MPI_Comm comm, MPI_Request * request)); +DARSHAN_FORWARD_DECL(PMPI_Iallgather, int, (const void *sendbuf, int sendcount, MPI_Datatype sendtype, + void *recvbuf, int recvcount, MPI_Datatype recvtype, + MPI_Comm comm, MPI_Request * request)); +DARSHAN_FORWARD_DECL(PMPI_Iallgatherv, int, ()); +DARSHAN_FORWARD_DECL(PMPI_Igather , int, (const void *sendbuf, int sendcount, MPI_Datatype sendtype, + void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm, MPI_Request * request)); +DARSHAN_FORWARD_DECL(PMPI_Igatherv , int, (const void *sendbuf, int sendcount, MPI_Datatype sendtype, + void *recvbuf, const int *recvcounts, const int *displs, + MPI_Datatype recvtype, int root, MPI_Comm comm, MPI_Request * request)); +DARSHAN_FORWARD_DECL(PMPI_Iscatter, int, (const void *sendbuf, int sendcount, MPI_Datatype sendtype, + void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, + MPI_Comm comm, MPI_Request * request)); +DARSHAN_FORWARD_DECL(PMPI_Iscatterv, int, (const void *sendbuf, const int *sendcounts, const int *displs, + MPI_Datatype sendtype, void *recvbuf, int recvcount, + MPI_Datatype recvtype, + int root, MPI_Comm comm, MPI_Request * request)); +DARSHAN_FORWARD_DECL(PMPI_Ireduce_scatter, int, (const void *sendbuf, void *recvbuf, const int recvcounts[], + MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, MPI_Request * request)); +DARSHAN_FORWARD_DECL(PMPI_Iscan, int, (const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, + MPI_Op op, MPI_Comm comm, MPI_Request * request)); +DARSHAN_FORWARD_DECL(PMPI_Iexscan, int, (const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, + MPI_Op op, MPI_Comm comm, MPI_Request * request)); + +DARSHAN_FORWARD_DECL(PMPI_Accumulate, int, (const void *origin_addr, int origin_count, MPI_Datatype + origin_datatype, int target_rank, MPI_Aint + target_disp, int target_count, MPI_Datatype + target_datatype, MPI_Op op, MPI_Win win)); + +DARSHAN_FORWARD_DECL(PMPI_Get_accumulate, int, (const void *origin_addr, int origin_count, + MPI_Datatype origin_datatype, void *result_addr, int result_count, + MPI_Datatype result_datatype, int target_rank, MPI_Aint target_disp, + int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win)); + +DARSHAN_FORWARD_DECL(PMPI_Fetch_and_op, int, (const void *origin_addr, void *result_addr, + MPI_Datatype datatype, int target_rank, MPI_Aint target_disp, + MPI_Op op, MPI_Win win)); + +DARSHAN_FORWARD_DECL(PMPI_Compare_and_swap, int, (const void *origin_addr, const void *compare_addr, + void *result_addr, MPI_Datatype datatype, int target_rank, + MPI_Aint target_disp, MPI_Win win)); + +DARSHAN_FORWARD_DECL(PMPI_Win_fence, int, (int assert, MPI_Win win)); + +DARSHAN_FORWARD_DECL(PMPI_Win_start, int, (MPI_Group group, int assert, MPI_Win win)); + +DARSHAN_FORWARD_DECL(PMPI_Win_complete, int, (MPI_Win win)); + +DARSHAN_FORWARD_DECL(PMPI_Win_post, int, (MPI_Group group, int assert, MPI_Win win)); + +DARSHAN_FORWARD_DECL(PMPI_Win_wait, int, (MPI_Win win)); + +DARSHAN_FORWARD_DECL(PMPI_Win_test, int, (MPI_Win win, int *flag)); + +DARSHAN_FORWARD_DECL(PMPI_Win_lock, int, (int lock_type, int rank, int assert, MPI_Win win)); + +DARSHAN_FORWARD_DECL(PMPI_Win_unlock, int, (int rank, MPI_Win win)); + +DARSHAN_FORWARD_DECL(PMPI_Win_unlock_all, int, (MPI_Win win)); + +DARSHAN_FORWARD_DECL(PMPI_Win_flush, int, (int rank, MPI_Win win)); + +DARSHAN_FORWARD_DECL(PMPI_Win_flush_all, int, (MPI_Win win)); + +DARSHAN_FORWARD_DECL(PMPI_Win_flush_local, int, (int rank, MPI_Win win)); + +DARSHAN_FORWARD_DECL(PMPI_Win_flush_local_all, int, (MPI_Win win)); + +DARSHAN_FORWARD_DECL(PMPI_Win_sync, int, (MPI_Win win)); + +/* + * Global runtime struct for tracking data needed at runtime + */ +struct apmpi_runtime +{ + struct darshan_apmpi_perf_record *perf_record; + struct darshan_apmpi_header_record *header_record; + darshan_record_id rec_id; + darshan_record_id header_id; + int frozen; /* flag to indicate that the counters should no longer be modified */ +}; + +static struct apmpi_runtime *apmpi_runtime = NULL; +static pthread_mutex_t apmpi_runtime_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; + +static int apmpi_runtime_init_attempted = 0; + +/* my_rank indicates the MPI rank of this process */ +static int my_rank = -1; + +/* internal helper functions for the apmpi module */ +static void apmpi_runtime_initialize(void); + +/* forward declaration for shutdown function needed to interface with darshan-core */ +#ifdef HAVE_MPI +static void apmpi_mpi_redux( + void *buffer, + MPI_Comm mod_comm, + darshan_record_id *shared_recs, + int shared_rec_count); +#endif +static void apmpi_output( + void **buffer, + int *size); +static void apmpi_cleanup( + void); + +/* macros for obtaining/releasing the apmpi module lock */ +#define APMPI_LOCK() pthread_mutex_lock(&apmpi_runtime_mutex) +#define APMPI_UNLOCK() pthread_mutex_unlock(&apmpi_runtime_mutex) + +/* + * Initialize counters + */ +static void initialize_counters (void) +{ + int i; + for (i = 0; i < APMPI_NUM_INDICES; i++) + { + apmpi_runtime->perf_record->counters[i] = 0; + } + for (i = 0; i < APMPI_F_MPIOP_TOTALTIME_NUM_INDICES; i++) + { + apmpi_runtime->perf_record->fcounters[i] = 0; + } + for (i = 0; i < APMPI_F_MPIOP_SYNCTIME_NUM_INDICES; i++) + { + apmpi_runtime->perf_record->fsynccounters[i] = 0; + } + for (i = 0; i < APMPI_F_MPI_GLOBAL_NUM_INDICES; i++) + { + apmpi_runtime->perf_record->fsynccounters[i] = 0; + } + return; +} + +static void finalize_counters (void) +{ + + return; +} + +/* + * Function which updates all the counter data + */ +static void capture(struct darshan_apmpi_perf_record *rec, + darshan_record_id rec_id) +{ + rec->base_rec.id = rec_id; + rec->base_rec.rank = my_rank; + int name_len; + char name[MPI_MAX_PROCESSOR_NAME]; + MPI_Get_processor_name(name, &name_len); + strncpy(rec->node_name, name, (name_len < AP_PROCESSOR_NAME_MAX)? name_len : AP_PROCESSOR_NAME_MAX); + + return; +} + +static void apmpi_runtime_initialize() +{ + size_t apmpi_buf_size; + size_t apmpi_rec_count = 1; + int ret; + + darshan_module_funcs mod_funcs = { +#ifdef HAVE_MPI + .mod_redux_func = &apmpi_mpi_redux, +#endif + .mod_output_func = &apmpi_output, + .mod_cleanup_func = &apmpi_cleanup + }; + + APMPI_LOCK(); + + /* if this attempt at initializing fails, we won't try again */ + apmpi_runtime_init_attempted = 1; + + /* don't do anything if already initialized */ + if(apmpi_runtime) + { + APMPI_UNLOCK(); + return; + } + + apmpi_buf_size = sizeof(struct darshan_apmpi_header_record) + + sizeof(struct darshan_apmpi_perf_record); + + /* register the apmpi module with the darshan-core component */ + ret = darshan_core_register_module( + DARSHAN_APMPI_MOD, + mod_funcs, + apmpi_buf_size, + &apmpi_rec_count, + &my_rank, + NULL); + if(ret < 0) + { + APMPI_UNLOCK(); + return; + } + + /* initialize module's global state */ + apmpi_runtime = malloc(sizeof(*apmpi_runtime)); + if(!apmpi_runtime) + { + darshan_core_unregister_module(DARSHAN_APMPI_MOD); + APMPI_UNLOCK(); + return; + } + memset(apmpi_runtime, 0, sizeof(*apmpi_runtime)); + + if (my_rank == 0) + { + apmpi_runtime->header_id = darshan_core_gen_record_id("darshan-apmpi-header"); + + /* register the apmpi record with darshan-core */ + apmpi_runtime->header_record = darshan_core_register_record( + apmpi_runtime->header_id, + //NULL, + "darshan-apmpi-header", + DARSHAN_APMPI_MOD, + sizeof(struct darshan_apmpi_header_record), + NULL); + if(!(apmpi_runtime->header_record)) + { + darshan_core_unregister_module(DARSHAN_APMPI_MOD); + free(apmpi_runtime); + apmpi_runtime = NULL; + APMPI_UNLOCK(); + return; + } + apmpi_runtime->header_record->base_rec.id = apmpi_runtime->header_id; + apmpi_runtime->header_record->base_rec.rank = my_rank; + apmpi_runtime->header_record->magic = APMPI_MAGIC; +#ifdef __APMPI_COLL_SYNC + apmpi_runtime->header_record->sync_flag = 1; +#else + apmpi_runtime->header_record->sync_flag = 0; +#endif + } + + apmpi_runtime->rec_id = darshan_core_gen_record_id("APMPI"); //record name + + apmpi_runtime->perf_record = darshan_core_register_record( + apmpi_runtime->rec_id, + "APMPI", + DARSHAN_APMPI_MOD, + sizeof(struct darshan_apmpi_perf_record), + NULL); + if(!(apmpi_runtime->perf_record)) + { + darshan_core_unregister_module(DARSHAN_APMPI_MOD); + free(apmpi_runtime); + apmpi_runtime = NULL; + APMPI_UNLOCK(); + return; + } + + initialize_counters(); + /* collect perf counters */ + capture(apmpi_runtime->perf_record, apmpi_runtime->rec_id); + + APMPI_UNLOCK(); + + return; +} +#if 0 +static void apmpi_record_reduction_op (void* inrec_v, void* inoutrec_v, + int *len, MPI_Datatype *datatype) +{ + struct darshan_apmpi_perf_record tmp_rec; + struct darshan_apmpi_perf_record *inrec = inrec_v; + struct darshan_apmpi_perf_record *inoutrec = inoutrec_v; + int i, j, k; + + for (i=0; i<*len; i++) + { + memset(&tmp_rec, 0, sizeof(struct darshan_apmpi_perf_record)); + tmp_rec.base_rec.id = inrec->base_rec.id; + tmp_file.base_rec.rank = -1; + } +} +#endif +static void apmpi_shared_record_variance(MPI_Comm mod_comm) +{ + MPI_Datatype var_dt; + MPI_Op var_op; + struct darshan_variance_dt *var_send_buf = NULL; + struct darshan_variance_dt *var_recv_buf = NULL; + + PMPI_Type_contiguous(sizeof(struct darshan_variance_dt), + MPI_BYTE, &var_dt); + PMPI_Type_commit(&var_dt); + + PMPI_Op_create(darshan_variance_reduce, 1, &var_op); + + var_send_buf = malloc(sizeof(struct darshan_variance_dt)); + if(!var_send_buf) + return; + + if(my_rank == 0) + { + var_recv_buf = malloc(sizeof(struct darshan_variance_dt)); + + if(!var_recv_buf) + return; + } + + /* get total mpi time variances across the ranks */ + var_send_buf->n = 1; + var_send_buf->S = 0; + var_send_buf->T = apmpi_runtime->perf_record->fglobalcounters[MPI_TOTAL_COMM_TIME]; + + PMPI_Reduce(var_send_buf, var_recv_buf, 1, + var_dt, var_op, 0, mod_comm); + + if(my_rank == 0) + { + apmpi_runtime->header_record->apmpi_f_variance_total_mpitime = + (var_recv_buf->S / var_recv_buf->n); + } + /* get total mpi sync time variances across the ranks */ + var_send_buf->n = 1; + var_send_buf->S = 0; + var_send_buf->T = apmpi_runtime->perf_record->fglobalcounters[MPI_TOTAL_COMM_SYNC_TIME]; + + PMPI_Reduce(var_send_buf, var_recv_buf, 1, + var_dt, var_op, 0, mod_comm); + + if(my_rank == 0) + { + apmpi_runtime->header_record->apmpi_f_variance_total_mpisynctime = + (var_recv_buf->S / var_recv_buf->n); + } + PMPI_Type_free(&var_dt); + PMPI_Op_free(&var_op); + free(var_send_buf); + free(var_recv_buf); + + return; +} + + +/******************************************************************************** + * shutdown function exported by this module for coordinating with darshan-core * + ********************************************************************************/ + +/* Pass data for the apmpi module back to darshan-core to log to file. */ +//#ifdef HAVE_MPI +static void apmpi_mpi_redux( + void *apmpi_buf, + MPI_Comm mod_comm, + darshan_record_id *shared_recs, + int shared_rec_count) +{ + int i; +#if 0 + struct darshan_apmpi_perf_record *red_send_buf = NULL; + struct darshan_apmpi_perf_record *red_recv_buf = NULL; + struct darshan_apmpi_perf_record *apmpi_rec_buf = (struct darshan_apmpi_perf_record *)apmpi_buf; +#endif + //MPI_Datatype red_type; + //MPI_Op red_op; + + APMPI_LOCK(); + + if (!apmpi_runtime) + { + APMPI_UNLOCK(); + return; + } + double mpisync_time = 0.0; + /* Compute Total MPI time per rank: MPI_TOTAL_COMM_TIME */ + for (i=MPI_SEND_TOTAL_TIME; iperf_record->fglobalcounters[MPI_TOTAL_COMM_TIME] += apmpi_runtime->perf_record->fcounters[i]; + } + for (i=MPI_BARRIER_TOTAL_SYNC_TIME; iperf_record->fsynccounters[i]; + } + apmpi_runtime->perf_record->fglobalcounters[MPI_TOTAL_COMM_TIME] += mpisync_time; + apmpi_runtime->perf_record->fglobalcounters[MPI_TOTAL_COMM_SYNC_TIME] = mpisync_time; +#if 0 + red_send_buf = apmpi_runtime->perf_record; + + if (my_rank == 0){ + red_recv_buf = malloc(sizeof(struct darshan_apmpi_perf_record)); + if(!red_recv_buf) + { + APMPI_UNLOCK(); + return; + } + } + /* construct a datatype for a APMPI file record. This is serving no purpose + * except to make sure we can do a reduction on proper boundaries + */ + PMPI_Type_contiguous(sizeof(struct darshan_apmpi_perf_record), + MPI_BYTE, &red_type); + PMPI_Type_commit(&red_type); + + /* register a APMPI file record reduction operator */ + PMPI_Op_create(apmpi_record_reduction_op, 1, &red_op); + + /* reduce shared APMPI file records */ + PMPI_Reduce(red_send_buf, red_recv_buf, + shared_rec_count, red_type, red_op, 0, mod_comm); +#endif + /* get the time variance across all ranks */ + apmpi_shared_record_variance(mod_comm); +#if 0 + /* clean up reduction state */ + if(my_rank == 0) + { + free(red_recv_buf); + } +#endif + //PMPI_Type_free(&red_type); + //PMPI_Op_free(&red_op); + + APMPI_UNLOCK(); + + return; +} + +//#endif +static void apmpi_output( + void **apmpi_buf, + int *apmpi_buf_sz) +{ + APMPI_LOCK(); + assert(apmpi_runtime); + *apmpi_buf_sz = 0; + if(my_rank == 0) { + *apmpi_buf_sz += sizeof( *apmpi_runtime->header_record); + } + *apmpi_buf_sz += sizeof( *apmpi_runtime->perf_record); + + apmpi_runtime->frozen = 1; + + APMPI_UNLOCK(); + return; +} + +static void apmpi_cleanup() +{ + APMPI_LOCK(); + assert(apmpi_runtime); + + finalize_counters(); + free(apmpi_runtime); + apmpi_runtime = NULL; + + APMPI_UNLOCK(); + return; +} + +/* note that if the break condition is triggered in this macro, then it + * will exit the do/while loop holding a lock that will be released in + * POST_RECORD(). Otherwise it will release the lock here (if held) and + * return immediately without reaching the POST_RECORD() macro. + */ +#define APMPI_PRE_RECORD() do { \ + if(!__darshan_disabled) { \ + APMPI_LOCK(); \ + if(!apmpi_runtime && !apmpi_runtime_init_attempted) \ + apmpi_runtime_initialize(); \ + if(apmpi_runtime && !apmpi_runtime->frozen) break; \ + APMPI_UNLOCK(); \ + } \ + return(ret); \ + } while(0) + +#define APMPI_POST_RECORD() do { \ + APMPI_UNLOCK(); \ + } while(0) + +#define APMPI_RECORD_UPDATE(MPI_OP) do { \ + if(ret != MPI_SUCCESS) break; \ + apmpi_runtime->perf_record->counters[MPI_OP ## _CALL_COUNT]++; \ + apmpi_runtime->perf_record->counters[MPI_OP ## _TOTAL_BYTES] += bytes; \ + DARSHAN_MSG_BUCKET_INC(&(apmpi_runtime->perf_record->counters[MPI_OP ## _MSG_SIZE_AGG_0_256]), bytes); \ + apmpi_runtime->perf_record->fcounters[MPI_OP ## _TOTAL_TIME] += tdiff; \ + apmpi_runtime->perf_record->fcounters[MPI_OP ## _MAX_TIME] = MAX(apmpi_runtime->perf_record->fcounters[Y(MPI_OP ## _MAX_TIME)], tdiff); \ + apmpi_runtime->perf_record->fcounters[MPI_OP ## _MIN_TIME] = MIN(apmpi_runtime->perf_record->fcounters[Y(MPI_OP ## _MIN_TIME)], tdiff); \ + } while(0) + +#define APMPI_RECORD_UPDATE_NOMSG(MPI_OP) do { \ + if(ret != MPI_SUCCESS) break; \ + apmpi_runtime->perf_record->counters[MPI_OP ## _CALL_COUNT]++; \ + apmpi_runtime->perf_record->fcounters[MPI_OP ## _TOTAL_TIME] += tdiff; \ + apmpi_runtime->perf_record->fcounters[MPI_OP ## _MAX_TIME] = MAX(apmpi_runtime->perf_record->fcounters[Y(MPI_OP ## _MAX_TIME)], tdiff); \ + apmpi_runtime->perf_record->fcounters[MPI_OP ## _MIN_TIME] = MIN(apmpi_runtime->perf_record->fcounters[Y(MPI_OP ## _MIN_TIME)], tdiff); \ + } while(0) + +#define APMPI_RECORD_UPDATE_SYNC(MPI_OP) do { \ + if(ret != MPI_SUCCESS) break; \ + apmpi_runtime->perf_record->counters[MPI_OP ## _CALL_COUNT]++; \ + apmpi_runtime->perf_record->counters[MPI_OP ## _TOTAL_BYTES] += bytes; \ + DARSHAN_MSG_BUCKET_INC(&(apmpi_runtime->perf_record->counters[MPI_OP ## _MSG_SIZE_AGG_0_256]), bytes); \ + apmpi_runtime->perf_record->fcounters[MPI_OP ## _TOTAL_TIME] += tdiff; \ + apmpi_runtime->perf_record->fsynccounters[MPI_OP ## _TOTAL_SYNC_TIME] += tsync; \ + apmpi_runtime->perf_record->fcounters[MPI_OP ## _MAX_TIME] = MAX(apmpi_runtime->perf_record->fcounters[Y(MPI_OP ## _MAX_TIME)], tdiff); \ + apmpi_runtime->perf_record->fcounters[MPI_OP ## _MIN_TIME] = MIN(apmpi_runtime->perf_record->fcounters[Y(MPI_OP ## _MIN_TIME)], tdiff); \ + } while(0) + +#define APMPI_RECORD_UPDATE_SYNC_NOMSG(MPI_OP) do { \ + if(ret != MPI_SUCCESS) break; \ + apmpi_runtime->perf_record->counters[MPI_OP ## _CALL_COUNT]++; \ + apmpi_runtime->perf_record->fcounters[MPI_OP ## _TOTAL_TIME] += tdiff; \ + apmpi_runtime->perf_record->fsynccounters[MPI_OP ## _TOTAL_SYNC_TIME] += tsync; \ + apmpi_runtime->perf_record->fcounters[MPI_OP ## _MAX_TIME] = MAX(apmpi_runtime->perf_record->fcounters[Y(MPI_OP ## _MAX_TIME)], tdiff); \ + apmpi_runtime->perf_record->fcounters[MPI_OP ## _MIN_TIME] = MIN(apmpi_runtime->perf_record->fcounters[Y(MPI_OP ## _MIN_TIME)], tdiff); \ + } while(0) +#define Y(a) a + +/********************************************************** + * Wrappers for MPI functions of interest * + **********************************************************/ + +int DARSHAN_DECL(MPI_Send)(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Send); + TIME(__real_PMPI_Send(buf, count, datatype, dest, tag, comm)); + BYTECOUNT(datatype, count); + APMPI_PRE_RECORD(); + // Potential optimization: Lock around the count - lock only if MPI_THREAD_MULTIPLE is used ... locking mutex + APMPI_RECORD_UPDATE(MPI_SEND); + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Send, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm), MPI_Send) + +int DARSHAN_DECL(MPI_Ssend)(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Ssend); + TIME(__real_PMPI_Ssend(buf, count, datatype, dest, tag, comm)); + BYTECOUNT(datatype, count); + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_SSEND); + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Ssend, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm), MPI_Ssend) + +int DARSHAN_DECL(MPI_Rsend)(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Rsend); + TIME(__real_PMPI_Rsend(buf, count, datatype, dest, tag, comm)); + BYTECOUNT(datatype, count); + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_RSEND); + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Rsend, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm), MPI_Rsend) + +int DARSHAN_DECL(MPI_Bsend)(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Bsend); + TIME(__real_PMPI_Bsend(buf, count, datatype, dest, tag, comm)); + BYTECOUNT(datatype, count); + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_BSEND); + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Bsend, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm), MPI_Bsend) + +int DARSHAN_DECL(MPI_Isend)(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, + MPI_Comm comm, MPI_Request *request) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Isend); + TIME(__real_PMPI_Isend(buf, count, datatype, dest, tag, comm, request)); + BYTECOUNT(datatype, count); + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_ISEND); + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Isend, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request), MPI_Isend) + +int DARSHAN_DECL(MPI_Issend)(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, + MPI_Comm comm, MPI_Request *request) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Issend); + TIME(__real_PMPI_Issend(buf, count, datatype, dest, tag, comm, request)); + BYTECOUNT(datatype, count); + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_ISSEND); + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Issend, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request), MPI_Issend) + +int DARSHAN_DECL(MPI_Irsend)(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, + MPI_Comm comm, MPI_Request *request) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Irsend); + TIME(__real_PMPI_Irsend(buf, count, datatype, dest, tag, comm, request)); + BYTECOUNT(datatype, count); + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_IRSEND); + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Irsend, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request), MPI_Irsend) + +int DARSHAN_DECL(MPI_Ibsend)(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, + MPI_Comm comm, MPI_Request *request) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Ibsend); + TIME(__real_PMPI_Ibsend(buf, count, datatype, dest, tag, comm, request)); + BYTECOUNT(datatype, count); + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_IBSEND); + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Ibsend, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request), MPI_Ibsend) + +int DARSHAN_DECL(MPI_Recv)(void *buf, int count, MPI_Datatype datatype, int source, int tag, + MPI_Comm comm, MPI_Status *status) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Recv); + TIME(__real_PMPI_Recv(buf, count, datatype, source, tag, comm, status)); + int count_received; //, src; + if (status != MPI_STATUS_IGNORE) { + PMPI_Get_count(status, datatype, &count_received); + if (count_received == MPI_UNDEFINED) count_received = count; + //src = status->MPI_SOURCE; + } + else { + count_received = count; + //src = source; + } + + BYTECOUNT(datatype, count_received); + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_RECV); + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Recv, int, (void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status), MPI_Recv) + +int DARSHAN_DECL(MPI_Irecv)(void *buf, int count, MPI_Datatype datatype, int source, int tag, + MPI_Comm comm, MPI_Request * request) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Irecv); + + TIME(__real_PMPI_Irecv(buf, count, datatype, source, tag, comm, request)); + BYTECOUNT(datatype, count); + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_IRECV); + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Irecv, int, (void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Request *request), MPI_Irecv) + +int DARSHAN_DECL(MPI_Sendrecv)(const void *sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int sendtag, + void *recvbuf, int recvcount, MPI_Datatype recvtype, + int source, int recvtag, MPI_Comm comm, MPI_Status * status) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Sendrecv); + + TIME(__real_PMPI_Sendrecv(sendbuf, sendcount, sendtype, dest, sendtag, recvbuf, recvcount, recvtype, source, recvtag, comm, status)); + + int count_received; //, src; + if (status != MPI_STATUS_IGNORE) { + PMPI_Get_count(status, recvtype, &count_received); + if (count_received == MPI_UNDEFINED) count_received = recvcount; + //src = status->MPI_SOURCE; + } + else { + count_received = recvcount; + //src = source; + } + BYTECOUNT(sendtype, sendcount); + ap_bytes_t sbytes = bytes; + BYTECOUNTND(recvtype, count_received); + bytes += sbytes; + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_SENDRECV); + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Sendrecv, int, (const void *sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int sendtag, + void *recvbuf, int recvcount, MPI_Datatype recvtype, + int source, int recvtag, MPI_Comm comm, MPI_Status * status), MPI_Sendrecv) +int DARSHAN_DECL(MPI_Sendrecv_replace)(void *buf, int count, MPI_Datatype datatype, int dest, int sendtag, + int source, int recvtag, MPI_Comm comm, MPI_Status * status) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Sendrecv_replace); + TIME(__real_PMPI_Sendrecv_replace(buf, count, datatype, dest, sendtag, source, recvtag, comm, status)); + + int count_received; //, src; + if (status != MPI_STATUS_IGNORE) { + PMPI_Get_count(status, datatype, &count_received); + if (count_received == MPI_UNDEFINED) count_received = count; + //src = status->MPI_SOURCE; + } + else { + count_received = count; + //src = source; + } + BYTECOUNT(datatype, count + count_received); + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_SENDRECV_REPLACE); + APMPI_POST_RECORD(); + + return ret; +} +/* +int DARSHAN_DECL(MPI_Isendrecv)(const void *sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int sendtag, + void *recvbuf, int recvcount, MPI_Datatype recvtype, + int source, int recvtag, MPI_Comm comm, MPI_Request *request) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Isendrecv); + + TIME(__real_PMPI_Isendrecv(sendbuf, sendcount, sendtype, dest, sendtag, recvbuf, recvcount, recvtype, source, recvtag, comm, request)); + + BYTECOUNT(sendtype, sendcount + recvcount); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_ISENDRECV); + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Isendrecv, int, (const void *sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int sendtag, + void *recvbuf, int recvcount, MPI_Datatype recvtype, + int source, int recvtag, MPI_Comm comm, MPI_Request *request), MPI_Isendrecv) + +int DARSHAN_DECL(MPI_Isendrecv_replace)(void *buf, int count, MPI_Datatype datatype, int dest, int sendtag, + int source, int recvtag, MPI_Comm comm, MPI_Request *request) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Isendrecv_replace); + + TIME(__real_PMPI_Isendrecv_replace(buf, count, datatype, dest, sendtag, source, recvtag, comm, request)); + + BYTECOUNT(datatype, count + count); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_ISENDRECV_REPLACE); + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Isendrecv_replace, int, (void *buf, int count, MPI_Datatype datatype, int dest, int sendtag, + int source, int recvtag, MPI_Comm comm, MPI_Request *request), MPI_Isendrecv_replace) +*/ +int DARSHAN_DECL(MPI_Put)(const void *origin_addr, int origin_count, MPI_Datatype + origin_datatype, int target_rank, MPI_Aint target_disp, + int target_count, MPI_Datatype target_datatype, MPI_Win win) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Put); + TIME(__real_PMPI_Put(origin_addr, origin_count, origin_datatype, target_rank, + target_disp, target_count, target_datatype, win)); + BYTECOUNT(origin_datatype, origin_count); + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_PUT); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Put, int, (const void *origin_addr, int origin_count, MPI_Datatype + origin_datatype, int target_rank, MPI_Aint target_disp, + int target_count, MPI_Datatype target_datatype, MPI_Win win), MPI_Put) + +int DARSHAN_DECL(MPI_Get)(void *origin_addr, int origin_count, MPI_Datatype + origin_datatype, int target_rank, MPI_Aint target_disp, + int target_count, MPI_Datatype target_datatype, MPI_Win win) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Get); + TIME(__real_PMPI_Get(origin_addr, origin_count, origin_datatype, target_rank, + target_disp, target_count, target_datatype, win)); + + BYTECOUNT(target_datatype, target_count); + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_GET); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Get, int, (void *origin_addr, int origin_count, MPI_Datatype + origin_datatype, int target_rank, MPI_Aint target_disp, + int target_count, MPI_Datatype target_datatype, MPI_Win win), MPI_Get) + + +int DARSHAN_DECL(MPI_Accumulate)(const void *origin_addr, int origin_count, MPI_Datatype + origin_datatype, int target_rank, MPI_Aint + target_disp, int target_count, MPI_Datatype + target_datatype, MPI_Op op, MPI_Win win) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Accumulate); + TIME(__real_PMPI_Accumulate(origin_addr, origin_count, + origin_datatype, target_rank, + target_disp, target_count, + target_datatype, op, win)); + + BYTECOUNT(target_datatype, target_count); + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_ACCUMULATE); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Accumulate, int, (const void *origin_addr, int origin_count, MPI_Datatype + origin_datatype, int target_rank, MPI_Aint + target_disp, int target_count, MPI_Datatype + target_datatype, MPI_Op op, MPI_Win win), MPI_Accumulate) + +int DARSHAN_DECL(MPI_Get_accumulate)(const void *origin_addr, int origin_count, + MPI_Datatype origin_datatype, void *result_addr, int result_count, + MPI_Datatype result_datatype, int target_rank, MPI_Aint target_disp, + int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Get_accumulate); + TIME(__real_PMPI_Get_accumulate(origin_addr, origin_count, + origin_datatype, result_addr, result_count, + result_datatype, target_rank, target_disp, + target_count, target_datatype, op, win)); + + BYTECOUNT(target_datatype, target_count); + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE(MPI_GET_ACCUMULATE); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Get_accumulate, int, (const void *origin_addr, int origin_count, + MPI_Datatype origin_datatype, void *result_addr, int result_count, + MPI_Datatype result_datatype, int target_rank, MPI_Aint target_disp, + int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win), MPI_Get_accumulate) + +int DARSHAN_DECL(MPI_Fetch_and_op)(const void *origin_addr, void *result_addr, + MPI_Datatype datatype, int target_rank, MPI_Aint target_disp, + MPI_Op op, MPI_Win win) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Fetch_and_op); + TIME(__real_PMPI_Fetch_and_op(origin_addr, result_addr, + datatype, target_rank, target_disp, + op, win)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_FETCH_AND_OP); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Fetch_and_op, int, (const void *origin_addr, void *result_addr, + MPI_Datatype datatype, int target_rank, MPI_Aint target_disp, + MPI_Op op, MPI_Win win), MPI_Fetch_and_op) + +int DARSHAN_DECL(MPI_Compare_and_swap)(const void *origin_addr, const void *compare_addr, + void *result_addr, MPI_Datatype datatype, int target_rank, + MPI_Aint target_disp, MPI_Win win) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Compare_and_swap); + TIME(__real_PMPI_Compare_and_swap(origin_addr, compare_addr, + result_addr, datatype, target_rank, + target_disp, win)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_COMPARE_AND_SWAP); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Compare_and_swap, int, (const void *origin_addr, const void *compare_addr, + void *result_addr, MPI_Datatype datatype, int target_rank, + MPI_Aint target_disp, MPI_Win win), MPI_Compare_and_swap) + +int DARSHAN_DECL(MPI_Win_fence)(int assert, MPI_Win win) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Win_fence); + TIME(__real_PMPI_Win_fence(assert, win)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WIN_FENCE); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Win_fence, int, (int assert, MPI_Win win), MPI_Win_fence) + +int DARSHAN_DECL(MPI_Win_start)(MPI_Group group, int assert, MPI_Win win) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Win_start); + TIME(__real_PMPI_Win_start(group, assert, win)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WIN_START); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Win_start, int, (MPI_Group group, int assert, MPI_Win win), MPI_Win_start) + +int DARSHAN_DECL(MPI_Win_complete)(MPI_Win win) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Win_complete); + TIME(__real_PMPI_Win_complete(win)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WIN_COMPLETE); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Win_complete, int, (MPI_Win win), MPI_Win_complete) + +int DARSHAN_DECL(MPI_Win_post)(MPI_Group group, int assert, MPI_Win win) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Win_post); + TIME(__real_PMPI_Win_post(group, assert, win)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WIN_POST); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Win_post, int, (MPI_Group group, int assert, MPI_Win win), MPI_Win_post) + +int DARSHAN_DECL(MPI_Win_wait)(MPI_Win win) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Win_wait); + TIME(__real_PMPI_Win_wait(win)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WIN_WAIT); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Win_wait, int, (MPI_Win win), MPI_Win_wait) + +int DARSHAN_DECL(MPI_Win_test)(MPI_Win win, int *flag) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Win_test); + TIME(__real_PMPI_Win_test(win, flag)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WIN_TEST); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Win_test, int, (MPI_Win win, int *flag), MPI_Win_test) + +int DARSHAN_DECL(MPI_Win_lock)(int lock_type, int rank, int assert, MPI_Win win) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Win_lock); + TIME(__real_PMPI_Win_lock(lock_type, rank, assert, win)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WIN_LOCK); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Win_lock, int, (int lock_type, int rank, int assert, MPI_Win win), MPI_Win_lock) + +int DARSHAN_DECL(MPI_Win_unlock)(int rank, MPI_Win win) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Win_unlock); + TIME(__real_PMPI_Win_unlock(rank, win)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WIN_UNLOCK); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Win_unlock, int, (int rank, MPI_Win win), MPI_Win_unlock) + +int DARSHAN_DECL(MPI_Win_unlock_all)(MPI_Win win) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Win_unlock_all); + TIME(__real_PMPI_Win_unlock_all(win)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WIN_UNLOCK_ALL); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Win_unlock_all, int, (MPI_Win win), MPI_Win_unlock_all) + +int DARSHAN_DECL(MPI_Win_flush)(int rank, MPI_Win win) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Win_flush); + TIME(__real_PMPI_Win_flush(rank, win)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WIN_FLUSH); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Win_flush, int, (int rank, MPI_Win win), MPI_Win_flush) + +int DARSHAN_DECL(MPI_Win_flush_all)(MPI_Win win) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Win_flush_all); + TIME(__real_PMPI_Win_flush_all(win)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WIN_FLUSH_ALL); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Win_flush_all, int, (MPI_Win win), MPI_Win_flush_all) + +int DARSHAN_DECL(MPI_Win_flush_local)(int rank, MPI_Win win) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Win_flush_local); + TIME(__real_PMPI_Win_flush_local(rank, win)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WIN_FLUSH_LOCAL); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Win_flush_local, int, (int rank, MPI_Win win), MPI_Win_flush_local) + +int DARSHAN_DECL(MPI_Win_flush_local_all)(MPI_Win win) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Win_flush_local_all); + TIME(__real_PMPI_Win_flush_local_all(win)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WIN_FLUSH_LOCAL_ALL); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Win_flush_local_all, int, (MPI_Win win), MPI_Win_flush_local_all) + +int DARSHAN_DECL(MPI_Win_sync)(MPI_Win win) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Win_sync); + TIME(__real_PMPI_Win_sync(win)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WIN_SYNC); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Win_sync, int, (MPI_Win win), MPI_Win_sync) + +int DARSHAN_DECL(MPI_Probe)(int source, int tag, MPI_Comm comm, MPI_Status * status) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Probe); + TIME(__real_PMPI_Probe(source, tag, comm, status)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_PROBE); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Probe, int, (int source, int tag, MPI_Comm comm, MPI_Status * status), MPI_Probe) + +int DARSHAN_DECL(MPI_Iprobe)(int source, int tag, MPI_Comm comm, int *flag, MPI_Status * status) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Iprobe); + TIME(__real_PMPI_Iprobe(source, tag, comm, flag, status)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_IPROBE); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Iprobe, int, (int source, int tag, MPI_Comm comm, int *flag, MPI_Status * status), MPI_Iprobe) + +int DARSHAN_DECL(MPI_Test)(MPI_Request *request, int *flag, MPI_Status *status) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Test); + TIME(__real_PMPI_Test(request, flag, status)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_TEST); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Test, int, (MPI_Request *request, int *flag, MPI_Status *status), MPI_Test) + +int DARSHAN_DECL(MPI_Testany)(int count, MPI_Request array_of_requests[], int *indx, + int *flag, MPI_Status *status) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Testany); + TIME(__real_PMPI_Testany(count, array_of_requests, indx, flag, status)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_TESTANY); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Testany, int, (int count, MPI_Request array_of_requests[], int *indx, + int *flag, MPI_Status *status), MPI_Testany) + +int DARSHAN_DECL(MPI_Testall)(int count, MPI_Request array_of_requests[], + int *flag, MPI_Status array_of_statuses[]) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Testall); + TIME(__real_PMPI_Testall(count, array_of_requests, flag, array_of_statuses)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_TESTALL); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Testall, int, (int count, MPI_Request array_of_requests[], + int *flag, MPI_Status array_of_statuses[]), MPI_Testall) + +int DARSHAN_DECL(MPI_Testsome)(int incount, MPI_Request array_of_requests[], int *outcount, + int array_of_indices[], MPI_Status array_of_statuses[]) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Testsome); + TIME(__real_PMPI_Testsome(incount, array_of_requests, outcount, array_of_indices, array_of_statuses)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_TESTSOME); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Testsome, int, (int incount, MPI_Request array_of_requests[], int *outcount, + int array_of_indices[], MPI_Status array_of_statuses[]), MPI_Testsome) + +int DARSHAN_DECL(MPI_Wait)(MPI_Request * request, MPI_Status * status) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Wait); + TIME(__real_PMPI_Wait(request, status)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WAIT); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Wait, int, (MPI_Request * request, MPI_Status * status), MPI_Wait) + +int DARSHAN_DECL(MPI_Waitany)(int count, MPI_Request array_of_requests[], int *indx, MPI_Status * status) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Waitany); + TIME(__real_PMPI_Waitany(count, array_of_requests, indx, status)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WAITANY); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Waitany, int, (int count, MPI_Request array_of_requests[], int *indx, MPI_Status * status), MPI_Waitany) + +int DARSHAN_DECL(MPI_Waitall)(int count, MPI_Request array_of_requests[], + MPI_Status array_of_statuses[]) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Waitall); + TIME(__real_PMPI_Waitall(count, array_of_requests, array_of_statuses)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WAITALL); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Waitall, int, (int count, MPI_Request array_of_requests[], + MPI_Status array_of_statuses[]), MPI_Waitall) + +int DARSHAN_DECL(MPI_Waitsome)(int incount, MPI_Request array_of_requests[], + int *outcount, int array_of_indices[], MPI_Status array_of_statuses[]) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Waitsome); + TIME(__real_PMPI_Waitsome(incount, array_of_requests, outcount, array_of_indices, array_of_statuses)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_NOMSG(MPI_WAITSOME); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Waitsome, int, (int incount, MPI_Request array_of_requests[], + int *outcount, int array_of_indices[], MPI_Status array_of_statuses[]), MPI_Waitsome) + +int DARSHAN_DECL(MPI_Barrier)(MPI_Comm comm) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Barrier); + TIME_SYNC(__real_PMPI_Barrier(comm)); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_SYNC_NOMSG(MPI_BARRIER); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Barrier, int, (MPI_Comm comm), MPI_Barrier) + +int DARSHAN_DECL(MPI_Bcast)(void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Bcast); + + TIME_SYNC(__real_PMPI_Bcast(buffer, count, datatype, root, comm)); + + ap_bytes_t bytes = 0; + if (root != MPI_PROC_NULL) { + BYTECOUNTND(datatype, count); + } + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_SYNC(MPI_BCAST); + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Bcast, int, (void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm), MPI_Bcast) + +int DARSHAN_DECL(MPI_Reduce)(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, + MPI_Comm comm) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Reduce); + + TIME_SYNC(__real_PMPI_Reduce(sendbuf, recvbuf, count, datatype, op, root, comm)); + + ap_bytes_t bytes = 0; + if (root != MPI_PROC_NULL) { + BYTECOUNTND(datatype, count); + } + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_SYNC(MPI_REDUCE); + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Reduce, int, (const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm), MPI_Reduce) + +int DARSHAN_DECL(MPI_Allreduce)(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, + MPI_Comm comm) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Allreduce); + + TIME_SYNC(__real_PMPI_Allreduce(sendbuf, recvbuf, count, datatype, op, comm)); + + BYTECOUNT(datatype, count); + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_SYNC(MPI_ALLREDUCE); + APMPI_POST_RECORD(); + + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Allreduce, int, (const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm), MPI_Allreduce) + +int DARSHAN_DECL(MPI_Alltoall)(const void *sendbuf, int sendcount, MPI_Datatype sendtype, + void *recvbuf, int recvcount, MPI_Datatype recvtype, + MPI_Comm comm) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Alltoall); + + TIME_SYNC(__real_PMPI_Alltoall(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm)); + + BYTECOUNT(recvtype, recvcount); + int tasks; + PMPI_Comm_size(comm, &tasks); + bytes = bytes*tasks; + + APMPI_PRE_RECORD(); + APMPI_RECORD_UPDATE_SYNC(MPI_ALLTOALL); + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_Alltoall, int, (const void *sendbuf, int sendcount, MPI_Datatype sendtype, + void *recvbuf, int recvcount, MPI_Datatype recvtype, + MPI_Comm comm), MPI_Alltoall) + +int DARSHAN_DECL(MPI_Alltoallv)(const void *sendbuf, const int *sendcounts, const int *sdispls, + MPI_Datatype sendtype, void *recvbuf, const int *recvcounts, const int *rdispls, + MPI_Datatype recvtype, MPI_Comm comm) +{ + int __darshan_disabled; + + MAP_OR_FAIL(PMPI_Alltoallv); + + TIME_SYNC(__real_PMPI_Alltoallv(sendbuf, sendcounts, sdispls, sendtype, recvbuf, recvcounts, rdispls, recvtype, comm)); + + int i, tasks, count = 0; + PMPI_Comm_size(comm, &tasks); + for (i=0; iperf_record->counters[MPI_ _COUNT]++; + APMPI_POST_RECORD(); + return ret; +} +DARSHAN_WRAPPER_MAP(PMPI_ , int, (), MPI_ ) +*/ + +#undef Y + +/* + * Local variables: + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + * + * vim: ts=8 sts=4 sw=4 expandtab + */