Skip to content

Commit 73085e9

Browse files
authored
Merge pull request #6413 from nuriallv/issue_osc_rdma
osc/rdma: fix when determining the node with the rank_array info for a peer
2 parents 8fd6107 + 3cae149 commit 73085e9

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

ompi/mca/osc/rdma/osc_rdma.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050

5151
#include "opal_stdint.h"
5252

53+
#define RANK_ARRAY_COUNT(module) ((ompi_comm_size ((module)->comm) + (module)->node_count - 1) / (module)->node_count)
54+
5355
enum {
5456
OMPI_OSC_RDMA_LOCKING_TWO_LEVEL,
5557
OMPI_OSC_RDMA_LOCKING_ON_DEMAND,

ompi/mca/osc/rdma/osc_rdma_component.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,8 +384,6 @@ static int ompi_osc_rdma_component_query (struct ompi_win_t *win, void **base, s
384384
return mca_osc_rdma_component.priority;
385385
}
386386

387-
#define RANK_ARRAY_COUNT(module) ((ompi_comm_size ((module)->comm) + (module)->node_count - 1) / (module)->node_count)
388-
389387
static int ompi_osc_rdma_initialize_region (ompi_osc_rdma_module_t *module, void **base, size_t size) {
390388
ompi_osc_rdma_region_t *region = (ompi_osc_rdma_region_t *) module->state->regions;
391389
int ret;

ompi/mca/osc/rdma/osc_rdma_peer.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ static int ompi_osc_rdma_peer_setup (ompi_osc_rdma_module_t *module, ompi_osc_rd
103103
ompi_osc_rdma_rank_data_t rank_data;
104104
int registration_handle_size = 0;
105105
int node_id, node_rank, array_index;
106-
int ret, disp_unit, comm_size;
106+
int ret, disp_unit;
107107
char *peer_data;
108108

109109
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
112112
registration_handle_size = module->selected_btl->btl_registration_handle_size;
113113
}
114114

115-
comm_size = ompi_comm_size (module->comm);
116-
117115
/* each node is responsible for holding a part of the rank -> node/local rank mapping array. this code
118116
* calculates the node and offset the mapping can be found. once the mapping has been read the state
119117
* part of the peer structure can be initialized. */
120-
node_id = (peer->rank * module->node_count) / comm_size;
118+
node_id = peer->rank / RANK_ARRAY_COUNT(module);
121119
array_peer_data = (ompi_osc_rdma_region_t *) ((intptr_t) module->node_comm_info + node_id * module->region_size);
122120

123121
/* the node leader rank is stored in the length field */
124122
node_rank = NODE_ID_TO_RANK(module, array_peer_data, node_id);
125-
array_index = peer->rank % ((comm_size + module->node_count - 1) / module->node_count);
123+
array_index = peer->rank % RANK_ARRAY_COUNT(module);
126124

127125
array_pointer = array_peer_data->base + array_index * sizeof (rank_data);
128126

0 commit comments

Comments
 (0)