We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3bdde17 commit b560cc8Copy full SHA for b560cc8
dmlcloud/core/distributed.py
@@ -548,15 +548,18 @@ def init(kind='auto'):
548
elif kind == 'env':
549
_init_process_group_env()
550
551
- atexit.register(deinitialize_torch_distributed)
+ atexit.register(deinitialize_torch_distributed, fail_silently=True)
552
553
554
-def deinitialize_torch_distributed():
+def deinitialize_torch_distributed(fail_silently=False):
555
"""
556
Deinitializes the torch distributed framework.
557
At the time of writing, `dist.destroy_process_group()` is not well documented.
558
Hence, this function.
559
560
+ if not dist.is_initialized() and fail_silently:
561
+ return
562
+
563
_WorkerInfo.INIT_METHOD = None
564
_WorkerInfo.RANK = None
565
_WorkerInfo.WORLD_SIZE = None
0 commit comments