MATLAB Answers

CUDAKernel not recognizing ptx filename.

11 views (last 30 days)
Martin Kuhnel
Martin Kuhnel on 31 Jul 2019
Commented: weui zhang on 6 Oct 2021 at 7:02
Hello,
I am attempting to use a CUDA function written in a file called 'cluster.cu' and compiled to 'cluster.ptx' in matlab. It worked fine the first time I tried it, but ever since then I get the following error:
"Error using parallel.internal.gpu.handleKernelArgs
The first input to parallel.gpu.CUDAKernel must be the name of a file that contains PTX code or an array containing PTX code."
Here is a snippet of the code involved:
cudaname = 'cluster.cu';
ptxname = 'cluster.ptx';
kernel = parallel.gpu.CUDAKernel(ptxname,cudaname);
I am not sure what I am doing wrong here. I am passing it the name of a ptx file. Any ideas?
  3 Comments
Pierre E.
Pierre E. on 26 Apr 2020
The same for me... it seems that the generated .ptx file is empty. It seems to be a nvcc problem

Sign in to comment.

Answers (1)

weui zhang
weui zhang on 25 Jul 2021
Have you solved this problem?
I meet the same questions to you.But do not solve this.
  6 Comments
weui zhang
weui zhang on 6 Oct 2021 at 7:02
if single_yes
specific_filename = 'cuda/calculate_tensors_single';
else
specific_filename = 'cuda/calculate_tensors_double';
end
cudaFilename = [specific_filename, '.cu'];
ptxFilename = [specific_filename, '.ptx'];
system(['nvcc -ptx ', cudaFilename, ' --output-file ', ptxFilename]);
kernel = parallel.gpu.CUDAKernel( ptxFilename, cudaFilename );
The above is my code, it still mentioned "Error using parallel.internal.gpu.handleKernelArgs
The first input to parallel.gpu.CUDAKernel must be the name of a file that contains PTX code or an array containing PTX code."

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!