aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/test/cxx11_tensor_device_sycl.cpp
diff options
context:
space:
mode:
authorGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2016-11-18 12:37:13 -0800
committerGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2016-11-18 12:37:13 -0800
commit7335c492043db9eb51efd5fe6cb5bdc32f3a618f (patch)
tree79b37f3612e454e2ae4fe04e754eed1e1bf6e471 /unsupported/test/cxx11_tensor_device_sycl.cpp
parent15e226d7d3b80d89d04a5b51baaf5b5d2aaad589 (diff)
Fixed the cxx11_tensor_device_sycl test
Diffstat (limited to 'unsupported/test/cxx11_tensor_device_sycl.cpp')
-rw-r--r--unsupported/test/cxx11_tensor_device_sycl.cpp29
1 files changed, 15 insertions, 14 deletions
diff --git a/unsupported/test/cxx11_tensor_device_sycl.cpp b/unsupported/test/cxx11_tensor_device_sycl.cpp
index 2f8cfa081..95da83c6f 100644
--- a/unsupported/test/cxx11_tensor_device_sycl.cpp
+++ b/unsupported/test/cxx11_tensor_device_sycl.cpp
@@ -19,12 +19,14 @@
#include "main.h"
#include <unsupported/Eigen/CXX11/Tensor>
-#include<stdint.h>
+#include <stdint.h>
+#include <iostream>
template <typename DataType, int DataLayout>
-void test_device_sycl(const Eigen::SyclDevice &sycl_device) {
- std::cout <<"Hello from ComputeCpp: the requested device exists and the device name is : "
- << sycl_device.sycl_queue().get_device(). template get_info<cl::sycl::info::device::name>() <<std::endl;
+void test_device_memory(const Eigen::SyclDevice &sycl_device) {
+ std::cout << "Running on : "
+ << sycl_device.sycl_queue().get_device(). template get_info<cl::sycl::info::device::name>()
+ <<std::endl;
int sizeDim1 = 100;
array<int, 1> tensorRange = {{sizeDim1}};
Tensor<DataType, 1, DataLayout> in(tensorRange);
@@ -34,7 +36,7 @@ void test_device_sycl(const Eigen::SyclDevice &sycl_device) {
sycl_device.memset(gpu_in_data, 1,in.size()*sizeof(DataType) );
sycl_device.memcpyDeviceToHost(in.data(), gpu_in_data, in.size()*sizeof(DataType) );
for (int i=0; i<in.size(); i++) {
- VERIFY_IS_APPROX(in(i), in1(i));
+ VERIFY_IS_EQUAL(in(i), in1(i));
}
sycl_device.deallocate(gpu_in_data);
}
@@ -56,20 +58,19 @@ void test_device_exceptions(const Eigen::SyclDevice &sycl_device) {
template<typename DataType, typename dev_Selector> void sycl_device_test_per_device(dev_Selector s){
QueueInterface queueInterface(s);
auto sycl_device = Eigen::SyclDevice(&queueInterface);
- test_device_sycl<DataType, RowMajor>(sycl_device);
- test_device_sycl<DataType, ColMajor>(sycl_device);
- /// this test throw an exeption. enable it if you want to see the exception
- // test_device_exceptions<DataType, RowMajor>(sycl_device);
- /// this test throw an exeption. enable it if you want to see the exception
- // test_device_exceptions<DataType, ColMajor>(sycl_device);
-
+ test_device_memory<DataType, RowMajor>(sycl_device);
+ test_device_memory<DataType, ColMajor>(sycl_device);
+ /// this test throw an exception. enable it if you want to see the exception
+ //test_device_exceptions<DataType, RowMajor>(sycl_device);
+ /// this test throw an exception. enable it if you want to see the exception
+ //test_device_exceptions<DataType, ColMajor>(sycl_device);
}
void test_cxx11_tensor_device_sycl() {
printf("Test on GPU: OpenCL\n");
CALL_SUBTEST(sycl_device_test_per_device<int>((cl::sycl::gpu_selector())));
- printf("repeating the test on CPU: OpenCL\n");
- CALL_SUBTEST(sycl_device_test_per_device<int>((cl::sycl::cpu_selector())));
+ // printf("repeating the test on CPU: OpenCL\n");
+ // CALL_SUBTEST(sycl_device_test_per_device<int>((cl::sycl::cpu_selector())));
printf("repeating the test on CPU: HOST\n");
CALL_SUBTEST(sycl_device_test_per_device<int>((cl::sycl::host_selector())));
printf("Test Passed******************\n" );