提交 a07deac9 编写于 作者: Q qijun

follow comments

上级 85806e75
......@@ -13,12 +13,18 @@ limitations under the License. */
namespace paddle {
namespace platform {
namespace dynload {
namespace dummy {
// Make DeviceContext A library.
int DUMMY_VAR_FOR_DEV_CTX = 0;
} // namespace dummy
} // namespace dynload
template <>
Eigen::DefaultDevice DeviceContext::get_eigen_device<Eigen::DefaultDevice>() {
return reinterpret_cast<CPUDeviceContext*>(this)->eigen_device();
}
#ifndef PADDLE_ONLY_CPU
template <>
Eigen::GpuDevice DeviceContext::get_eigen_device<Eigen::GpuDevice>() {
return reinterpret_cast<CUDADeviceContext*>(this)->eigen_device();
}
#endif
} // namespace platform
} // namespace paddle
\ No newline at end of file
} // namespace paddle
......@@ -31,7 +31,7 @@ class DeviceContext {
virtual Place GetPlace() const = 0;
template <typename DeviceType>
inline DeviceType get_eigen_device();
DeviceType get_eigen_device();
};
class CPUDeviceContext : public DeviceContext {
......@@ -52,11 +52,6 @@ class CPUDeviceContext : public DeviceContext {
Eigen::DefaultDevice* eigen_device_{nullptr};
};
template <>
Eigen::DefaultDevice DeviceContext::get_eigen_device<Eigen::DefaultDevice>() {
return dynamic_cast<CPUDeviceContext*>(this)->eigen_device();
}
#ifndef PADDLE_ONLY_CPU
class GPUPlaceGuard {
......@@ -183,10 +178,6 @@ class CUDADeviceContext : public DeviceContext {
curandGenerator_t rand_generator_{nullptr};
};
template <>
Eigen::GpuDevice DeviceContext::get_eigen_device<Eigen::GpuDevice>() {
return dynamic_cast<CUDADeviceContext*>(this)->eigen_device();
}
#endif
} // namespace platform
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册