提交 a71a9e63 编写于 作者: Q qijun

fix gpu build error

上级 ff594fac
...@@ -117,7 +117,7 @@ class Tensor { ...@@ -117,7 +117,7 @@ class Tensor {
#ifdef PADDLE_ONLY_CPU #ifdef PADDLE_ONLY_CPU
PADDLE_THROW("'GPUPlace' is not supported in CPU only device."); PADDLE_THROW("'GPUPlace' is not supported in CPU only device.");
#else #else
GpuMemcpySync(dst_ptr, src_ptr, size, cudaMemcpyDeviceToHost); platform::GpuMemcpySync(dst_ptr, src_ptr, size, cudaMemcpyDeviceToHost);
#endif #endif
} }
} }
......
...@@ -138,13 +138,12 @@ All parameter, weight, gradient are variables in Paddle. ...@@ -138,13 +138,12 @@ All parameter, weight, gradient are variables in Paddle.
}) })
#ifndef PADDLE_ONLY_CPU #ifndef PADDLE_ONLY_CPU
.def_static("gpu_context", .def_static("gpu_context",
[](paddle::platform::Place& place) [](paddle::platform::GPUPlace& place)
-> paddle::platform::DeviceContext* { -> paddle::platform::DeviceContext* {
return new paddle::platform::CUDADeviceContext(place); return new paddle::platform::CUDADeviceContext(place);
}) })
#endif #endif
; ; // NOLINT
py::class_<paddle::platform::Place>(m, "GPUPlace").def(py::init<int>()); py::class_<paddle::platform::Place>(m, "GPUPlace").def(py::init<int>());
py::class_<paddle::platform::Place>(m, "CPUPlace").def(py::init<>()); py::class_<paddle::platform::Place>(m, "CPUPlace").def(py::init<>());
......
...@@ -102,7 +102,7 @@ void PyTensorSetFromArray( ...@@ -102,7 +102,7 @@ void PyTensorSetFromArray(
#ifdef PADDLE_ONLY_CPU #ifdef PADDLE_ONLY_CPU
PADDLE_THROW("'GPUPlace' is not supported in CPU only device."); PADDLE_THROW("'GPUPlace' is not supported in CPU only device.");
#else #else
GpuMemcpySync( platform::GpuMemcpySync(
dst, array.data(), sizeof(T) * array.size(), cudaMemcpyHostToDevice); dst, array.data(), sizeof(T) * array.size(), cudaMemcpyHostToDevice);
#endif #endif
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册