Intel® oneAPI Data Parallel C++
Support for Intel® oneAPI DPC++ Compiler, Intel® oneAPI DPC++ Library, Intel ICX Compiler , Intel® DPC++ Compatibility Tool, and GDB*
583 Discussions

sycl::exception get_cl_code() function not working

DeepikaGanga
Employee
566 Views

The below piece of code from a oneAPI program is giving an error.

if (e.get_cl_code() == CL_DEVICE_NOT_FOUND) {
std::cout << "If you are targeting an FPGA, ensure that your "

 

src/split/hough_transform_kernel.cpp:75:15: warning: 'get_cl_code' is deprecated: use sycl::exception.code() instead. [-Wdeprecated-declarations]
        if (e.get_cl_code() == CL_DEVICE_NOT_FOUND) {
              ^

 

As suggested in the error, tried using  sycl::exception.code() instead:

if (sycl::exception.code() == CL_DEVICE_NOT_FOUND) {
std::cout << "If you are targeting an FPGA, ensure that your "

But that gives the following error:

src/split/hough_transform_kernel.cpp:75:28: error: cannot use dot operator on a type
        if (sycl::exception.code() == CL_DEVICE_NOT_FOUND) {
                           ^

 

Please let me know what is the correct usage here.

Further referring to the first error, it states ''get_cl_code' is deprecated', but the sycl specification from this link https://sycl.readthedocs.io/en/latest/iface/exception.html shows 'get_cl_code' is still supported. So please clarify where I can find the updated sycl spec for this error.

Thanks,

Deepika

0 Kudos
1 Solution
VarshaS_Intel
Moderator
533 Views

Hi,

 

Thanks for posting in Intel Communities.

 

Please try using the below code snippet as we are getting the expected results without any errors.

catch(sycl::exception const& e) {
     if (e.code().value() == CL_DEVICE_NOT_FOUND) {

 

Could you please try and let us know if you are still facing any issues? Please provide us with a sample reproducer code if the provided code snippet does not work.

 

Thanks & Regards,

Varsha

 

View solution in original post

0 Kudos
2 Replies
VarshaS_Intel
Moderator
534 Views

Hi,

 

Thanks for posting in Intel Communities.

 

Please try using the below code snippet as we are getting the expected results without any errors.

catch(sycl::exception const& e) {
     if (e.code().value() == CL_DEVICE_NOT_FOUND) {

 

Could you please try and let us know if you are still facing any issues? Please provide us with a sample reproducer code if the provided code snippet does not work.

 

Thanks & Regards,

Varsha

 

0 Kudos
VarshaS_Intel
Moderator
508 Views

Hi,

 

Glad to know that your issue is resolved. Thanks for accepting our solution. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.

 

Thanks & Regards,

Varsha

 

0 Kudos
Reply