Only runs the cxx11_tensor_reduction_sycl on devices that are available.

This commit is contained in:
Benoit Steiner 2016-11-18 16:31:14 -08:00
parent dc601d79d1
commit ca754caa23

View File

@ -128,9 +128,11 @@ static void test_last_dim_reductions_sycl(const Eigen::SyclDevice &sycl_device)
sycl_device.deallocate(gpu_out_data); sycl_device.deallocate(gpu_out_data);
} }
template<typename DataType, typename dev_Selector> void sycl_reduction_test_per_device(dev_Selector s){ template<typename DataType> void sycl_reduction_test_per_device(const cl::sycl::device& d){
QueueInterface queueInterface(s); std::cout << "Running on " << d.template get_info<cl::sycl::info::device::name>() << std::endl;
QueueInterface queueInterface(d);
auto sycl_device = Eigen::SyclDevice(&queueInterface); auto sycl_device = Eigen::SyclDevice(&queueInterface);
test_full_reductions_sycl<DataType, RowMajor>(sycl_device); test_full_reductions_sycl<DataType, RowMajor>(sycl_device);
test_first_dim_reductions_sycl<DataType, RowMajor>(sycl_device); test_first_dim_reductions_sycl<DataType, RowMajor>(sycl_device);
test_last_dim_reductions_sycl<DataType, RowMajor>(sycl_device); test_last_dim_reductions_sycl<DataType, RowMajor>(sycl_device);
@ -139,11 +141,7 @@ template<typename DataType, typename dev_Selector> void sycl_reduction_test_per_
test_last_dim_reductions_sycl<DataType, ColMajor>(sycl_device); test_last_dim_reductions_sycl<DataType, ColMajor>(sycl_device);
} }
void test_cxx11_tensor_reduction_sycl() { void test_cxx11_tensor_reduction_sycl() {
printf("Test on GPU: OpenCL\n"); for (const auto& device : cl::sycl::device::get_devices()) {
CALL_SUBTEST(sycl_reduction_test_per_device<float>((cl::sycl::gpu_selector()))); CALL_SUBTEST(sycl_reduction_test_per_device<float>(device));
printf("repeating the test on CPU: OpenCL\n"); }
CALL_SUBTEST(sycl_reduction_test_per_device<float>((cl::sycl::cpu_selector())));
printf("repeating the test on CPU: HOST\n");
CALL_SUBTEST(sycl_reduction_test_per_device<float>((cl::sycl::host_selector())));
printf("Test Passed******************\n" );
} }