From 0471476a18d7068418e9f4afad866477700b895c Mon Sep 17 00:00:00 2001 From: Yi Liu Date: Tue, 31 Mar 2020 21:51:58 +0800 Subject: [PATCH] fix nccl comm double free bug (#23344) As nccl comm is not created by CUDADeviceContext, it should be destroyed by the creator as the best practice of RAII. --- paddle/fluid/platform/device_context.cc | 5 ----- 1 file changed, 5 deletions(-) diff --git a/paddle/fluid/platform/device_context.cc b/paddle/fluid/platform/device_context.cc index e319b39536..39be9f716d 100644 --- a/paddle/fluid/platform/device_context.cc +++ b/paddle/fluid/platform/device_context.cc @@ -287,11 +287,6 @@ CUDADeviceContext::~CUDADeviceContext() { SetDeviceId(place_.device); Wait(); WaitStreamCallback(); -#if defined(PADDLE_WITH_NCCL) - if (nccl_comm_) { - PADDLE_ENFORCE_CUDA_SUCCESS(dynload::ncclCommDestroy(nccl_comm_)); - } -#endif } Place CUDADeviceContext::GetPlace() const { return place_; }