mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-11 19:29:02 +08:00
Fail at compile time if default executor tries to use non-default device
This commit is contained in:
parent
3fda850c46
commit
f584bd9b30
@ -83,11 +83,14 @@ class TensorExecutor {
|
|||||||
typedef typename Expression::Index StorageIndex;
|
typedef typename Expression::Index StorageIndex;
|
||||||
|
|
||||||
// Including `unsupported/Eigen/CXX11/Tensor` in different translation units
|
// Including `unsupported/Eigen/CXX11/Tensor` in different translation units
|
||||||
// with/without `EIGEN_USE_THREADS` is an ODR violation. If this template
|
// with/without `EIGEN_USE_THREADS` or `EIGEN_USE_GPU` is a potential ODR
|
||||||
// is instantiated with a thread pool device, it means that this header
|
// violation. If this template is instantiated with a non-default device, it
|
||||||
// file was included without defining `EIGEN_USE_THREADS`.
|
// means that this header file was included without defining
|
||||||
static_assert(!std::is_same<Device, ThreadPoolDevice>::value,
|
// `EIGEN_USE_THREADS`, `EIGEN_USE_GPU` or `EIGEN_USE_SYCL`.
|
||||||
"You are missing `#define EIGEN_USE_THREADS`");
|
static_assert(std::is_same<Device, DefaultDevice>::value,
|
||||||
|
"Default executor instantiated with non-default device. "
|
||||||
|
"You must #define EIGEN_USE_THREADS, EIGEN_USE_GPU or "
|
||||||
|
"EIGEN_USE_SYCL before including Eigen headers.");
|
||||||
|
|
||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
static EIGEN_STRONG_INLINE void run(const Expression& expr,
|
static EIGEN_STRONG_INLINE void run(const Expression& expr,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user