14 #define EIGEN_TEST_NO_LONGDOUBLE 15 #define EIGEN_TEST_NO_COMPLEX 16 #define EIGEN_DEFAULT_DENSE_INDEX_TYPE int64_t 17 #define EIGEN_USE_SYCL 20 #include <unsupported/Eigen/CXX11/Tensor> 22 template <
typename DataType,
int DataLayout,
typename IndexType>
30 IndexType sizeDim0 = 72;
31 IndexType sizeDim1 = 97;
35 DataType* d_out =
static_cast<DataType*
>(sycl_device.allocate(out_bytes));
38 gpu_out.
device(sycl_device)=gpu_out.random();
39 sycl_device.memcpyDeviceToHost(out.
data(), d_out,out_bytes);
40 for(IndexType
i=1;
i<sizeDim0;
i++)
41 for(IndexType
j=1;
j<sizeDim1;
j++)
49 sycl_device.deallocate(d_out);
52 template <
typename DataType,
int DataLayout,
typename IndexType>
59 IndexType sizeDim0 = 72;
60 IndexType sizeDim1 = 97;
64 DataType* d_out =
static_cast<DataType*
>(sycl_device.allocate(out_bytes));
67 gpu_out.
device(sycl_device)=gpu_out.random(gen);
68 sycl_device.memcpyDeviceToHost(out.
data(), d_out,out_bytes);
69 for(IndexType
i=1;
i<sizeDim0;
i++)
70 for(IndexType
j=1;
j<sizeDim1;
j++)
80 sycl_device.deallocate(d_out);
84 QueueInterface queueInterface(s);
85 auto sycl_device = Eigen::SyclDevice(&queueInterface);
86 test_sycl_random_uniform<DataType, RowMajor, int64_t>(sycl_device);
87 test_sycl_random_uniform<DataType, ColMajor, int64_t>(sycl_device);
88 test_sycl_random_normal<DataType, RowMajor, int64_t>(sycl_device);
89 test_sycl_random_normal<DataType, ColMajor, int64_t>(sycl_device);
94 for (
const auto& device :Eigen::get_sycl_supported_devices()) {
95 CALL_SUBTEST(sycl_random_test_per_device<float>(device));
96 #ifdef EIGEN_SYCL_DOUBLE_SUPPORT 97 CALL_SUBTEST(sycl_random_test_per_device<double>(device));
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index size() const
void test_sycl_random_normal(const Eigen::SyclDevice &sycl_device)
#define VERIFY_IS_NOT_EQUAL(a, b)
std::ofstream out("Result.txt")
void sycl_random_test_per_device(dev_Selector s)
A tensor expression mapping an existing array of data.
TensorDevice< TensorMap< PlainObjectType, Options_, MakePointer_ >, DeviceType > device(const DeviceType &dev)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar * data()
EIGEN_DECLARE_TEST(cxx11_tensor_random_sycl)
#define CALL_SUBTEST(FUNC)
static void test_sycl_random_uniform(const Eigen::SyclDevice &sycl_device)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor< Scalar_, NumIndices_, Options_, IndexType_ > & setZero()