A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 17, 01:45 UTC
[Core][Distributed] fix pynccl del error (#4508)
youkaichao committed
May 1, 2024 at 15:23 UTC
6ef09b08f88b675f84b7140238286e5d4c5304c8
1 file changed
+4
-8
vllm/distributed/device_communicators/pynccl.py
+4
-8
@@ -200,6 +200,10 @@ _c_ncclAllReduce.argtypes = [
200
ncclDataType_t, ctypes.c_void_p, ctypes.c_void_p
201
]
202
203
+# be cautious! this is a collective call, it will block until all
204
+# processes in the communicator have called this function.
205
+# because Python object destruction can happen in random order,
206
+# it is better not to call it at all.
207
# equivalent to c declaration:
208
# ncclResult_t ncclCommDestroy(ncclComm_t comm);
209
_c_ncclCommDestroy = nccl.ncclCommDestroy
@@ -278,11 +282,3 @@ class NCCLCommunicator:
282
ncclDataTypeEnum.from_torch(tensor.dtype),
283
ncclRedOpTypeEnum.from_torch(op), self.comm,
284
ctypes.c_void_p(stream.cuda_stream)))
281
-
282
- def __del__(self):
283
- # `dist` module might have been already destroyed
284
- if hasattr(dist, 'destroy_process_group'):
285
- dist.destroy_process_group()
286
- # function might have been already destroyed
287
- if _c_ncclCommDestroy is not None:
288
- _c_ncclCommDestroy(self.comm)