MATLAB Answers

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

33 views (last 30 days)
Riffat Tehseen Amjad
Riffat Tehseen Amjad on 29 Jun 2021
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

Answers (1)

Linda Koletsou Soulti
Linda Koletsou Soulti on 1 Jul 2021
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 Comments
Riffat Tehseen Amjad
Riffat Tehseen Amjad on 11 Aug 2021
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

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by