[TCPStore] Remove deprecated constructor (#136004)

While looking at TCPStore code again and found it confusing that we still keep the deprecated constructor for TCPStore in cpp while we don't expose it in python via pybind already. I checked both internal and external, all use cases in cpp (aside from unit test fixed in this PR) already moved to using option. So let's remove this legacy constructor to avoid confusion.

Differential Revision: [D62653634](https://our.internmc.facebook.com/intern/diff/D62653634)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/136004
Approved by: https://github.com/Skylion007, https://github.com/XilunWu
This commit is contained in:
fduwjj
2024-09-13 09:49:05 -07:00
committed by PyTorch MergeBot
parent e77bd0ebd2
commit 911a43f930
3 changed files with 9 additions and 29 deletions

View File

@ -178,11 +178,12 @@ TEST(TCPStoreTest, testCleanShutdown) {
auto serverTCPStore = std::make_unique<c10d::TCPStore>( auto serverTCPStore = std::make_unique<c10d::TCPStore>(
"127.0.0.1", "127.0.0.1",
0, c10d::TCPStoreOptions{
numWorkers, /* port */ 0,
true, /* isServer */ true,
std::chrono::seconds(defaultTimeout), numWorkers,
/* wait */ false); /* waitWorkers */ false,
/* timeout */ std::chrono::seconds(defaultTimeout)});
c10d::test::set(*serverTCPStore, "key", "val"); c10d::test::set(*serverTCPStore, "key", "val");
auto clientTCPStore = c10::make_intrusive<c10d::TCPStore>( auto clientTCPStore = c10::make_intrusive<c10d::TCPStore>(

View File

@ -249,23 +249,10 @@ class SendBuffer {
using detail::Socket; using detail::Socket;
// TCPStore class methods // TCPStore class methods
TCPStore::TCPStore(
const std::string& masterAddr,
std::uint16_t masterPort,
std::optional<int> numWorkers,
bool isServer,
const std::chrono::milliseconds& timeout,
bool waitWorkers)
: TCPStore{
masterAddr,
TCPStoreOptions{
masterPort,
isServer,
numWorkers ? std::optional<std::size_t>(*numWorkers)
: std::nullopt,
waitWorkers,
timeout}} {}
// Although we still allow multi-params in ctor in Python, that behavior is
// removed from cpp and we construct the opts implicitly for users in the pybind
// of TCPStore.
TCPStore::TCPStore(std::string host, const TCPStoreOptions& opts) TCPStore::TCPStore(std::string host, const TCPStoreOptions& opts)
: Store{opts.timeout}, : Store{opts.timeout},
addr_{std::move(host)}, addr_{std::move(host)},

View File

@ -75,14 +75,6 @@ class TORCH_API TCPStore : public Store {
explicit TCPStore(std::string host, const TCPStoreOptions& opts = {}); explicit TCPStore(std::string host, const TCPStoreOptions& opts = {});
[[deprecated("Use TCPStore(host, opts) instead.")]] explicit TCPStore(
const std::string& masterAddr,
std::uint16_t masterPort,
std::optional<int> numWorkers = std::nullopt,
bool isServer = false,
const std::chrono::milliseconds& timeout = kDefaultTimeout,
bool waitWorkers = true);
~TCPStore() override; ~TCPStore() override;
void set(const std::string& key, const std::vector<uint8_t>& value) override; void set(const std::string& key, const std::vector<uint8_t>& value) override;