File tree Expand file tree Collapse file tree
Libraries/oneMKL/black_scholes Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ using namespace oneapi;
2727
2828#include " input_generator.hpp"
2929#include " black_scholes.hpp"
30+ #include " code_wrapper.tpp"
3031
3132namespace {
3233
@@ -83,7 +84,7 @@ void async_sycl_error(sycl::exception_list el) {
8384 try {
8485 std::rethrow_exception (*l);
8586 } 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;
8788 }
8889 }
8990}
@@ -184,7 +185,7 @@ int sample_run(int64_t nopt) {
184185 }
185186 }
186187 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;
188189 return -1 ;
189190 }
190191
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