Create .ptx files from .cu files

13 views (last 30 days)
Alexandre
Alexandre on 28 Jul 2014
Edited: Herve Hugonnet on 8 May 2020
Hi everyone,
I am completely knew to Cuda and wanted to practice with Matlab. Here is the code I wanted to run :
When downloaded the files, there were some .cu files. Therefore I read this :
It looks like .cu files have to be compiled to produce .ptx files that can then be run by Matlab. However, after hours and hours (and hours) of unsuccessful tries, I never made it. I installed Visual Studio 2012, then CUDA toolkit 6.0 and tried to run
nvcc -ptx "my file"
but I never passed the "cl.exe is not in PATH" error... And I tried many many things, like adding the path in ALL my environment variables...
So, it looks like it never manages to find cl.exe automatically, but I have found it (in different folder). Is there a way to manually add it when I type
nvcc -ptx "my file"
? Or maybe someone has a working step by step tutorial that works to compile the .cu files ?
Thanks for your help,
Alex
  1 Comment
Edric Ellis
Edric Ellis on 29 Jul 2014
Have you tried launching a "Visual Studio Command Prompt" from the "Start" menu and then using NVCC from there?

Sign in to comment.

Answers (1)

Herve Hugonnet
Herve Hugonnet on 8 May 2020
Edited: Herve Hugonnet on 8 May 2020
I had the same issue and solved it by adding the path to the cl.exe filed in the comand line (change the path to match your visual studio installation) :
nvcc -ptx "test_kernel.cu" -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64"
Also make sure you installed cuda

Community Treasure Hunt

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

Start Hunting!