#include #include #include #include "base.h" #include "hardware_utils.h" #include "bootstrap.h" #include "graph.h" #include "hardware.h" namespace sccl { namespace hardware { // 全局变量,全部节点的信息 sccl::hardware::topology::bootstrap::BootstrapComm_t bootstrap_comm; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// scclResult_t scclGetUniqueId(scclUniqueId* unique_id) { auto handle = reinterpret_cast(unique_id); NEQCHECK(sizeof(BootstrapHandle_t), SCCL_UNIQUE_ID_BYTES); SCCLCHECK(topology::bootstrap::bootstrapGetUniqueId(handle)); return scclSuccess; } scclResult_t sccl_init(const scclUniqueId* unique_id, int rank, int nRanks) { // -------------------------- 1.获取0号rank的地址信息 ----------------------------------- // auto root_handle = reinterpret_cast(unique_id); EQCHECK(root_handle->magic, 0); // 检查handle是否已经更新 // -------------------------- 2.初始化获取所有节点的node信息 ----------------------------------- // auto sccl_bootstrap = std::make_unique(root_handle, rank, nRanks); SCCLCHECK(sccl_bootstrap->init(&bootstrap_comm)); // -------------------------- 3.MPI 建图 ----------------------------------- // auto sccl_graph = std::make_unique(rank, nRanks); printf("init pos 2\n"); // 计算通信路径 sccl_graph->calculateCommunicationPaths(&bootstrap_comm); printf("init pos 3\n"); // // -------------------------- 3.MPI allgather设置unique_id的整合 ----------------------------------- // // -------------------------- 5.根据各个节点的基础信息计算topo结果 ----------------------------------- // return scclSuccess; } scclResult_t sccl_finalize() { // 设置一些全局变量的重置和销毁 // 设置socket等硬件监听的关闭 // void BootstrapComm::destroy() { // if(bootstrap_comm.nRanks > 0) { // bootstrap_comm.destroy(); // } return scclSuccess; } } // namespace hardware } // namespace sccl