16 #define EIGEN_TEST_NO_LONGDOUBLE 17 #define EIGEN_TEST_NO_COMPLEX 18 #define EIGEN_TEST_FUNC cxx11_tensor_sycl 19 #define EIGEN_DEFAULT_DENSE_INDEX_TYPE int 20 #define EIGEN_USE_SYCL 23 #include <unsupported/Eigen/CXX11/Tensor> 26 using Eigen::SyclDevice;
55 gpu_in1.
device(sycl_device) = gpu_in1.constant(1.2
f);
57 for (
int i = 0;
i < sizeDim1; ++
i) {
58 for (
int j = 0;
j < sizeDim2; ++
j) {
59 for (
int k = 0; k < sizeDim3; ++k) {
64 printf(
"a=1.2f Test passed\n");
67 gpu_out.
device(sycl_device) = gpu_in1 * 1.2f;
69 for (
int i = 0;
i < sizeDim1; ++
i) {
70 for (
int j = 0;
j < sizeDim2; ++
j) {
71 for (
int k = 0; k < sizeDim3; ++k) {
77 printf(
"a=b*1.2f Test Passed\n");
81 gpu_out.
device(sycl_device) = gpu_in1 * gpu_in2;
83 for (
int i = 0;
i < sizeDim1; ++
i) {
84 for (
int j = 0;
j < sizeDim2; ++
j) {
85 for (
int k = 0; k < sizeDim3; ++k) {
92 printf(
"c=a*b Test Passed\n");
95 gpu_out.
device(sycl_device) = gpu_in1 + gpu_in2;
97 for (
int i = 0;
i < sizeDim1; ++
i) {
98 for (
int j = 0;
j < sizeDim2; ++
j) {
99 for (
int k = 0; k < sizeDim3; ++k) {
106 printf(
"c=a+b Test Passed\n");
109 gpu_out.
device(sycl_device) = gpu_in1 * gpu_in1;
111 for (
int i = 0;
i < sizeDim1; ++
i) {
112 for (
int j = 0;
j < sizeDim2; ++
j) {
113 for (
int k = 0; k < sizeDim3; ++k) {
120 printf(
"c= a*a Test Passed\n");
123 gpu_out.
device(sycl_device) = gpu_in1 * gpu_in1.constant(3.14
f) + gpu_in2 * gpu_in2.constant(2.7
f);
125 for (
int i = 0;
i < sizeDim1; ++
i) {
126 for (
int j = 0;
j < sizeDim2; ++
j) {
127 for (
int k = 0; k < sizeDim3; ++k) {
130 + in2(
i,
j,k) * 2.7
f);
134 printf(
"a*3.14f + b*2.7f Test Passed\n");
138 gpu_out.
device(sycl_device) =(gpu_in1 > gpu_in1.constant(0.5
f)).select(gpu_in2, gpu_in3);
140 for (
int i = 0;
i < sizeDim1; ++
i) {
141 for (
int j = 0;
j < sizeDim2; ++
j) {
142 for (
int k = 0; k < sizeDim3; ++k) {
149 printf(
"d= (a>0.5? b:c) Test Passed\n");
150 sycl_device.deallocate(gpu_in1_data);
151 sycl_device.deallocate(gpu_in2_data);
152 sycl_device.deallocate(gpu_in3_data);
153 sycl_device.deallocate(gpu_out_data);
156 cl::sycl::gpu_selector
s;
157 Eigen::SyclDevice sycl_device(s);
void test_sycl_cpu(const Eigen::SyclDevice &sycl_device)
TensorDevice< TensorMap< PlainObjectType, Options_, MakePointer_ >, DeviceType > device(const DeviceType &device)
void test_cxx11_tensor_sycl()
#define VERIFY_IS_APPROX(a, b)
A tensor expression mapping an existing array of data.
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DenseIndex TotalSize() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar * data()
#define CALL_SUBTEST(FUNC)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions & dimensions() const