Skip to content

Commit b966c39

Browse files
author
David Ozog
authored
Merge pull request #1153 from davidozog/pr/team_stride_relative_to_parent
teams: input split stride is relative to parent
2 parents 6e505e5 + 3bf897b commit b966c39

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/shmem_team.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,8 @@ int shmem_internal_team_split_strided(shmem_internal_team_t *parent_team, int PE
299299
}
300300

301301
int global_PE_start = shmem_internal_team_pe(parent_team, PE_start);
302-
int global_PE_end = global_PE_start + PE_stride * (PE_size -1);
302+
int global_PE_stride = parent_team->stride * PE_stride;
303+
int global_PE_end = global_PE_start + global_PE_stride * (PE_size -1);
303304

304305
if (PE_start < 0 || PE_start >= parent_team->size ||
305306
PE_size <= 0 || PE_size > parent_team->size ||
@@ -318,7 +319,7 @@ int shmem_internal_team_split_strided(shmem_internal_team_t *parent_team, int PE
318319
}
319320

320321
int my_pe = shmem_internal_pe_in_active_set(shmem_internal_my_pe,
321-
global_PE_start, PE_stride, PE_size);
322+
global_PE_start, global_PE_stride, PE_size);
322323

323324
long *psync = shmem_internal_team_choose_psync(parent_team, REDUCE);
324325
shmem_internal_team_t *myteam = NULL;
@@ -332,7 +333,7 @@ int shmem_internal_team_split_strided(shmem_internal_team_t *parent_team, int PE
332333

333334
myteam->my_pe = my_pe;
334335
myteam->start = global_PE_start;
335-
myteam->stride = (PE_stride == 0 || PE_size == 1) ? 1 : PE_stride;
336+
myteam->stride = (PE_stride == 0 || PE_size == 1) ? 1 : global_PE_stride;
336337
myteam->size = PE_size;
337338

338339
if (config_mask == 0) {
@@ -362,7 +363,7 @@ int shmem_internal_team_split_strided(shmem_internal_team_t *parent_team, int PE
362363

363364
shmem_internal_op_to_all(psync_pool_avail_reduced,
364365
psync_pool_avail, N_PSYNC_BYTES, 1,
365-
myteam->start, PE_stride, PE_size, NULL,
366+
myteam->start, global_PE_stride, PE_size, NULL,
366367
psync, SHM_INTERNAL_BAND, SHM_INTERNAL_UCHAR);
367368

368369
/* We cannot release the psync here, because this reduction may not

0 commit comments

Comments
 (0)