@@ -3107,7 +3107,14 @@ options :class:`~torch.distributed.ProcessGroupNCCL.Options`).
31073107 .def_readwrite (
31083108 " global_ranks_in_group" ,
31093109 &::c10d::Backend::Options::global_ranks_in_group)
3110- .def_readwrite (" group_name" , &::c10d::Backend::Options::group_name);
3110+ .def_readwrite (" group_name" , &::c10d::Backend::Options::group_name)
3111+ .def (
3112+ " __eq__" ,
3113+ [](const ::c10d::Backend::Options& a,
3114+ const ::c10d::Backend::Options& b) { return a == b; })
3115+ .def (" __hash__" , [](const ::c10d::Backend::Options& a) {
3116+ return std::hash<::c10d::Backend::Options>{}(a);
3117+ });
31113118
31123119#ifdef USE_C10D_GLOO
31133120 auto processGroupGloo =
@@ -3121,7 +3128,14 @@ options :class:`~torch.distributed.ProcessGroupNCCL.Options`).
31213128 processGroupGloo, " _Options" , backendOptions)
31223129 .def (py::init<>())
31233130 .def_readwrite (" _devices" , &::c10d::ProcessGroupGloo::Options::devices)
3124- .def_readwrite (" _threads" , &::c10d::ProcessGroupGloo::Options::threads);
3131+ .def_readwrite (" _threads" , &::c10d::ProcessGroupGloo::Options::threads)
3132+ .def (
3133+ " __eq__" ,
3134+ [](const ::c10d::ProcessGroupGloo::Options& a,
3135+ const ::c10d::ProcessGroupGloo::Options& b) { return a == b; })
3136+ .def (" __hash__" , [](const ::c10d::ProcessGroupGloo::Options& a) {
3137+ return std::hash<::c10d::ProcessGroupGloo::Options>{}(a);
3138+ });
31253139
31263140 processGroupGloo
31273141 .def_static (
@@ -3481,6 +3495,15 @@ Example::
34813495 " split_from" , &::c10d::ProcessGroupNCCL::Options::split_from)
34823496 .def_readwrite (
34833497 " split_color" , &::c10d::ProcessGroupNCCL::Options::split_color)
3498+ .def (
3499+ " __eq__" ,
3500+ [](const ::c10d::ProcessGroupNCCL::Options& a,
3501+ const ::c10d::ProcessGroupNCCL::Options& b) { return a == b; })
3502+ .def (
3503+ " __hash__" ,
3504+ [](const ::c10d::ProcessGroupNCCL::Options& a) {
3505+ return std::hash<::c10d::ProcessGroupNCCL::Options>{}(a);
3506+ })
34843507 .def (
34853508 " __copy__" ,
34863509 [](const ::c10d::ProcessGroupNCCL::Options& self) {
0 commit comments