필터 지우기
필터 지우기

CUDA ptxas fatal : Unresolved extern function '_Z22mwGet​GlobalThre​adIndexv'

조회 수: 28 (최근 30일)
Hi
I used gpucoder to generate the cuda file corresponding to original function. After that i built a .PTX file from my cuda file and now i want to create CUDAkernel using parallel.gpu.CUDAKernel to speedup my function. By using k = parallel.gpu.CUDAKernel('myfunction.ptx','float *, const double *','_Z15myfunction_kernel1dP15emxArray_real_T'), I am getting an error below:
Error using parallel.gpu.CUDAKernel
An error occurred during PTX compilation of <image>.
The information log was:
The error log was:
ptxas fatal : Unresolved extern function '_Z22mwGetGlobalThreadIndexv'
The CUDA error code was: CUDA_ERROR_INVALID_PTX.
How to get rid of this error? Any help will be much appreciated. Regards

답변 (1개)

Linda Koletsou Soulti
Linda Koletsou Soulti 2021년 7월 1일
Hello Riffat,
it seems that the kernel calls into a helper function that it was not compiled with the kernel.
The following example may be helpful:
Cheers,
Linda
  댓글 수: 3
Linda Koletsou Soulti
Linda Koletsou Soulti 2021년 7월 6일
Hello Riffat,
in the folder of the generated code there should be a file called MWCudaDimUtility.cu. Your device code calls into a function called mwGetGlobalThreadIndex inside this file. There are a couple of ways to resolve the issue caused by this dependency. I believe the easiest would be to copy the contents of the MWCudaDimUtility.cu file inside the file of your code, before the definition of your function. Then build this file to ptx.
Cheers,
Linda
Riffat Tehseen Amjad
Riffat Tehseen Amjad 2021년 8월 11일
I solved the problem by copying MWCudaDimUtility.h file, found on the web, in place of MWCudaDimUtility.h file created by gpucoder and it worked. Thanks for your help Linda!
Best,
Riffat

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 GPU Computing에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by