CUDAKernel not recognizing ptx filename.

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

Joss Knight
Joss Knight 2019년 8월 3일
How did you compile your PTX file? What commands did you use?
Guilherme
Guilherme 2020년 3월 25일
I'm getting the same error using the following command to generate the PTX file
nvcc pctdemo_processMandelbrotElement.cu -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\Hostx64\x64" -ptx
Pierre E.
Pierre E. 2020년 4월 26일
The same for me... it seems that the generated .ptx file is empty. It seems to be a nvcc problem

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

답변 (1개)

weui zhang
weui zhang 2021년 7월 25일

0 개 추천

Have you solved this problem?
I meet the same questions to you.But do not solve this.

댓글 수: 7

Hello Weui,
Has the PTX file been created properly with the expected name? A way to inspect the contents of the file is by using the command type followed by the name of the file inside the Command Window:
type filename.ptx
Could you also please let me know what are the commands you use to compile the file to PTX?
Cheers,
Linda
I found that the .ptx file has not been generated.
cudaFilename = [specific_filename, '.cu'];
ptxFilename = [specific_filename, '.ptx'];
system(['nvcc -ptx ', cudaFilename, ' --output-file ', ptxFilename]);
kernel = parallel.gpu.CUDAKernel( ptxFilename, cudaFilename );
Hello Weui,
are you sure that the name of the file in specific_filename variable is properly spelled and resides in the folder you are when the system command is executed?
Cheers,
Linda
weui zhang
weui zhang 2021년 7월 26일
I am sure the questions you mentioned are all correct
Hello Weui,
I will need some additional information to understand the issue you are facing. Does the system command throw any errors? Could you please add the verbose option, too:
system(['nvcc -v -ptx ', cudaFilename, ' --output-file ', ptxFilename]);
Have you tried to compile the file to ptx outside MATLAB? Could you please share some additional information like the .cu file you are trying to compile?
Can you successfully follow the steps in the example in the following link:
Cheers,
Linda
weui zhang
weui zhang 2021년 10월 6일
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."
凯仁 解
凯仁 解 2021년 11월 12일
The same for me,and my ptx file has the content:
//
// Generated by NVIDIA NVVM Compiler
//
// Compiler Build ID: CL-24330188
// Cuda compilation tools, release 9.2, V9.2.148
// Based on LLVM 3.4svn
//
.version 6.2
.target sm_30
.address_size 64

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

카테고리

도움말 센터File Exchange에서 Containers에 대해 자세히 알아보기

질문:

2019년 7월 31일

댓글:

2021년 11월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by