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;
50 sycl_device.memcpyDeviceToHost(
out.data(), gpu_out_data,(
out.dimensions().TotalSize())*
sizeof(DataType));
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()) {