pytorch/torch/csrc/distributed/c10d/UnixSockUtils.hpp
Min Si 1ad0048b64 Refactor distribuetd to use absolute header path (#85780)
Headers under torch/csrc/distributed may be referened with relative path, e.g., "<c10d/...>". However, relative path cannot be gracefully handled by Meta internal build when the NCCL PG is hipified to support AMD/RCCL because the "hipified" header files are generated in other directories. Moreover, using absolute path for header inclusion is the state-of-the-art in most components in Pytorch. Thus, this patch refactors all header paths in torch/csrc/distributed to be absolute.

See D39835774 for more details about Meta internal complication.

**How to test**: commit 9e5d199 removes -I./torch/csrc/distributed in compile options. Thus use it to verify we don't miss any relative path use of torch/csrc/distributed headers.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/85780
Approved by: https://github.com/kumpera, https://github.com/huydhn
2022-09-30 05:13:50 +00:00

26 lines
584 B
C++

#pragma once
#include <torch/csrc/distributed/c10d/Utils.hpp>
namespace c10d {
namespace tcputil {
#define CONNECT_SOCKET_OFFSET 2
inline int poll(struct pollfd *fds, unsigned long nfds, int timeout) {
return ::poll(fds, nfds, timeout);
}
inline void addPollfd(std::vector<struct pollfd> &fds, int socket,
short events) {
fds.push_back({.fd = socket, .events = events});
}
inline struct ::pollfd getPollfd(int socket, short events) {
struct ::pollfd res = {.fd = socket, .events = events};
return res;
}
} // namespace tcputil
} // namespace c10d