Revamp the uniqueId code to support subgroups of processes (#80)
* add code for bootstrapping the bootstrapping code has been extracted from the MSCCLPP library, which in parts is based on the code from NVIDIA. The code has been modified to match the specific requirements of the rocSHMEM library. * add code to use the new uniqueId bootstrapping * adjust init_attr example extend the rocshmem_init_attr example to use two disjoint groups of processe, in order to trigger the new code path. * add env variable for bootstrap timeout * Update examples/rocshmem_init_attr_test.cc Co-authored-by: Aurelien Bouteiller <Aurelien.bouteiller@gmail.com> * Update src/rocshmem.cpp Co-authored-by: Aurelien Bouteiller <Aurelien.bouteiller@gmail.com> --------- Co-authored-by: Aurelien Bouteiller <Aurelien.bouteiller@gmail.com>
This commit is contained in:
1 bovenliggende
05755847f5
commit
b5830a623b
13 files changed
+2184
-42
No files matched your search
@@ -30,24 +30,35 @@ using namespace rocshmem;
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
int rank, nranks;
|
||||
int world_rank, world_nranks;
|
||||
int ret;
|
||||
rocshmem_uniqueid_t uid;
|
||||
rocshmem_init_attr_t attr;
|
||||
|
||||
MPI_Init(&argc, &argv);
|
||||
MPI_Comm_rank (MPI_COMM_WORLD, &rank);
|
||||
MPI_Comm_size (MPI_COMM_WORLD, &nranks);
|
||||
MPI_Comm_rank (MPI_COMM_WORLD, &world_rank);
|
||||
MPI_Comm_size (MPI_COMM_WORLD, &world_nranks);
|
||||
|
||||
// Create two disjoint groups of processes, each
|
||||
// one creating a unique rocshmem environment independent
|
||||
// of the other group
|
||||
MPI_Comm newcomm;
|
||||
int color = world_rank %2;
|
||||
int rank, nranks;
|
||||
|
||||
MPI_Comm_split(MPI_COMM_WORLD, color, world_rank, &newcomm);
|
||||
MPI_Comm_rank (newcomm, &rank);
|
||||
MPI_Comm_size (newcomm, &nranks);
|
||||
|
||||
if (rank == 0) {
|
||||
ret = rocshmem_get_uniqueid (&uid);
|
||||
if (ret != ROCSHMEM_SUCCESS) {
|
||||
std::cout << rank << ": Error in rocshmem_get_uniqueid. Aborting.\n";
|
||||
MPI_Abort (MPI_COMM_WORLD, ret);
|
||||
std::cout << rank << ": Error in rocshmem_get_uniqueid. Aborting.\n";
|
||||
MPI_Abort (MPI_COMM_WORLD, ret);
|
||||
}
|
||||
}
|
||||
|
||||
MPI_Bcast (&uid, sizeof(rocshmem_uniqueid_t), MPI_BYTE, 0, MPI_COMM_WORLD);
|
||||
MPI_Bcast (&uid, sizeof(rocshmem_uniqueid_t), MPI_BYTE, 0, newcomm);
|
||||
ret = rocshmem_set_attr_uniqueid_args(rank, nranks, &uid, &attr);
|
||||
if (ret != ROCSHMEM_SUCCESS) {
|
||||
std::cout << rank << ": Error in rocshmem_set_attr_uniqueid_args. Aborting.\n";
|
||||
@@ -63,6 +74,7 @@ int main (int argc, char **argv)
|
||||
std::cout << rank << ": rocshmem_init_attr SUCCESS\n";
|
||||
|
||||
rocshmem_finalize();
|
||||
MPI_Comm_free (&newcomm);
|
||||
MPI_Finalize();
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user