Skip to content

fix deprecation notice #682

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Libraries/oneMKL/black_scholes/black_scholes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ using namespace oneapi;

#include "input_generator.hpp"
#include "black_scholes.hpp"
#include "code_wrapper.tpp"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo? tpp => hpp

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not uncommon to use the tpp extension for template headers, especially when it contains template meta programs. I'm unaware of any guidelines, but don't have any strong preference.


namespace {

Expand Down Expand Up @@ -83,7 +84,7 @@ void async_sycl_error(sycl::exception_list el) {
try {
std::rethrow_exception(*l);
} catch(const sycl::exception & e) {
std::cerr << "SYCL exception occured with code " << e.get_cl_code() << " with " << e.what() << std::endl;
std::cerr << "SYCL exception occured with code " << code_wrapper(e) << " with " << e.what() << std::endl;
}
}
}
Expand Down Expand Up @@ -184,7 +185,7 @@ int sample_run(int64_t nopt) {
}
}
catch (sycl::exception const & re) {
std::cerr << "SYCL exception occured with code " << re.get_cl_code() << " with " << re.what() << std::endl;
std::cerr << "SYCL exception occured with code " << code_wrapper(re) << " with " << re.what() << std::endl;
return -1;
}

Expand Down
28 changes: 28 additions & 0 deletions Libraries/oneMKL/black_scholes/code_wrapper.tpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//==============================================================
// Copyright © 2020 Intel Corporation
//
// SPDX-License-Identifier: MIT
// =============================================================

/*******************************************************************************
! Content:
! Wrapper utility for backward compatibility with get_cl_code in SYCL 1.2.1
!******************************************************************************/

#pragma once
#include <utility>

template <typename T, typename = void>
struct has_member_code_meta : std::false_type {};

template <typename T>
struct has_member_code_meta<T, std::void_t<decltype( std::declval<T>().code() )> > : std::true_type {};

template <typename T, typename std::enable_if<has_member_code_meta<T>::value>::type* = nullptr >
auto code_wrapper (T x) {
return x.code();
};
template <typename T, typename std::enable_if<!has_member_code_meta<T>::value>::type* = nullptr >
auto code_wrapper (T x) {
return x.get_cl_code();
};