@@ -2221,26 +2221,20 @@ The hook must have the following signature:
2221
2221
.value (" CUSTOM" , ::c10d::ProcessGroup::BackendType::CUSTOM)
2222
2222
.export_values ();
2223
2223
2224
- // base ProcessGroup::Options binding
2225
- auto processGroupOptions =
2226
- intrusive_ptr_class_<::c10d::ProcessGroup::Options>(
2227
- processGroup,
2228
- " Options" ,
2229
- R"(
2230
- Base class for all processes group options implementations, such as the nccl
2231
- options :class:`~torch.distributed.ProcessGroupNCCL.Options`).
2232
- )" )
2233
- .def (
2234
- py::init ([](const std::string& backend,
2235
- const std::chrono::milliseconds& timeout) {
2236
- return c10::make_intrusive<::c10d::ProcessGroup::Options>(
2237
- backend, timeout);
2238
- }),
2239
- py::arg (" backend" ),
2240
- py::arg (" timeout" ) = kProcessGroupDefaultTimeout ,
2241
- py::call_guard<py::gil_scoped_release>())
2242
- .def_readonly (" backend" , &::c10d::ProcessGroup::Options::backend)
2243
- .def_readwrite (" _timeout" , &::c10d::ProcessGroup::Options::timeout);
2224
+ // ProcessGroup::Options binding
2225
+ intrusive_ptr_class_<::c10d::ProcessGroup::Options>(
2226
+ processGroup, " Options" , R"( Class for processes group options.)" )
2227
+ .def (
2228
+ py::init ([](const std::string& backend,
2229
+ const std::chrono::milliseconds& timeout) {
2230
+ return c10::make_intrusive<::c10d::ProcessGroup::Options>(
2231
+ backend, timeout);
2232
+ }),
2233
+ py::arg (" backend" ),
2234
+ py::arg (" timeout" ) = kProcessGroupDefaultTimeout ,
2235
+ py::call_guard<py::gil_scoped_release>())
2236
+ .def_readonly (" backend" , &::c10d::ProcessGroup::Options::backend)
2237
+ .def_readwrite (" _timeout" , &::c10d::ProcessGroup::Options::timeout);
2244
2238
2245
2239
#ifndef _WIN32
2246
2240
module.def (
@@ -2556,6 +2550,27 @@ options :class:`~torch.distributed.ProcessGroupNCCL.Options`).
2556
2550
&::c10d::Backend::endCoalescing,
2557
2551
py::call_guard<py::gil_scoped_release>());
2558
2552
2553
+ // base Backend::Options binding
2554
+ auto backendOptions =
2555
+ intrusive_ptr_class_<::c10d::Backend::Options>(
2556
+ backend,
2557
+ " Options" ,
2558
+ R"(
2559
+ Base class for all backend options implementations, such as the nccl
2560
+ options :class:`~torch.distributed.ProcessGroupNCCL.Options`).
2561
+ )" )
2562
+ .def (
2563
+ py::init ([](const std::string& backend,
2564
+ const std::chrono::milliseconds& timeout) {
2565
+ return c10::make_intrusive<::c10d::Backend::Options>(
2566
+ backend, timeout);
2567
+ }),
2568
+ py::arg (" backend" ),
2569
+ py::arg (" timeout" ) = kProcessGroupDefaultTimeout ,
2570
+ py::call_guard<py::gil_scoped_release>())
2571
+ .def_readonly (" backend" , &::c10d::Backend::Options::backend)
2572
+ .def_readwrite (" _timeout" , &::c10d::Backend::Options::timeout);
2573
+
2559
2574
#ifdef USE_C10D_GLOO
2560
2575
static const std::string GLOO_SOCKET_IFNAME_ENV = " GLOO_SOCKET_IFNAME" ;
2561
2576
@@ -2567,7 +2582,7 @@ options :class:`~torch.distributed.ProcessGroupNCCL.Options`).
2567
2582
shared_ptr_class_<::gloo::transport::Device>(processGroupGloo, " Device" );
2568
2583
2569
2584
intrusive_ptr_class_<::c10d::ProcessGroupGloo::Options>(
2570
- processGroupGloo, " _Options" , processGroupOptions )
2585
+ processGroupGloo, " _Options" , backendOptions )
2571
2586
.def (py::init<>())
2572
2587
.def_readwrite (" _devices" , &::c10d::ProcessGroupGloo::Options::devices)
2573
2588
.def_readwrite (" _threads" , &::c10d::ProcessGroupGloo::Options::threads);
@@ -2794,7 +2809,7 @@ for details.
2794
2809
intrusive_ptr_class_<::c10d::ProcessGroupNCCL::Options>(
2795
2810
processGroupNCCL,
2796
2811
" Options" ,
2797
- processGroupOptions ,
2812
+ backendOptions ,
2798
2813
R"(
2799
2814
ProcessGroup options for the NCCL backend
2800
2815
0 commit comments