Skip to content

Commit 9a1ce25

Browse files
committed
oshmem: add some useless but inoffensive communications and see how oshmem+ucx handles that
Signed-off-by: Gilles Gouaillardet <[email protected]>
1 parent 13bbc39 commit 9a1ce25

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

oshmem/runtime/oshmem_shmem_init.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,36 @@ int oshmem_shmem_init(int argc, char **argv, int requested, int *provided)
152152
return ret;
153153
}
154154

155+
{
156+
int world_rank, world_size;
157+
int *prank, *ranks;
158+
MPI_Request req;
159+
MPI_Status status;
160+
PMPI_Comm_rank(MPI_COMM_WORLD, &world_rank);
161+
PMPI_Comm_size(MPI_COMM_WORLD, &world_size);
162+
prank = (int *)malloc(sizeof(int));
163+
*prank = world_rank + 1;
164+
if (0 == world_rank) ranks = (int *)calloc(world_size, sizeof(int));
165+
if (0 == world_rank) fprintf (stderr, "oshmem_shmem_init: PMPI_Gather\n");
166+
PMPI_Gather(prank, 1, MPI_INT, ranks, 1, MPI_INT, 0, MPI_COMM_WORLD);
167+
if (0 == world_rank)
168+
for (int i=0; i<world_size; i++)
169+
if (i+1 != ranks[i]) fprintf(stderr, "PMPI_Gather: at %d expected %d got %d\n", i, i+1, ranks[i]);
170+
if (0 == world_rank) fprintf (stderr, "oshmem_shmem_init: PMPI_Igather\n");
171+
*prank = world_rank + 2;
172+
memset(ranks, 0, world_size*sizeof(int));
173+
PMPI_Igather(prank, 1, MPI_INT, ranks, 1, MPI_INT, 0, MPI_COMM_WORLD, &req);
174+
PMPI_Wait(&req, &status);
175+
if (MPI_SUCCESS != status.MPI_ERROR)
176+
fprintf(stderr, "PMPI_Igather failed with error %d on rank %d\n", status.MPI_ERROR, world_rank);
177+
if (0 == world_rank)
178+
for (int i=0; i<world_size; i++)
179+
if (i+2 != ranks[i]) fprintf(stderr, "PMPI_Igather: at %d expected %d got %d\n", i, i+2, ranks[i]);
180+
free(prank);
181+
if (0 == world_rank) free(ranks);
182+
}
183+
184+
155185
PMPI_Comm_dup(MPI_COMM_WORLD, &oshmem_comm_world);
156186
ret = _shmem_init(argc, argv, requested, provided);
157187

0 commit comments

Comments
 (0)