testing connection setup

This commit is contained in:
Saeed Maleki
2023-04-27 06:08:35 +00:00
parent 4d7a4a25db
commit 8eda6369ee
6 changed files with 34 additions and 18 deletions

View File

@@ -5,6 +5,20 @@
#include <iostream>
#include <mpi.h>
mscclpp::TransportFlags findIb(int localRank){
mscclpp::TransportFlags IBs[] = {
mscclpp::TransportIB0,
mscclpp::TransportIB1,
mscclpp::TransportIB2,
mscclpp::TransportIB3,
mscclpp::TransportIB4,
mscclpp::TransportIB5,
mscclpp::TransportIB6,
mscclpp::TransportIB7
};
return IBs[localRank];
}
void test_communicator(int rank, int worldSize, int nranksPerNode){
auto bootstrap = std::make_shared<mscclpp::Bootstrap>(rank, worldSize);
mscclpp::UniqueId id;
@@ -16,12 +30,14 @@ void test_communicator(int rank, int worldSize, int nranksPerNode){
auto communicator = std::make_shared<mscclpp::Communicator>(bootstrap);
for (int i = 0; i < worldSize; i++){
if (i != rank){
if (i % nranksPerNode == rank % nranksPerNode)
if (i % nranksPerNode == rank % nranksPerNode){
auto connect = communicator->connect(i, 0, mscclpp::TransportCudaIpc);
else
auto connect = communicator->connect(i, 0, mscclpp::TransportAllIB);
} else {
auto connect = communicator->connect(i, 0, findIb(rank % nranksPerNode));
}
}
}
communicator->connectionSetup();
if (bootstrap->getRank() == 0)
std::cout << "--- MSCCLPP::Communicator tests passed! ---" << std::endl;