From a71a9e639304e1e1301c00ef890d5cb000b500b1 Mon Sep 17 00:00:00 2001 From: qijun Date: Tue, 25 Jul 2017 09:25:46 +0000 Subject: [PATCH] fix gpu build error --- paddle/framework/tensor.h | 2 +- paddle/pybind/pybind.cc | 9 ++++----- paddle/pybind/tensor_bind.h | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/paddle/framework/tensor.h b/paddle/framework/tensor.h index 10813d4aad..5f07256c05 100644 --- a/paddle/framework/tensor.h +++ b/paddle/framework/tensor.h @@ -117,7 +117,7 @@ class Tensor { #ifdef PADDLE_ONLY_CPU PADDLE_THROW("'GPUPlace' is not supported in CPU only device."); #else - GpuMemcpySync(dst_ptr, src_ptr, size, cudaMemcpyDeviceToHost); + platform::GpuMemcpySync(dst_ptr, src_ptr, size, cudaMemcpyDeviceToHost); #endif } } diff --git a/paddle/pybind/pybind.cc b/paddle/pybind/pybind.cc index e53340cc9f..2cc26a926e 100644 --- a/paddle/pybind/pybind.cc +++ b/paddle/pybind/pybind.cc @@ -138,13 +138,12 @@ All parameter, weight, gradient are variables in Paddle. }) #ifndef PADDLE_ONLY_CPU .def_static("gpu_context", - [](paddle::platform::Place& place) + [](paddle::platform::GPUPlace& place) -> paddle::platform::DeviceContext* { - return new paddle::platform::CUDADeviceContext(place); - }) + return new paddle::platform::CUDADeviceContext(place); + }) #endif - ; - + ; // NOLINT py::class_(m, "GPUPlace").def(py::init()); py::class_(m, "CPUPlace").def(py::init<>()); diff --git a/paddle/pybind/tensor_bind.h b/paddle/pybind/tensor_bind.h index a94c89d328..fdf8861b68 100644 --- a/paddle/pybind/tensor_bind.h +++ b/paddle/pybind/tensor_bind.h @@ -102,7 +102,7 @@ void PyTensorSetFromArray( #ifdef PADDLE_ONLY_CPU PADDLE_THROW("'GPUPlace' is not supported in CPU only device."); #else - GpuMemcpySync( + platform::GpuMemcpySync( dst, array.data(), sizeof(T) * array.size(), cudaMemcpyHostToDevice); #endif } -- GitLab