[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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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)