pytorch/torch/csrc/distributed/c10d/GlooDeviceFactory.hpp
cyy f27e09de04 Cleanup Windows warning suppression in CMake and fix some warnings in the source code (#94927)
This PR do two things:
1. It moves some Windows warning suppression from various CMake files into the main CMakeList.txt, following the conventions of gcc and clang.
2. It fixes some Windows warnings in the source code. Most importantly, it fixes lots of dll warnings by adjusting C10_API to TORCH_API or TORCH_PYTHON_API. There are still some dll warnings because some TORCH_API functions are actually built as part of libtorch_python

Pull Request resolved: https://github.com/pytorch/pytorch/pull/94927
Approved by: https://github.com/malfet
2023-02-27 19:22:20 +00:00

33 lines
773 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);
};
TORCH_DECLARE_SHARED_REGISTRY(
GlooDeviceRegistry,
::gloo::transport::Device,
const std::string&, /* interface */
const std::string& /* hostname */);
} // namespace c10d
#endif // USE_C10D_GLOO