Skip to content

Commit

Permalink
Revert "add CuddEvent destructor function (#34610)" (#34720)
Browse files Browse the repository at this point in the history
This reverts commit 090c863.
  • Loading branch information
MingMingShangTian authored Aug 9, 2021
1 parent e285258 commit bf54534
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions paddle/fluid/platform/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ class MemEvent {

class CudaEvent {
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)

public:
CudaEvent() {
#ifdef PADDLE_WITH_HIP
Expand All @@ -130,23 +129,15 @@ class CudaEvent {
#endif
}

explicit CudaEvent(unsigned int flags) : flags_(flags) {
CudaEvent(unsigned int flags) : flags_(flags) {
#ifdef PADDLE_WITH_HIP
hipEventCreateWithFlags(&event_, flags_);
#else
cudaEventCreateWithFlags(&event_, flags_);
#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
Expand Down

0 comments on commit bf54534

Please sign in to comment.