1
1

osc/rdma: fix when determining the node with the rank_array info for a peer

Signed-off-by: Nuria Losada <nlosada@icl.utk.edu>
Этот коммит содержится в:
Nuria Losada 2019-02-20 12:09:18 -05:00
родитель 7023357843
Коммит 3cae149262
3 изменённых файлов: 5 добавлений и 7 удалений

Просмотреть файл

@ -50,6 +50,8 @@
#include "opal_stdint.h" #include "opal_stdint.h"
#define RANK_ARRAY_COUNT(module) ((ompi_comm_size ((module)->comm) + (module)->node_count - 1) / (module)->node_count)
enum { enum {
OMPI_OSC_RDMA_LOCKING_TWO_LEVEL, OMPI_OSC_RDMA_LOCKING_TWO_LEVEL,
OMPI_OSC_RDMA_LOCKING_ON_DEMAND, OMPI_OSC_RDMA_LOCKING_ON_DEMAND,

Просмотреть файл

@ -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; 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) { 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; ompi_osc_rdma_region_t *region = (ompi_osc_rdma_region_t *) module->state->regions;
int ret; int ret;

Просмотреть файл

@ -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; ompi_osc_rdma_rank_data_t rank_data;
int registration_handle_size = 0; int registration_handle_size = 0;
int node_id, node_rank, array_index; int node_id, node_rank, array_index;
int ret, disp_unit, comm_size; int ret, disp_unit;
char *peer_data; char *peer_data;
OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_DEBUG, "configuring peer for rank %d", peer->rank); 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; 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 /* 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 * 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. */ * 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); 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 */ /* the node leader rank is stored in the length field */
node_rank = NODE_ID_TO_RANK(module, array_peer_data, node_id); 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); array_pointer = array_peer_data->base + array_index * sizeof (rank_data);