diff --git a/paddle/fluid/platform/device_context.cc b/paddle/fluid/platform/device_context.cc index a94714ef82a9958d88325e70495ffe8b709830a4..46013f576777ffbf3ea314e29b2a6350da085adb 100644 --- a/paddle/fluid/platform/device_context.cc +++ b/paddle/fluid/platform/device_context.cc @@ -234,7 +234,7 @@ void CUDAContext::InitEigenContext() { } CUDAContext::CUDAContext(const CUDAPlace& place, - const enum stream::Priority& priority) { + const stream::Priority& priority) { place_ = place; CUDADeviceGuard guard(place_.device); stream_.reset(new stream::CUDAStream(place, priority)); diff --git a/paddle/fluid/platform/device_context.h b/paddle/fluid/platform/device_context.h index 529992b47e2737f86adcc6a57726da53061d7154..7615a0b7ea08cdd75527c196d55da48f8cc23cac 100644 --- a/paddle/fluid/platform/device_context.h +++ b/paddle/fluid/platform/device_context.h @@ -85,7 +85,7 @@ class CUDAContext { CUDAContext() = default; explicit CUDAContext( const CUDAPlace& place, - const enum stream::Priority& priority = stream::Priority::kNormal); + const stream::Priority& priority = stream::Priority::kNormal); ~CUDAContext(); @@ -274,11 +274,11 @@ class CUDADeviceContext : public DeviceContext { return context()->Stream()->WaitCallback(); } - void ResetDefaultContext(const enum stream::Priority& priority) { + void ResetDefaultContext(const stream::Priority& priority) { default_ctx_.reset(new CUDAContext(place_, priority)); } - void ResetThreadContext(const enum stream::Priority& priority) { + void ResetThreadContext(const stream::Priority& priority) { std::lock_guard guard(ctx_mtx_); thread_ctx_[this].reset(new CUDAContext(place_, priority)); } diff --git a/paddle/fluid/platform/stream/cuda_stream.cc b/paddle/fluid/platform/stream/cuda_stream.cc index 7a090ff7e5166545e8cb84de72bb348a5fbb4157..6d3b065037600a114adbe79d24a19836645c67df 100644 --- a/paddle/fluid/platform/stream/cuda_stream.cc +++ b/paddle/fluid/platform/stream/cuda_stream.cc @@ -22,7 +22,7 @@ namespace stream { constexpr unsigned int kDefaultFlag = cudaStreamDefault; -bool CUDAStream::Init(const Place& place, const enum Priority& priority) { +bool CUDAStream::Init(const Place& place, const Priority& priority) { PADDLE_ENFORCE_EQ(is_gpu_place(place), true, platform::errors::InvalidArgument( "Cuda stream must be created using cuda place.")); diff --git a/paddle/fluid/platform/stream/cuda_stream.h b/paddle/fluid/platform/stream/cuda_stream.h index 57e763d5276249fd1cbe6f52dcbef385c496bb85..4272d5fd0b14c5d705d4af84691b3b8d24d1c7f5 100644 --- a/paddle/fluid/platform/stream/cuda_stream.h +++ b/paddle/fluid/platform/stream/cuda_stream.h @@ -36,14 +36,13 @@ enum class Priority : uint8_t { class CUDAStream final { public: CUDAStream() = default; - CUDAStream(const Place& place, - const enum Priority& priority = Priority::kNormal) { + explicit CUDAStream(const Place& place, + const Priority& priority = Priority::kNormal) { Init(place, priority); } virtual ~CUDAStream() { Destroy(); } - bool Init(const Place& place, - const enum Priority& priority = Priority::kNormal); + bool Init(const Place& place, const Priority& priority = Priority::kNormal); template void AddCallback(Callback&& callback) const {