DPCT1100#

メッセージ#

現在、インテル® oneAPI マス・カーネル・ライブラリー (oneMKL) の DFT 外部ワークスペース機能は、GPU デバイスでのみサポートされています。コードを GPU デバイス以外で実行する必要がある場合、内部ワークスペースを使用します。

詳細な説明#

インテル® oneAPI マス・カーネル・ライブラリー (英語) の FFT は、計算中に内部ワークスペースと外部ワークスペースのいずれかを使用できます。内部ワークスペース・モードはすべてのデバイスでサポートされますが、外部ワークスペース・モードは、現在 GPU デバイスのみでサポートされます。

修正方法の提案

GPU デバイス以外でコードを実行するには、次のことができます。

  • GPU デバイスを選択するには、dpct::select_device(<device_id>) を使用します。

  • dpct::fft::fft_engine::commit() を呼び出す前に、dpct::fft::fft_engine::use_internal_workspace(true) を呼び出します。

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


1  void foo(cufftHandle plan, float2 *idata, float2 *odata) { 
2   size_t worksize; 
3   void *workspace; 
4   cufftSetAutoAllocation(plan, 0); 
5   cufftMakePlan1d(plan, 7, CUFFT_C2C, 2, &worksize); 
6   cudaMalloc(&workspace, worksize); 
7   cufftSetWorkArea(plan, workspace); 
8   cufftExecC2C(plan, idata, odata, CUFFT_FORWARD); 
9   ...
10 }

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


1  void foo(dpct::fft::fft_engine_ptr plan, sycl::float2 *idata, 
2   sycl::float2 *odata) { 
3   dpct::device_ext &dev_ct1 = dpct::get_current_device(); 
4   sycl::queue &q_ct1 = dev_ct1.in_order_queue(); 
5   size_t worksize; 
6   void *workspace; 
7   /* 
8   DPCT1100:0: Currently the DFT external workspace feature in the Intel(R) 
9   oneAPI Math Kernel Library (oneMKL) is only supported on GPU devices.Use the 
10  internal workspace if your code should run on non-GPU devices.
11  */ 
12  plan->use_internal_workspace(0); 
13  /* 
14  DPCT1100:1: Currently the DFT external workspace feature in the Intel(R) 
15  oneAPI Math Kernel Library (oneMKL) is only supported on GPU devices.Use the 
16  internal workspace if your code should run on non-GPU devices.
17  */ 
18  /* 
19  DPCT1099:2: Verify if the default value of the direction and placement used in 
20  the function "commit" is correct.
21  */ 
22  plan->commit(&q_ct1, 7, dpct::fft::fft_type::complex_float_to_complex_float, 
23  2, &worksize); 
24  workspace = (void *)sycl::malloc_device(worksize, q_ct1); 
25  /* 
26  DPCT1100:3: Currently the DFT external workspace feature in the Intel(R) 
27  oneAPI Math Kernel Library (oneMKL) is only supported on GPU devices.Use the 
28  internal workspace if your code should run on non-GPU devices.
29  */ 
30  plan->set_workspace(workspace); 
31  plan->compute<sycl::float2, sycl::float2>(idata, odata, 
32  dpct::fft::fft_direction::forward); 
33   ... 
34 }

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


1  void foo(dpct::fft::fft_engine_ptr plan, sycl::float2 *idata, 
2   sycl::float2 *odata) { 
3   dpct::device_ext &dev_ct1 = dpct::get_current_device(); 
4   sycl::queue &q_ct1 = dev_ct1.in_order_queue(); 
5   size_t worksize; 
6   void *workspace; 
7   if (dev_ct1.is_gpu()) 
8   plan->use_internal_workspace(0); 
9   plan->commit(&q_ct1, 7, dpct::fft::fft_type::complex_float_to_complex_float, 
10  2, &worksize); 
11  if (dev_ct1.is_gpu()) { 
12  workspace = (void *)sycl::malloc_device(worksize, q_ct1); 
13  plan->set_workspace(workspace); 
14  } 
15  plan->compute<sycl::float2, sycl::float2>(idata, odata, 
16  dpct::fft::fft_direction::forward); 
17   ... 
18 }