diff --git a/ompi/mca/common/monitoring/common_monitoring.h b/ompi/mca/common/monitoring/common_monitoring.h index a199adef993..0b4a22aba6b 100644 --- a/ompi/mca/common/monitoring/common_monitoring.h +++ b/ompi/mca/common/monitoring/common_monitoring.h @@ -66,14 +66,14 @@ OMPI_DECLSPEC void mca_common_monitoring_record_osc(int world_rank, size_t data_ /* Records COLL communications. */ OMPI_DECLSPEC void mca_common_monitoring_record_coll(int world_rank, size_t data_size); -/* Translate the rank from the given communicator of a process to its rank in MPI_COMM_RANK. */ -static inline int mca_common_monitoring_get_world_rank(int dst, struct ompi_communicator_t*comm, - int*world_rank) +/* Translate the rank from the given rank of a process to its rank in MPI_COMM_RANK. */ +static inline int mca_common_monitoring_get_world_rank_grp(int dest, ompi_group_t *group, + int *world_rank) { opal_process_name_t tmp; /* find the processor of the destination */ - ompi_proc_t *proc = ompi_group_get_proc_ptr(comm->c_remote_group, dst, true); + ompi_proc_t *proc = ompi_group_get_proc_ptr(group, dest, true); if( ompi_proc_is_sentinel(proc) ) { tmp = ompi_proc_sentinel_to_name((uintptr_t)proc); } else { @@ -94,6 +94,13 @@ static inline int mca_common_monitoring_get_world_rank(int dst, struct ompi_comm return ret; } +/* Translate the rank from the given communicator of a process to its rank in MPI_COMM_RANK. */ +static inline int mca_common_monitoring_get_world_rank(int dst, struct ompi_communicator_t*comm, + int*world_rank) +{ + return mca_common_monitoring_get_world_rank_grp(dst, comm->c_remote_group, world_rank); +} + /* Return the current status of the monitoring system 0 if off or the * seperation between internal tags and external tags is disabled. Any * other positive value if the segregation between point-to-point and diff --git a/ompi/mca/osc/monitoring/osc_monitoring_accumulate.h b/ompi/mca/osc/monitoring/osc_monitoring_accumulate.h index 543740146c7..6d9d6121337 100644 --- a/ompi/mca/osc/monitoring/osc_monitoring_accumulate.h +++ b/ompi/mca/osc/monitoring/osc_monitoring_accumulate.h @@ -29,7 +29,7 @@ * If this fails the destination is not part of my MPI_COM_WORLD \ * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank \ */ \ - if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(target_rank, ompi_osc_monitoring_## template ##_get_comm(win), &world_rank)) { \ + if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank_grp(target_rank, win->w_group, &world_rank)) { \ size_t type_size; \ ompi_datatype_type_size(dt, &type_size); \ mca_common_monitoring_record_osc(world_rank, type_size, SEND); \ @@ -56,7 +56,7 @@ * If this fails the destination is not part of my MPI_COM_WORLD \ * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank \ */ \ - if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(target_rank, ompi_osc_monitoring_## template ##_get_comm(win), &world_rank)) { \ + if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank_grp(target_rank, win->w_group, &world_rank)) { \ size_t type_size, data_size; \ ompi_datatype_type_size(origin_datatype, &type_size); \ data_size = origin_count*type_size; \ @@ -88,7 +88,7 @@ * If this fails the destination is not part of my MPI_COM_WORLD \ * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank \ */ \ - if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(target_rank, ompi_osc_monitoring_## template ##_get_comm(win), &world_rank)) { \ + if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank_grp(target_rank, win->w_group, &world_rank)) { \ size_t type_size, data_size; \ ompi_datatype_type_size(origin_datatype, &type_size); \ data_size = origin_count*type_size; \ @@ -116,7 +116,7 @@ * If this fails the destination is not part of my MPI_COM_WORLD \ * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank \ */ \ - if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(target_rank, ompi_osc_monitoring_## template ##_get_comm(win), &world_rank)) { \ + if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank_grp(target_rank, win->w_group, &world_rank)) { \ size_t type_size, data_size; \ ompi_datatype_type_size(origin_datatype, &type_size); \ data_size = origin_count*type_size; \ @@ -140,7 +140,7 @@ * If this fails the destination is not part of my MPI_COM_WORLD \ * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank \ */ \ - if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(target_rank, ompi_osc_monitoring_## template ##_get_comm(win), &world_rank)) { \ + if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank_grp(target_rank, win->w_group, &world_rank)) { \ size_t type_size, data_size; \ ompi_datatype_type_size(origin_datatype, &type_size); \ data_size = origin_count*type_size; \ @@ -162,7 +162,7 @@ * If this fails the destination is not part of my MPI_COM_WORLD \ * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank \ */ \ - if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(target_rank, ompi_osc_monitoring_## template ##_get_comm(win), &world_rank)) { \ + if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank_grp(target_rank, win->w_group, &world_rank)) { \ size_t type_size; \ ompi_datatype_type_size(dt, &type_size); \ mca_common_monitoring_record_osc(world_rank, type_size, SEND); \ diff --git a/ompi/mca/osc/monitoring/osc_monitoring_comm.h b/ompi/mca/osc/monitoring/osc_monitoring_comm.h index 173a821427f..2c972d9212c 100644 --- a/ompi/mca/osc/monitoring/osc_monitoring_comm.h +++ b/ompi/mca/osc/monitoring/osc_monitoring_comm.h @@ -30,7 +30,7 @@ * If this fails the destination is not part of my MPI_COM_WORLD \ * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank \ */ \ - if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(target_rank, ompi_osc_monitoring_## template ##_get_comm(win), &world_rank)) { \ + if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank_grp(target_rank, win->w_group, &world_rank)) { \ size_t type_size, data_size; \ ompi_datatype_type_size(origin_datatype, &type_size); \ data_size = origin_count*type_size; \ @@ -55,7 +55,7 @@ * If this fails the destination is not part of my MPI_COM_WORLD \ * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank \ */ \ - if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(target_rank, ompi_osc_monitoring_## template ##_get_comm(win), &world_rank)) { \ + if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank_grp(target_rank, win->w_group, &world_rank)) { \ size_t type_size, data_size; \ ompi_datatype_type_size(origin_datatype, &type_size); \ data_size = origin_count*type_size; \ @@ -78,7 +78,7 @@ * If this fails the destination is not part of my MPI_COM_WORLD \ * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank \ */ \ - if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(source_rank, ompi_osc_monitoring_## template ##_get_comm(win), &world_rank)) { \ + if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank_grp(source_rank, win->w_group, &world_rank)) { \ size_t type_size, data_size; \ ompi_datatype_type_size(origin_datatype, &type_size); \ data_size = origin_count*type_size; \ @@ -103,7 +103,7 @@ * If this fails the destination is not part of my MPI_COM_WORLD \ * Lookup its name in the rank hastable to get its MPI_COMM_WORLD rank \ */ \ - if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank(source_rank, ompi_osc_monitoring_## template ##_get_comm(win), &world_rank)) { \ + if(OPAL_SUCCESS == mca_common_monitoring_get_world_rank_grp(source_rank, win->w_group, &world_rank)) { \ size_t type_size, data_size; \ ompi_datatype_type_size(origin_datatype, &type_size); \ data_size = origin_count*type_size; \ diff --git a/ompi/mca/osc/monitoring/osc_monitoring_component.c b/ompi/mca/osc/monitoring/osc_monitoring_component.c index 611360bf81e..7a29034052b 100644 --- a/ompi/mca/osc/monitoring/osc_monitoring_component.c +++ b/ompi/mca/osc/monitoring/osc_monitoring_component.c @@ -22,23 +22,10 @@ /* Include template generating macros */ #include "osc_monitoring_template.h" -#include -OSC_MONITORING_MODULE_TEMPLATE_GENERATE(rdma, ompi_osc_rdma_module_t, comm) -#undef GET_MODULE - -#include -OSC_MONITORING_MODULE_TEMPLATE_GENERATE(sm, ompi_osc_sm_module_t, comm) -#undef GET_MODULE - -#include -OSC_MONITORING_MODULE_TEMPLATE_GENERATE(pt2pt, ompi_osc_pt2pt_module_t, comm) -#undef GET_MODULE - -#ifdef OMPI_WITH_OSC_PORTALS4 -#include -OSC_MONITORING_MODULE_TEMPLATE_GENERATE(portals4, ompi_osc_portals4_module_t, comm) -#undef GET_MODULE -#endif /* OMPI_WITH_OSC_PORTALS4 */ +OSC_MONITORING_MODULE_TEMPLATE_GENERATE(rdma) +OSC_MONITORING_MODULE_TEMPLATE_GENERATE(sm) +OSC_MONITORING_MODULE_TEMPLATE_GENERATE(pt2pt) +OSC_MONITORING_MODULE_TEMPLATE_GENERATE(portals4) /***************************************/ diff --git a/ompi/mca/osc/monitoring/osc_monitoring_template.h b/ompi/mca/osc/monitoring/osc_monitoring_template.h index 6724a6b10c3..6060e3e0f00 100644 --- a/ompi/mca/osc/monitoring/osc_monitoring_template.h +++ b/ompi/mca/osc/monitoring/osc_monitoring_template.h @@ -23,8 +23,7 @@ #include "osc_monitoring_module.h" #include "osc_monitoring_passive_target.h" -/* module_type correspond to the ompi_osc_## template ##_module_t type - * comm correspond to the comm field name in ompi_osc_## template ##_module_t +/* comm correspond to the comm field name in ompi_osc_## template ##_module_t * * The magic used here is that for a given module type (given with the * {template} parameter), we generate a set of every functions defined @@ -37,17 +36,11 @@ * the original function that had been saved in the * ompi_osc_monitoring_module_## template ##_template variable. */ -#define OSC_MONITORING_MODULE_TEMPLATE_GENERATE(template, module_type, comm) \ +#define OSC_MONITORING_MODULE_TEMPLATE_GENERATE(template) \ /* Generate the proper symbol for the \ ompi_osc_monitoring_module_## template ##_template variable */ \ OMPI_OSC_MONITORING_MODULE_GENERATE(template); \ - OMPI_OSC_MONITORING_MODULE_INIT_GENERATE(template); \ - /* Generate module specific module->comm accessor */ \ - static inline struct ompi_communicator_t* \ - ompi_osc_monitoring_## template ##_get_comm(ompi_win_t*win) \ - { \ - return ((module_type*)win->w_osc_module)->comm; \ - } \ + OMPI_OSC_MONITORING_MODULE_INIT_GENERATE(template); \ /* Generate each module specific functions */ \ OSC_MONITORING_GENERATE_TEMPLATE_ACCUMULATE(template) \ OSC_MONITORING_GENERATE_TEMPLATE_ACTIVE_TARGET(template) \