diff options
author | Eugene Zhulenev <ezhulenev@google.com> | 2019-08-30 14:49:40 -0700 |
---|---|---|
committer | Eugene Zhulenev <ezhulenev@google.com> | 2019-08-30 14:49:40 -0700 |
commit | 66665e7e76d2ad5aa37775b3777e9a53c6d1c18c (patch) | |
tree | cb62a23e970d9125475abd95e4c9e68a02a04461 /unsupported/Eigen/CXX11/src/Tensor/TensorBase.h | |
parent | f6c51d9209ccc04d28c39f4c8059e7d3e74d6e07 (diff) |
Asynchronous expression evaluation with TensorAsyncDevice
Diffstat (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorBase.h')
-rw-r--r-- | unsupported/Eigen/CXX11/src/Tensor/TensorBase.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h b/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h index dbacf494e..095c85dc4 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h @@ -1063,6 +1063,17 @@ class TensorBase : public TensorBase<Derived, ReadOnlyAccessors> { return TensorDevice<Derived, DeviceType>(dev, derived()); } +#ifdef EIGEN_USE_THREADS + // Select the async device on which to evaluate the expression. + template <typename DeviceType> + typename internal::enable_if< + internal::is_same<DeviceType, ThreadPoolDevice>::value, + TensorAsyncDevice<Derived, DeviceType>>::type + device(const DeviceType& dev, std::function<void()> done) { + return TensorAsyncDevice<Derived, DeviceType>(dev, derived(), std::move(done)); + } +#endif // EIGEN_USE_THREADS + protected: EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& derived() { return *static_cast<Derived*>(this); } |