File tree Expand file tree Collapse file tree 2 files changed +31
-2
lines changed
Libraries/oneMKL/black_scholes Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ using namespace oneapi;
27
27
28
28
#include " input_generator.hpp"
29
29
#include " black_scholes.hpp"
30
+ #include " code_wrapper.tpp"
30
31
31
32
namespace {
32
33
@@ -83,7 +84,7 @@ void async_sycl_error(sycl::exception_list el) {
83
84
try {
84
85
std::rethrow_exception (*l);
85
86
} catch (const sycl::exception & e) {
86
- std::cerr << " SYCL exception occured with code " << e. get_cl_code ( ) << " with " << e.what () << std::endl;
87
+ std::cerr << " SYCL exception occured with code " << code_wrapper (e ) << " with " << e.what () << std::endl;
87
88
}
88
89
}
89
90
}
@@ -184,7 +185,7 @@ int sample_run(int64_t nopt) {
184
185
}
185
186
}
186
187
catch (sycl::exception const & re) {
187
- std::cerr << " SYCL exception occured with code " << re. get_cl_code ( ) << " with " << re.what () << std::endl;
188
+ std::cerr << " SYCL exception occured with code " << code_wrapper (re ) << " with " << re.what () << std::endl;
188
189
return -1 ;
189
190
}
190
191
Original file line number Diff line number Diff line change
1
+ // ==============================================================
2
+ // Copyright © 2020 Intel Corporation
3
+ //
4
+ // SPDX-License-Identifier: MIT
5
+ // =============================================================
6
+
7
+ /* ******************************************************************************
8
+ ! Content:
9
+ ! Wrapper utility for backward compatibility with get_cl_code in SYCL 1.2.1
10
+ !******************************************************************************/
11
+
12
+ #pragma once
13
+ #include < utility>
14
+
15
+ template <typename T, typename = void >
16
+ struct has_member_code_meta : std::false_type {};
17
+
18
+ template <typename T>
19
+ struct has_member_code_meta <T, std::void_t <decltype( std::declval<T>().code() )> > : std::true_type {};
20
+
21
+ template <typename T, typename std::enable_if<has_member_code_meta<T>::value>::type* = nullptr >
22
+ auto code_wrapper (T x) {
23
+ return x.code ();
24
+ };
25
+ template <typename T, typename std::enable_if<!has_member_code_meta<T>::value>::type* = nullptr >
26
+ auto code_wrapper (T x) {
27
+ return x.get_cl_code ();
28
+ };
You can’t perform that action at this time.
0 commit comments