From c5e178f4fd38b35f9840f8b5e1ec09f72371336b Mon Sep 17 00:00:00 2001 From: fengjiayi Date: Mon, 23 Apr 2018 13:06:44 +0000 Subject: [PATCH] fix errors --- paddle/fluid/framework/tensor_util.cc | 3 +-- paddle/fluid/framework/tensor_util.h | 3 ++- paddle/fluid/memory/memcpy.cc | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/paddle/fluid/framework/tensor_util.cc b/paddle/fluid/framework/tensor_util.cc index 485aba7060c..d2e60ab1dd1 100644 --- a/paddle/fluid/framework/tensor_util.cc +++ b/paddle/fluid/framework/tensor_util.cc @@ -20,8 +20,7 @@ namespace paddle { namespace framework { void TensorCopy(const Tensor& src, const platform::Place& dst_place, - const platform::DeviceContext& ctx, Tensor* dst, - bool sync = false) { + const platform::DeviceContext& ctx, Tensor* dst, bool sync) { VLOG(3) << "TensorCopy " << src.dims() << " from " << src.place() << " to " << dst_place; src.check_memory_size(); diff --git a/paddle/fluid/framework/tensor_util.h b/paddle/fluid/framework/tensor_util.h index 78b165ebed1..3af68402dc5 100644 --- a/paddle/fluid/framework/tensor_util.h +++ b/paddle/fluid/framework/tensor_util.h @@ -24,7 +24,8 @@ namespace paddle { namespace framework { void TensorCopy(const Tensor& src, const platform::Place& dst_place, - const platform::DeviceContext& ctx, Tensor* dst); + const platform::DeviceContext& ctx, Tensor* dst, + bool sync = false); void TensorCopy(const Tensor& src, const platform::Place& dst_place, Tensor* dst); diff --git a/paddle/fluid/memory/memcpy.cc b/paddle/fluid/memory/memcpy.cc index 347fbe7ecc7..a177d4985fd 100644 --- a/paddle/fluid/memory/memcpy.cc +++ b/paddle/fluid/memory/memcpy.cc @@ -30,7 +30,7 @@ void Copy(platform::CPUPlace, void* dst, template <> void Copy( platform::CPUPlace dst_place, void* dst, platform::CUDAPlace src_place, - const void* src, size_t num, cudaStream_t stream = nullptr) { + const void* src, size_t num, cudaStream_t stream) { platform::SetDeviceId(src_place.device); if (stream) { platform::GpuMemcpyAsync(dst, src, num, cudaMemcpyDeviceToHost, stream); @@ -42,7 +42,7 @@ void Copy( template <> void Copy( platform::CUDAPlace dst_place, void* dst, platform::CPUPlace src_place, - const void* src, size_t num, cudaStream_t stream = nullptr) { + const void* src, size_t num, cudaStream_t stream) { platform::SetDeviceId(dst_place.device); if (stream) { platform::GpuMemcpyAsync(dst, src, num, cudaMemcpyHostToDevice, stream); @@ -54,7 +54,7 @@ void Copy( template <> void Copy( platform::CUDAPlace dst_place, void* dst, platform::CUDAPlace src_place, - const void* src, size_t num, cudaStream_t stream = nullptr) { + const void* src, size_t num, cudaStream_t stream) { if (dst_place == src_place) { platform::SetDeviceId(src_place.device); if (stream) { @@ -68,7 +68,7 @@ void Copy( num, stream); } else { platform::GpuMemcpyPeerSync(dst, dst_place.device, src, src_place.device, - num, stream); + num); } } } @@ -98,7 +98,7 @@ template <> void Copy( platform::CUDAPinnedPlace dst_place, void* dst, platform::CUDAPlace src_place, const void* src, size_t num, - cudaStream_t stream = nullptr) { + cudaStream_t stream) { platform::SetDeviceId(src_place.device); if (stream) { platform::GpuMemcpyAsync(dst, src, num, cudaMemcpyDeviceToHost, stream); @@ -111,7 +111,7 @@ template <> void Copy( platform::CUDAPlace dst_place, void* dst, platform::CUDAPinnedPlace src_place, const void* src, size_t num, - cudaStream_t stream = nullptr) { + cudaStream_t stream) { platform::SetDeviceId(dst_place.device); if (stream) { platform::GpuMemcpyAsync(dst, src, num, cudaMemcpyHostToDevice, stream); -- GitLab