/** * \file src/communicator.cpp * MegRay is Licensed under the Apache License, Version 2.0 (the "License") * * Copyright (c) 2014-2020 Megvii Inc. All rights reserved. * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */#include "communicator.h"#include "nccl/communicator.h"#include "ucx/communicator.h"namespaceMegRay{std::shared_ptr<Communicator>get_communicator(uint32_tnranks,uint32_trank,Backendbackend){std::shared_ptr<Communicator>comm;switch(backend){caseMEGRAY_NCCL:comm=std::make_shared<NcclCommunicator>(nranks,rank);break;caseMEGRAY_UCX:comm=std::make_shared<UcxCommunicator>(nranks,rank);break;default:MEGRAY_THROW("unknown backend");}returncomm;}}// namespace MegRay