From f79ca23115c16181cde07f477ba44f45a0da1a8e Mon Sep 17 00:00:00 2001 From: fengjiayi Date: Fri, 31 Aug 2018 09:53:40 +0000 Subject: [PATCH] fix bugs --- paddle/fluid/framework/rw_lock.h | 6 ++++++ paddle/fluid/operators/conv_transpose_cudnn_op.cu.cc | 2 +- paddle/fluid/platform/device_context.cc | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/paddle/fluid/framework/rw_lock.h b/paddle/fluid/framework/rw_lock.h index 4f1d9adbfc5..da163835e86 100644 --- a/paddle/fluid/framework/rw_lock.h +++ b/paddle/fluid/framework/rw_lock.h @@ -71,6 +71,9 @@ class RWLockGuard { WRLock(); break; } + case Status::kUnLock: { + break; + } } } @@ -78,6 +81,7 @@ class RWLockGuard { switch (status_) { case Status::kUnLock: { lock_->WRLock(); + status_ = Status::kWRLock; break; } case Status::kWRLock: { @@ -95,6 +99,7 @@ class RWLockGuard { switch (status_) { case Status::kUnLock: { lock_->RDLock(); + status_ = Status::kRDLock; break; } case Status::kRDLock: { @@ -111,6 +116,7 @@ class RWLockGuard { void UnLock() { if (status_ != Status::kUnLock) { lock_->UNLock(); + status_ = Status::kUnLock; } } diff --git a/paddle/fluid/operators/conv_transpose_cudnn_op.cu.cc b/paddle/fluid/operators/conv_transpose_cudnn_op.cu.cc index 2376212f509..73831611d01 100644 --- a/paddle/fluid/operators/conv_transpose_cudnn_op.cu.cc +++ b/paddle/fluid/operators/conv_transpose_cudnn_op.cu.cc @@ -230,7 +230,7 @@ class CUDNNConvTransposeGradOpKernel : public framework::OpKernel { // Because beta is zero, it is unnecessary to reset filter_grad. // Gradient with respect to the filter for (int g = 0; g < groups; g++) { - auto cudnn_func = [&](void* cudnn_func) { + auto cudnn_func = [&](void* cudnn_workspace) { CUDNN_ENFORCE(platform::dynload::cudnnConvolutionBackwardFilter( handle, &alpha, cudnn_output_desc, output_grad_data + output_grad_offset * g, cudnn_input_desc, diff --git a/paddle/fluid/platform/device_context.cc b/paddle/fluid/platform/device_context.cc index ec297ea9a63..3d416bb528a 100644 --- a/paddle/fluid/platform/device_context.cc +++ b/paddle/fluid/platform/device_context.cc @@ -176,7 +176,7 @@ class CudnnHolder { if (required_workspace_len <= workspace_len_) { return; } - void* new_workspace = paddle::memory::Alloc(place_, required_len); + void* new_workspace = paddle::memory::Alloc(place_, required_workspace_len); if (workspace_ != nullptr) { // Maybe someone is using the current workspace PADDLE_ENFORCE(cudaStreamSynchronize(*stream_)); @@ -184,7 +184,7 @@ class CudnnHolder { paddle::memory::Free(place_, workspace_); } workspace_ = new_workspace; - workspace_len_ = required_len; + workspace_len_ = required_workspace_len; } cudnnHandle_t cudnn_handle_; -- GitLab