Skip to content

Commit

Permalink
Merge pull request open-mpi#6413 from nuriallv/issue_osc_rdma
Browse files Browse the repository at this point in the history
osc/rdma: fix when determining the node with the rank_array info for a peer
  • Loading branch information
hjelmn authored Feb 27, 2019
2 parents 8fd6107 + 3cae149 commit 73085e9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 2 additions & 0 deletions ompi/mca/osc/rdma/osc_rdma.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions ompi/mca/osc/rdma/osc_rdma_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,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;
Expand Down
8 changes: 3 additions & 5 deletions ompi/mca/osc/rdma/osc_rdma_peer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);

Expand Down

0 comments on commit 73085e9

Please sign in to comment.