[Core] fix del of communicator (#3702)

This commit is contained in:
youkaichao
2024-03-28 17:24:58 -07:00
committed by GitHub
parent 4716a32dd4
commit 0267fef52a

View File

@ -252,5 +252,7 @@ class NCCLCommunicator:
assert result == 0
def __del__(self):
dist.destroy_process_group()
# `dist` module might have been already destroyed
if hasattr(dist, 'destroy_process_group'):
dist.destroy_process_group()
_c_ncclCommDestroy(self.comm)