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 Kommentare

Joss Knight
Joss Knight am 3 Aug. 2019
How did you compile your PTX file? What commands did you use?
Guilherme
Guilherme am 25 Mär. 2020
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. am 26 Apr. 2020
The same for me... it seems that the generated .ptx file is empty. It seems to be a nvcc problem

Melden Sie sich an, um zu kommentieren.

Antworten (1)

weui zhang
weui zhang am 25 Jul. 2021

0 Stimmen

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

7 Kommentare

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 am 26 Jul. 2021
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 am 6 Okt. 2021
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."
凯仁 解
凯仁 解 am 12 Nov. 2021
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

Melden Sie sich an, um zu kommentieren.

Kategorien

Gefragt:

am 31 Jul. 2019

Kommentiert:

am 12 Nov. 2021

Community Treasure Hunt

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

Start Hunting!

Translated by