#pragma once #include #include #include #include #include #include #include "paddle/platform/device_context.h" namespace paddle { namespace platform { // class NCCLContext : public DeviceContext { // public: // explicit NCCLContext(GPUPlace place); // virtual ~NCCLContext(); // private: // std::vector gpu_ids_; // std::vector streams_; // }; class Communicator; class NCCLManager { public: static NCCLManager* Get() { static NCCLManager m; return &m; } NCCLManager() { } ~NCCLManager() {} // for each card only have one communicator Communicator* GetCommunicator() const; private: struct Communicator { std::vector comms_; std::vector streams_; // do not own std::vector events_; int root_gpu; }; // the gpu id list available. Note that only support // whole world communication. std::vector _gpu_worlds; // communicator list std::unordered_map comms_; }; } // namespace operators } // namespace paddle