From 3cae1492621a089703e01caf9e11195d18720d1f Mon Sep 17 00:00:00 2001 From: Nuria Losada Date: Wed, 20 Feb 2019 12:09:18 -0500 Subject: [PATCH] osc/rdma: fix when determining the node with the rank_array info for a peer Signed-off-by: Nuria Losada --- ompi/mca/osc/rdma/osc_rdma.h | 2 ++ ompi/mca/osc/rdma/osc_rdma_component.c | 2 -- ompi/mca/osc/rdma/osc_rdma_peer.c | 8 +++----- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/ompi/mca/osc/rdma/osc_rdma.h b/ompi/mca/osc/rdma/osc_rdma.h index 6f1232c532..095c9ff5a2 100644 --- a/ompi/mca/osc/rdma/osc_rdma.h +++ b/ompi/mca/osc/rdma/osc_rdma.h @@ -50,6 +50,8 @@ #include "opal_stdint.h" +#define RANK_ARRAY_COUNT(module) ((ompi_comm_size ((module)->comm) + (module)->node_count - 1) / (module)->node_count) + enum { OMPI_OSC_RDMA_LOCKING_TWO_LEVEL, OMPI_OSC_RDMA_LOCKING_ON_DEMAND, diff --git a/ompi/mca/osc/rdma/osc_rdma_component.c b/ompi/mca/osc/rdma/osc_rdma_component.c index d379350fdd..61c3d9730e 100644 --- a/ompi/mca/osc/rdma/osc_rdma_component.c +++ b/ompi/mca/osc/rdma/osc_rdma_component.c @@ -382,8 +382,6 @@ static int ompi_osc_rdma_component_query (struct ompi_win_t *win, void **base, s return mca_osc_rdma_component.priority; } -#define RANK_ARRAY_COUNT(module) ((ompi_comm_size ((module)->comm) + (module)->node_count - 1) / (module)->node_count) - static int ompi_osc_rdma_initialize_region (ompi_osc_rdma_module_t *module, void **base, size_t size) { ompi_osc_rdma_region_t *region = (ompi_osc_rdma_region_t *) module->state->regions; int ret; diff --git a/ompi/mca/osc/rdma/osc_rdma_peer.c b/ompi/mca/osc/rdma/osc_rdma_peer.c index 81ed0c2d16..164d28811a 100644 --- a/ompi/mca/osc/rdma/osc_rdma_peer.c +++ b/ompi/mca/osc/rdma/osc_rdma_peer.c @@ -103,7 +103,7 @@ static int ompi_osc_rdma_peer_setup (ompi_osc_rdma_module_t *module, ompi_osc_rd ompi_osc_rdma_rank_data_t rank_data; int registration_handle_size = 0; int node_id, node_rank, array_index; - int ret, disp_unit, comm_size; + int ret, disp_unit; char *peer_data; OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_DEBUG, "configuring peer for rank %d", peer->rank); @@ -112,17 +112,15 @@ static int ompi_osc_rdma_peer_setup (ompi_osc_rdma_module_t *module, ompi_osc_rd registration_handle_size = module->selected_btl->btl_registration_handle_size; } - comm_size = ompi_comm_size (module->comm); - /* each node is responsible for holding a part of the rank -> node/local rank mapping array. this code * calculates the node and offset the mapping can be found. once the mapping has been read the state * part of the peer structure can be initialized. */ - node_id = (peer->rank * module->node_count) / comm_size; + node_id = peer->rank / RANK_ARRAY_COUNT(module); array_peer_data = (ompi_osc_rdma_region_t *) ((intptr_t) module->node_comm_info + node_id * module->region_size); /* the node leader rank is stored in the length field */ node_rank = NODE_ID_TO_RANK(module, array_peer_data, node_id); - array_index = peer->rank % ((comm_size + module->node_count - 1) / module->node_count); + array_index = peer->rank % RANK_ARRAY_COUNT(module); array_pointer = array_peer_data->base + array_index * sizeof (rank_data);