14 #define EIGEN_TEST_NO_LONGDOUBLE 15 #define EIGEN_TEST_NO_COMPLEX 16 #define EIGEN_TEST_FUNC cxx11_tensor_reduction_sycl 17 #define EIGEN_DEFAULT_DENSE_INDEX_TYPE int 18 #define EIGEN_USE_SYCL 21 #include <unsupported/Eigen/CXX11/Tensor> 27 const int num_rows = 452;
28 const int num_cols = 765;
37 full_redux = in.sum();
40 float* gpu_out_data =(
float*)sycl_device.allocate(
sizeof(
float));
46 out_gpu.
device(sycl_device) = in_gpu.sum();
47 sycl_device.memcpyDeviceToHost(full_redux_gpu.
data(), gpu_out_data,
sizeof(
float));
51 sycl_device.deallocate(gpu_in_data);
52 sycl_device.deallocate(gpu_out_data);
72 redux= in.sum(red_axis);
81 out_gpu.
device(sycl_device) = in_gpu.sum(red_axis);
85 for(
int j=0;
j<reduced_tensorRange[0];
j++ )
86 for(
int k=0; k<reduced_tensorRange[1]; k++ )
89 sycl_device.deallocate(gpu_in_data);
90 sycl_device.deallocate(gpu_out_data);
110 redux= in.sum(red_axis);
119 out_gpu.
device(sycl_device) = in_gpu.sum(red_axis);
122 for(
int j=0;
j<reduced_tensorRange[0];
j++ )
123 for(
int k=0; k<reduced_tensorRange[1]; k++ )
126 sycl_device.deallocate(gpu_in_data);
127 sycl_device.deallocate(gpu_out_data);
132 cl::sycl::gpu_selector
s;
133 Eigen::SyclDevice sycl_device(s);
static void test_full_reductions_sycl(const Eigen::SyclDevice &sycl_device)
static void test_first_dim_reductions_sycl(const Eigen::SyclDevice &sycl_device)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor< Scalar_, NumIndices_, Options_, IndexType_ > & setRandom()
TensorDevice< TensorMap< PlainObjectType, Options_, MakePointer_ >, DeviceType > device(const DeviceType &device)
void test_cxx11_tensor_reduction_sycl()
#define VERIFY_IS_APPROX(a, b)
A tensor expression mapping an existing array of data.
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DenseIndex TotalSize() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar * data()
static void test_last_dim_reductions_sycl(const Eigen::SyclDevice &sycl_device)
#define CALL_SUBTEST(FUNC)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions & dimensions() const