DPCT1009

メッセージ

SYCL* はエラーの報告に例外を使用するため、エラーコードは使用していません。オリジナルコードはコメントアウトされ、警告文字列が挿入されました。このコードを書き換える必要があります。

説明

SYCL* では、エラーの報告に例外を使用しており、エラーコードは使用していません。元のコードでは、エラーコードによる文字列メッセージを取得しようとしていますが、SYCL* ではそのような機能は必要ありません。

コードの変更が必要であることを通知するため、警告文字列が挿入されました。

修正方法の提案

コードを修正する必要があります。

例えば、以下のオリジナル CUDA* コードについて考えてみます。


1void foo() { 
2 float *f; 
3 cudaError_t err = cudaMalloc(&f, 4); 
4 printf("%s\n", cudaGetErrorString(err)); 
5}

このコードは、以下の SYCL* コードに移行されます。


1void foo() 
2 float *f; 
3 int err = (f = (float *)sycl::malloc_device(4, dpct::get_default_queue()), 0); 
4 /* 
5 DPCT1009:1: SYCL uses exceptions to report errors and does not use the error 
6 codes.The original code was commented out and a warning string was inserted.
7 You need to rewrite this code.
8 */ 
9 printf("%s\n", 
10 "cudaGetErrorString is not supported" /*cudaGetErrorString(err)*/); 
11}

このコードは次のように書き換えられます。


1void foo() { 
2 float *f; 
3 try { 
4 f = (float *)sycl::malloc_device(4, dpct::get_default_queue()) 
5 } catch (sycl::exception const &e) { 
6 std::cerr << e.what() << std::endl; 
7 } 
8}