Create .ptx files from .cu files

22 次查看(过去 30 天)
Alexandre
Alexandre 2014-7-28
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 个评论
Edric Ellis
Edric Ellis 2014-7-29
Have you tried launching a "Visual Studio Command Prompt" from the "Start" menu and then using NVCC from there?

请先登录,再进行评论。

回答(1 个)

Herve Hugonnet
Herve Hugonnet 2020-5-8
编辑:Herve Hugonnet 2020-5-8
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

类别

Help CenterFile Exchange 中查找有关 GPU Computing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by