14 #define EIGEN_TEST_NO_LONGDOUBLE 15 #define EIGEN_TEST_NO_COMPLEX 17 #define EIGEN_DEFAULT_DENSE_INDEX_TYPE int64_t 18 #define EIGEN_USE_SYCL 21 #include <unsupported/Eigen/CXX11/Tensor> 24 template <
typename DataType,
int DataLayout,
typename IndexType>
27 IndexType sizeDim1 = 100;
28 IndexType sizeDim2 = 20;
29 IndexType sizeDim3 = 20;
35 DataType * gpu_in1_data =
static_cast<DataType*
>(sycl_device.allocate(in1.
dimensions().
TotalSize()*
sizeof(DataType)));
36 DataType * gpu_in2_data =
static_cast<DataType*
>(sycl_device.allocate(in2.
dimensions().
TotalSize()*
sizeof(DataType)));
37 DataType * gpu_out_data =
static_cast<DataType*
>(sycl_device.allocate(out.
dimensions().
TotalSize()*
sizeof(DataType)));
39 in1 = in1.random() + in1.constant(static_cast<DataType>(10.0
f));
40 in2 = in2.random() + in2.constant(static_cast<DataType>(10.0
f));
49 gpu_out.
device(sycl_device) =(gpu_in1 + gpu_in2).
eval() * gpu_in2;
51 for (IndexType
i = 0;
i < sizeDim1; ++
i) {
52 for (IndexType
j = 0;
j < sizeDim2; ++
j) {
53 for (IndexType k = 0; k < sizeDim3; ++k) {
55 (in1(
i,
j, k) + in2(
i,
j, k)) * in2(
i,
j, k));
59 printf(
"(a+b)*b Test Passed\n");
60 sycl_device.deallocate(gpu_in1_data);
61 sycl_device.deallocate(gpu_in2_data);
62 sycl_device.deallocate(gpu_out_data);
67 QueueInterface queueInterface(s);
68 auto sycl_device = Eigen::SyclDevice(&queueInterface);
69 test_forced_eval_sycl<DataType, RowMajor, int64_t>(sycl_device);
70 test_forced_eval_sycl<DataType, ColMajor, int64_t>(sycl_device);
73 for (
const auto& device :Eigen::get_sycl_supported_devices()) {
void test_forced_eval_sycl(const Eigen::SyclDevice &sycl_device)
EIGEN_DECLARE_TEST(cxx11_tensor_forced_eval_sycl)
std::ofstream out("Result.txt")
#define VERIFY_IS_APPROX(a, b)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DenseIndex TotalSize() const
A tensor expression mapping an existing array of data.
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
TensorDevice< TensorMap< PlainObjectType, Options_, MakePointer_ >, DeviceType > device(const DeviceType &dev)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar * data()
#define CALL_SUBTEST(FUNC)
void tensorForced_evalperDevice(Dev_selector s)
internal::nested_eval< T, 1 >::type eval(const T &xpr)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions & dimensions() const