diff --git a/paddle/platform/device_context.cc b/paddle/platform/device_context.cc index 8d122032924cb8218556aeffa4c0517b4865e98e..44afb5d4ee6f961b54b6ee0d6bd0bc42a6d422e4 100644 --- a/paddle/platform/device_context.cc +++ b/paddle/platform/device_context.cc @@ -32,7 +32,7 @@ Eigen::DefaultDevice* CPUDeviceContext::eigen_device() const { return eigen_device_.get(); } -Place CPUDeviceContext::place() const { return CPUPlace(); } +Place CPUDeviceContext::GetPlace() const { return CPUPlace(); } #ifndef PADDLE_ONLY_CPU @@ -50,7 +50,7 @@ CUDADeviceContext::CUDADeviceContext(GPUPlace place) : place_(place) { CUDADeviceContext::~CUDADeviceContext() { SetDeviceId(place_.device); - wait(); + Wait(); if (cublas_handle_) { PADDLE_ENFORCE(dynload::cublasDestroy(cublas_handle_)); } @@ -67,11 +67,11 @@ CUDADeviceContext::~CUDADeviceContext() { PADDLE_ENFORCE(cudaStreamDestroy(stream_)); } -Place CUDADeviceContext::place() const { return place_; } +Place CUDADeviceContext::GetPlace() const { return place_; } cudaStream_t CUDADeviceContext::stream() const { return stream_; } -void CUDADeviceContext::wait() const { +void CUDADeviceContext::Wait() const { PADDLE_ENFORCE(cudaStreamSynchronize(stream_)); } diff --git a/paddle/platform/device_context.h b/paddle/platform/device_context.h index b2a542a836a7cc9bfbd092ec2b2908dbfbcbdd2f..57035b335f2b5c55578b9da7bdcdc939b1a83efa 100644 --- a/paddle/platform/device_context.h +++ b/paddle/platform/device_context.h @@ -31,7 +31,7 @@ namespace platform { class DeviceContext { public: virtual ~DeviceContext() {} - virtual Place place() const = 0; + virtual Place GetPlace() const = 0; template DeviceType* get_eigen_device() const; @@ -45,7 +45,7 @@ class CPUDeviceContext : public DeviceContext { Eigen::DefaultDevice* eigen_device() const; - Place place() const override; + Place GetPlace() const override; private: std::unique_ptr eigen_device_; @@ -59,13 +59,13 @@ class CUDADeviceContext : public DeviceContext { virtual ~CUDADeviceContext(); /*! \brief Wait for all operations completion in the stream. */ - void wait() const; + void Wait() const; /*! \brief Return CUDA stream in the device context. */ cudaStream_t stream() const; /*! \brief Return place in the device context. */ - Place place() const override; + Place GetPlace() const override; /*! \brief Return eigen device in the device context. */ Eigen::GpuDevice* eigen_device() const;