pytorch/torch/csrc/distributed/c10d/GlooDeviceFactory.hpp
Luca Wehrstedt a016150163 Move torch/lib/c10d to torch/csrc/distributed/c10d (#60543)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/60543

Since now c10d is part of libtorch, it would also be nice if the sources lived all in one place.
ghstack-source-id: 132306292

Test Plan: It builds

Reviewed By: cbalioglu

Differential Revision: D29062002

fbshipit-source-id: d9e1301e9d73e1643fa0f0119cd2d618f1ad52e6
2021-06-24 12:38:51 -07:00

33 lines
771 B
C++

#pragma once
#ifdef USE_C10D_GLOO
#include <string>
#include <c10/util/Registry.h>
#include <gloo/config.h>
#include <gloo/transport/device.h>
namespace c10d {
class TORCH_API GlooDeviceFactory {
public:
// Create new device instance for specific interface.
static std::shared_ptr<::gloo::transport::Device> makeDeviceForInterface(
const std::string& interface);
// Create new device instance for specific hostname or address.
static std::shared_ptr<::gloo::transport::Device> makeDeviceForHostname(
const std::string& hostname);
};
C10_DECLARE_SHARED_REGISTRY(
GlooDeviceRegistry,
::gloo::transport::Device,
const std::string&, /* interface */
const std::string& /* hostname */);
} // namespace c10d
#endif // USE_C10D_GLOO