integrate with new interfaces in mscclpp.hpp

This commit is contained in:
Changho Hwang
2023-04-25 11:47:58 +00:00
parent 8428b49858
commit 31f7897d5d
6 changed files with 130 additions and 113 deletions

View File

@@ -5,35 +5,6 @@
#include "comm.h"
struct UniqueId
{
uint64_t magic;
union mscclppSocketAddress addr;
};
static_assert(sizeof(UniqueId) <= sizeof(mscclppUniqueId),
"Bootstrap handle is too large to fit inside MSCCLPP unique ID");
class __attribute__((visibility("default"))) mscclppBootstrap : public Bootstrap
{
public:
mscclppBootstrap(int rank, int nRanks);
~mscclppBootstrap();
UniqueId GetUniqueId();
void Initialize(UniqueId uniqueId);
void Initialize(std::string ipPortPair);
void Send(void* data, int size, int peer, int tag) override;
void Recv(void* data, int size, int peer, int tag) override;
void AllGather(void* allData, int size) override;
void Barrier() override;
private:
class Impl;
std::unique_ptr<Impl> pimpl_;
};
// ------------------- Old bootstrap headers: to be removed -------------------
struct mscclppBootstrapHandle

View File

@@ -248,16 +248,6 @@ typedef enum
} mscclppResult_t;
class Bootstrap {
public:
Bootstrap(){};
virtual ~Bootstrap() = default;
virtual void Send(void* data, int size, int peer, int tag) = 0;
virtual void Recv(void* data, int size, int peer, int tag) = 0;
virtual void AllGather(void* allData, int size) = 0;
virtual void Barrier() = 0;
};
/* Create a unique ID for communication. Only needs to be called by one process.
* Use with mscclppCommInitRankFromId().
* All processes need to provide the same ID to mscclppCommInitRankFromId().

View File

@@ -13,12 +13,51 @@
#include <vector>
#include <memory>
#include <string>
#include <functional>
#include <mscclppfifo.hpp>
namespace mscclpp {
#define MSCCLPP_UNIQUE_ID_BYTES 128
struct UniqueId {
char internal[MSCCLPP_UNIQUE_ID_BYTES];
};
class Bootstrap
{
public:
Bootstrap(){};
virtual ~Bootstrap() = default;
virtual void send(void* data, int size, int peer, int tag) = 0;
virtual void recv(void* data, int size, int peer, int tag) = 0;
virtual void allGather(void* allData, int size) = 0;
virtual void barrier() = 0;
};
class DefaultBootstrap : public Bootstrap
{
public:
DefaultBootstrap(int rank, int nRanks);
~DefaultBootstrap();
UniqueId createUniqueId();
UniqueId getUniqueId() const;
void initialize(UniqueId uniqueId);
void initialize(std::string ipPortPair);
void send(void* data, int size, int peer, int tag) override;
void recv(void* data, int size, int peer, int tag) override;
void allGather(void* allData, int size) override;
void barrier() override;
private:
class Impl;
std::unique_ptr<Impl> pimpl_;
};
struct alignas(16) SignalEpochId {
// every signal(), increaments this and either:
// 1) proxy thread pushes it to the remote peer's localSignalEpochId->proxy
@@ -381,11 +420,6 @@ struct SimpleDeviceConnection {
BufferHandle src;
};
#define MSCCLPP_UNIQUE_ID_BYTES 128
struct UniqueId {
char internal[MSCCLPP_UNIQUE_ID_BYTES];
};
/* Create a unique ID for communication. Only needs to be called by one process.
* Use with mscclppCommInitRankFromId().
* All processes need to provide the same ID to mscclppCommInitRankFromId().