From 15cc9128be6c06a5643290f7996f7c635e7f2a17 Mon Sep 17 00:00:00 2001 From: fengjiayi Date: Thu, 30 Aug 2018 08:35:15 +0000 Subject: [PATCH] fix compile error --- paddle/fluid/platform/device_context.cc | 10 +++++----- paddle/fluid/platform/device_context.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/paddle/fluid/platform/device_context.cc b/paddle/fluid/platform/device_context.cc index 3f8da69fc2f..5c0dcdad3a0 100644 --- a/paddle/fluid/platform/device_context.cc +++ b/paddle/fluid/platform/device_context.cc @@ -145,9 +145,9 @@ class EigenCudaStreamDevice : public Eigen::StreamInterface { class CudnnHolder { public: CudnnHolder(const cudaStream_t* stream, const CUDAPlace& place) - : stream_(stream), place_(place), workspace_(nullptr), workspace_len_(0) { + : workspace_(nullptr), workspace_len_(0), stream_(stream), place_(place) { PADDLE_ENFORCE(dynload::cudnnCreate(&cudnn_handle_)); - PADDLE_ENFORCE(dynload::cudnnSetStream(cudnn_handle_, stream_)); + PADDLE_ENFORCE(dynload::cudnnSetStream(cudnn_handle_, *stream_)); } cudnnHandle_t get_cudnn_handle() const { return cudnn_handle_; } @@ -157,14 +157,14 @@ class CudnnHolder { void* new_workspace = paddle::memory::Alloc(place_, required_len); if (workspace_ != nullptr) { // Maybe someone is using the current workspace - PADDLE_ENFORCE(cudaStreamSynchronize(stream_)); + PADDLE_ENFORCE(cudaStreamSynchronize(*stream_)); PADDLE_ENFORCE(cudaGetLastError()); paddle::memory::Free(place_, workspace_); } workspace_ = new_workspace; workspace_len_ = required_len; } - return workspace_ + return workspace_; } ~CudnnHolder() { PADDLE_ENFORCE(dynload::cudnnDestroy(cudnn_handle_)); } @@ -231,7 +231,7 @@ cudnnHandle_t CUDADeviceContext::cudnn_handle() const { return cudnn_holder_->get_cudnn_handle(); } -void* cudnn_workspace(size_t required_len) const { +void* CUDADeviceContext::cudnn_workspace(size_t required_len) const { return cudnn_holder_->get_workspace(required_len); } diff --git a/paddle/fluid/platform/device_context.h b/paddle/fluid/platform/device_context.h index 7314d91f3ea..5bcd04fa02f 100644 --- a/paddle/fluid/platform/device_context.h +++ b/paddle/fluid/platform/device_context.h @@ -69,7 +69,7 @@ struct DefaultDeviceContextType { #ifdef PADDLE_WITH_CUDA class EigenCudaStreamDevice; -class CUDNNHolder; +class CudnnHolder; class CUDADeviceContext : public DeviceContext { public: -- GitLab