Skip to content

Commit 6c91d99

Browse files
authored
Merge pull request #7497 from awlauria/fix_rdma_shmem
Fix segv in btl/vader.
2 parents 77bf3f0 + f69c8d6 commit 6c91d99

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

opal/mca/btl/vader/btl_vader.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ struct mca_btl_vader_component_t {
125125
char *my_segment; /**< this rank's base pointer */
126126
size_t segment_size; /**< size of my_segment */
127127
int32_t num_smp_procs; /**< current number of smp procs on this host */
128+
int32_t local_rank; /**< current rank index at add_procs() time */
128129
opal_free_list_t vader_frags_eager; /**< free list of vader send frags */
129130
opal_free_list_t vader_frags_max_send; /**< free list of vader max send frags (large fragments) */
130131
opal_free_list_t vader_frags_user; /**< free list of small inline frags */

opal/mca/btl/vader/btl_vader_component.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,8 @@ static mca_btl_base_module_t **mca_btl_vader_component_init (int *num_btls,
560560
/* no fast boxes allocated initially */
561561
component->num_fbox_in_endpoints = 0;
562562

563+
component->local_rank = 0;
564+
563565
mca_btl_vader_check_single_copy ();
564566

565567
if (MCA_BTL_VADER_XPMEM != mca_btl_vader_component.single_copy_mechanism) {

opal/mca/btl/vader/btl_vader_module.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ static int vader_add_procs (struct mca_btl_base_module_t* btl,
349349
}
350350
}
351351

352-
for (int32_t proc = 0, local_rank = 0 ; proc < (int32_t) nprocs ; ++proc) {
352+
for (int32_t proc = 0; proc < (int32_t) nprocs; ++proc) {
353353
/* check to see if this proc can be reached via shmem (i.e.,
354354
if they're on my local host and in my job) */
355355
if (procs[proc]->proc_name.jobid != my_proc->proc_name.jobid ||
@@ -367,8 +367,10 @@ static int vader_add_procs (struct mca_btl_base_module_t* btl,
367367
}
368368

369369
/* setup endpoint */
370-
peers[proc] = component->endpoints + local_rank;
371-
rc = init_vader_endpoint (peers[proc], procs[proc], local_rank++);
370+
int rank = opal_atomic_fetch_add_32(&component -> local_rank, 1);
371+
372+
peers[proc] = component->endpoints + rank;
373+
rc = init_vader_endpoint (peers[proc], procs[proc], rank);
372374
if (OPAL_SUCCESS != rc) {
373375
break;
374376
}

0 commit comments

Comments
 (0)