mirror of
https://github.com/microsoft/mscclpp.git
synced 2026-05-12 09:17:06 +00:00
integrate with new interfaces in mscclpp.hpp
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#include "bootstrap.h"
|
||||
#include "mscclpp.hpp"
|
||||
|
||||
#include <memory>
|
||||
|
||||
@@ -11,24 +11,24 @@ int main()
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
|
||||
MPI_Comm_size(MPI_COMM_WORLD, &worldSize);
|
||||
|
||||
std::shared_ptr<mscclppBootstrap> bootstrap(new mscclppBootstrap(rank, worldSize));
|
||||
std::shared_ptr<mscclpp::DefaultBootstrap> bootstrap(new mscclpp::DefaultBootstrap(rank, worldSize));
|
||||
// bootstrap->Initialize("costsim-dev-00000A:50000");
|
||||
UniqueId id;
|
||||
mscclpp::UniqueId id;
|
||||
if (rank == 0)
|
||||
id = bootstrap->GetUniqueId();
|
||||
id = bootstrap->createUniqueId();
|
||||
MPI_Bcast(&id, sizeof(id), MPI_BYTE, 0, MPI_COMM_WORLD);
|
||||
bootstrap->Initialize(id);
|
||||
bootstrap->initialize(id);
|
||||
|
||||
std::vector<int> tmp(worldSize, 0);
|
||||
tmp[rank] = rank+1;
|
||||
bootstrap->AllGather(tmp.data(), sizeof(int));
|
||||
bootstrap->allGather(tmp.data(), sizeof(int));
|
||||
for (int i = 0; i < worldSize; i++){
|
||||
if (tmp[i] != i+1)
|
||||
printf("error AllGather: rank %d: tmp[%d] = %d\n", rank, i, tmp[i]);
|
||||
}
|
||||
printf("rank %d: AllGather test passed!\n", rank);
|
||||
|
||||
bootstrap->Barrier();
|
||||
bootstrap->barrier();
|
||||
printf("rank %d: Barrier test passed!\n", rank);
|
||||
|
||||
for (int i = 0; i < worldSize; i++){
|
||||
@@ -36,8 +36,8 @@ int main()
|
||||
continue;
|
||||
int msg1 = (rank + 1)*2;
|
||||
int msg2 = (rank + 1)*2+1;
|
||||
bootstrap->Send(&msg1, sizeof(int), i, 0);
|
||||
bootstrap->Send(&msg2, sizeof(int), i, 1);
|
||||
bootstrap->send(&msg1, sizeof(int), i, 0);
|
||||
bootstrap->send(&msg2, sizeof(int), i, 1);
|
||||
}
|
||||
|
||||
for (int i = 0; i < worldSize; i++){
|
||||
@@ -46,8 +46,8 @@ int main()
|
||||
int msg1 = 0;
|
||||
int msg2 = 0;
|
||||
// recv them in the opposite order to check correctness
|
||||
bootstrap->Recv(&msg2, sizeof(int), i, 1);
|
||||
bootstrap->Recv(&msg1, sizeof(int), i, 0);
|
||||
bootstrap->recv(&msg2, sizeof(int), i, 1);
|
||||
bootstrap->recv(&msg1, sizeof(int), i, 0);
|
||||
if (msg1 != (i+1)*2 || msg2 != (i+1)*2+1)
|
||||
printf("error Send/Recv: rank %d: msg1 = %d, msg2 = %d\n", rank, msg1, msg2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user