15 #define EIGEN_TEST_NO_LONGDOUBLE
16 #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 using Eigen::SyclDevice;
30 template <
typename DataType,
int DataLayout,
typename IndexType>
34 IndexType sizeDim1 = 4;
35 IndexType sizeDim2 = 4;
36 IndexType sizeDim3 = 1;
44 DataType* gpu_data1 =
static_cast<DataType*
>(sycl_device.allocate(in.
size()*
sizeof(DataType)));
45 DataType* gpu_data2 =
static_cast<DataType*
>(sycl_device.allocate(
out.size()*
sizeof(DataType)));
50 sycl_device.memcpyHostToDevice(gpu_data1, in.
data(),(in.
size())*
sizeof(DataType));
51 gpu2.device(sycl_device) = gpu1.tanh();
52 sycl_device.memcpyDeviceToHost(
out.data(), gpu_data2,(
out.size())*
sizeof(DataType));
56 for (
int i = 0;
i < in.
size(); ++
i) {
60 template <
typename DataType,
int DataLayout,
typename IndexType>
64 IndexType sizeDim1 = 4;
65 IndexType sizeDim2 = 4;
66 IndexType sizeDim3 = 1;
74 DataType* gpu_data1 =
static_cast<DataType*
>(sycl_device.allocate(in.
size()*
sizeof(DataType)));
75 DataType* gpu_data2 =
static_cast<DataType*
>(sycl_device.allocate(
out.size()*
sizeof(DataType)));
80 sycl_device.memcpyHostToDevice(gpu_data1, in.
data(),(in.
size())*
sizeof(DataType));
81 gpu2.device(sycl_device) = gpu1.sigmoid();
82 sycl_device.memcpyDeviceToHost(
out.data(), gpu_data2,(
out.size())*
sizeof(DataType));
86 for (
int i = 0;
i < in.
size(); ++
i) {
93 QueueInterface queueInterface(
s);
94 auto sycl_device = Eigen::SyclDevice(&queueInterface);
95 test_tanh_sycl<DataType, RowMajor, int64_t>(sycl_device);
96 test_tanh_sycl<DataType, ColMajor, int64_t>(sycl_device);
97 test_sigmoid_sycl<DataType, RowMajor, int64_t>(sycl_device);
98 test_sigmoid_sycl<DataType, ColMajor, int64_t>(sycl_device);
102 for (
const auto& device :Eigen::get_sycl_supported_devices()) {
103 CALL_SUBTEST(sycl_computing_test_per_device<float>(device));