I am doing gpgpu programming in windows and I have been doing that in Microsoft visual studio 2010. But for some reason I need to use matlab to run my cuda kernels. So I was checking this site and they have mentioned that I need to create a .ptx from .cu file to run my cuda kernels. But I am using windows and I want to create the .ptx file in windows. It would be really helpful if anyone could guide me know how to convert a .cu file to .ptx file. Thanks
Share
One approach is to do this from the command line. You may need to know the location of nvcc.exe as well as cl.exe (the MS VC compiler). In my case I have MS VC 2008 express installed, and cl.exe is located at C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\cl.exe I also have CUDA 4.2 on this particular machine, and nvcc is located at C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.2\bin\nvcc.exe You can probably also use windows search to find these.
With the above information, open a command prompt, and change directory to the .cu file (let’s call it foo.cu) that you want to convert to PTX. nvcc may already be on your PATH, so you may not have to use it’s path:
You can put the path to cl.exe on your PATH variable to simplify the above (should be able to eliminate the -ccbin switch that way.) To get more info about nvcc options, use:
If your program needs additional include files beyond what nvcc knows about, you’ll have to specify the path to those as well using the -I switch. Review the nvcc options for more info.