DPCT1047

メッセージ

<API name><parameter name> の意味が <API name> と異なります。移行したコードを確認する必要があります。

説明

cuBLAS* と cuSolver* の getrf API では、LU 因数分解は P*A=L*U として実行され、インテル® oneAPI マス・カーネル・ライブラリー (英語) API では A=P*L*U として実行されます。行列 P の結果は異なる場合があります。

修正方法の提案

行列 P がライブラリー API でのみ使用されている場合は、この警告を無視してください。P が他の方法で使用される場合、P の値を調整する必要があります。

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


1 void foo(cublasHandle_t handle, float **a_array, float **b_array, int *p_array, 
2 int *info_array) { 
3    cublasSgetrfBatched(handle, 2, a_array, 2, p_array, info_array, 1); 
4    cublasSgetrsBatched(handle, CUBLAS_OP_N, 2, 2, a_array, 2, p_array, b_array, 
5              2, info_array, 1); 
6 }

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


1 void foo(dpct::queue_ptr handle, float **a_array, float **b_array, int *p_array, 
2    int *info_array) { 
3    /* 
4    DPCT1047:0: The meaning of p_array in the dpct::getrf_batch_wrapper is 
5    different from the cublasSgetrfBatched.You may need to check the migrated 
6    code.
7    */ 
8    dpct::getrf_batch_wrapper(*handle, 2, a_array, 2, p_array, info_array, 1); 
9    dpct::getrs_batch_wrapper(*handle, oneapi::mkl::transpose::nontrans, 2, 2, 
10    const_cast<float const **>(a_array), 2, p_array, 
11    b_array, 2, info_array, 1); 
12 }

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


1 void foo(dpct::queue_ptr handle, float **a_array, float **b_array, int *p_array, 
2    int *info_array) { 
3    // cublas/cusolver API getrs need the output of cublas/cusolver getrf as input. 
4    // MKL/dpct helper API getrs need the output of MKL/dpct helper getrf as input. 
5    // In this case, matrix P is only used as a temporary data between library API 
6    // invocations, so the warning can be ignored. 
7    dpct::getrf_batch_wrapper(*handle, 2, a_array, 2, p_array, info_array, 1); 
8    dpct::getrs_batch_wrapper(*handle, oneapi::mkl::transpose::nontrans, 2, 2, 
9    const_cast<float const **>(a_array), 2, p_array, 
10    b_array, 2, info_array, 1); 
11 }