From bdf4c4dff8efc6f67f3565c2a7b492af1c95ec7d Mon Sep 17 00:00:00 2001 From: Byoungro So Date: Wed, 14 Apr 2021 23:19:45 -0700 Subject: [PATCH 1/2] [SYCL] Fix host device check Signed-off-by: Byoungro So --- SYCL/FilterSelector/select_device_cuda.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/SYCL/FilterSelector/select_device_cuda.cpp b/SYCL/FilterSelector/select_device_cuda.cpp index 4a7168a9b6..fbc6b67c10 100644 --- a/SYCL/FilterSelector/select_device_cuda.cpp +++ b/SYCL/FilterSelector/select_device_cuda.cpp @@ -47,11 +47,15 @@ int main() { cout << "Expectedly, cpu device is not found." << std::endl; } } - // HOST device is always available regardless of SYCL_DEVICE_FILTER { host_selector hs; - device d = hs.select_device(); - cout << "HOST device is found: " << d.is_host() << std::endl; + try { + device d = hs.select_device(); + cerr << "CPU device is found in error: " << d.is_host() << std::endl; + return -1; + } catch (...) { + cout << "Expectedly, HOST device is not found." << std::endl; + } } { accelerator_selector as; From b15d942683c61f470c26081e1685f11c9346b664 Mon Sep 17 00:00:00 2001 From: Byoungro So Date: Thu, 15 Apr 2021 09:38:31 -0700 Subject: [PATCH 2/2] fix typo Signed-off-by: Byoungro So --- SYCL/FilterSelector/select_device_cuda.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SYCL/FilterSelector/select_device_cuda.cpp b/SYCL/FilterSelector/select_device_cuda.cpp index fbc6b67c10..bc3ee6a47d 100644 --- a/SYCL/FilterSelector/select_device_cuda.cpp +++ b/SYCL/FilterSelector/select_device_cuda.cpp @@ -51,7 +51,7 @@ int main() { host_selector hs; try { device d = hs.select_device(); - cerr << "CPU device is found in error: " << d.is_host() << std::endl; + cerr << "HOST device is found in error: " << d.is_host() << std::endl; return -1; } catch (...) { cout << "Expectedly, HOST device is not found." << std::endl;