From bf545344ebad69b5a72db9ae656e272e2c0b0ff9 Mon Sep 17 00:00:00 2001 From: chentianyu03 Date: Mon, 9 Aug 2021 19:30:18 +0800 Subject: [PATCH] Revert "add CuddEvent destructor function (#34610)" (#34720) This reverts commit 090c863aca0fc5088ea6ce4bdff2f42da4fe80da. --- paddle/fluid/platform/event.h | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/paddle/fluid/platform/event.h b/paddle/fluid/platform/event.h index 66bb77225a3a8..93fc56ab203b6 100644 --- a/paddle/fluid/platform/event.h +++ b/paddle/fluid/platform/event.h @@ -120,7 +120,6 @@ class MemEvent { class CudaEvent { #if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP) - public: CudaEvent() { #ifdef PADDLE_WITH_HIP @@ -130,7 +129,7 @@ class CudaEvent { #endif } - explicit CudaEvent(unsigned int flags) : flags_(flags) { + CudaEvent(unsigned int flags) : flags_(flags) { #ifdef PADDLE_WITH_HIP hipEventCreateWithFlags(&event_, flags_); #else @@ -138,15 +137,7 @@ class CudaEvent { #endif } - ~CudaEvent() { -#ifdef PADDLE_WITH_HIP - PADDLE_ENFORCE_CUDA_SUCCESS(hipEventDestroy(event_)); -#else - PADDLE_ENFORCE_CUDA_SUCCESS(cudaEventDestroy(event_)); -#endif - } - - void Record(const paddle::platform::stream::CUDAStream& stream) { + void Record(paddle::platform::stream::CUDAStream& stream) { #ifdef PADDLE_WITH_HIP PADDLE_ENFORCE_CUDA_SUCCESS(hipEventRecord(event_, stream.raw_stream())); #else