How to use the CUDA Toolkit v6.5 with VS Express 2013?

Hello,
I have lots of versions of Visual Studio on my laptop. There is only one “pro” version, though VS 2008 and it crashes about a minute after it is launched. It used to run fine. So I thought I should try seeing if the Cuda Development kit can be used with VS Express for Desktop, 2013. I installed the NVidia toolkit version 6.5 after I installed the VS Express, but
I cant seem to get a “Cuda” project in my VS express interface. Since the NVidia website claims I can do Cuda development with the version 6.5 toolkit, I’d like to know if there is any documentation to this end.
Googling did not find anything.

The getting started document should help:

http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-microsoft-windows/index.html#introduction

I would start by working your way though that document, and make sure you understand everything through section 3:

http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-microsoft-windows/index.html#compiling-cuda-programs

Once you can build and run a sample project, you can start doing your own development just by replacing the code in one of the sample projects.

AFAIK express edition does not support add-ons.

It’s true that express edition does not support add-ons, but this does not prevent you from using it with CUDA. The limitation is that you cannot use Nsight Visual Studio edition, but ordinary edit/compile/run operations can be performed within VS2013 express. You can also use the standalone visual profiler, nvvp, on windows regardless of VS version.

The documentation refered to in the above advice says:

When creating a new CUDA application, the Visual Studio project file must be configured to include CUDA build customizations. To accomplish this, click File-> New | Project… NVIDIA-> CUDA->, then select a template for your CUDA Toolkit version. For example, selecting the “CUDA 6.5 Runtime” template will configure your project for use with the CUDA 6.5 Toolkit. The new project is technically a C++ project (.vcxproj) that is preconfigured to use NVIDIA’s Build Customizations. All standard capabilities of Visual Studio C++ projects will be available.

Here are a few remarks:

  1. Now under Visual Studio Express 2013 for Windows Desktop New | Project does not display Nvidia (nor Cuda).
    This is unlike Visual Studio 2008 Professional which seems to be no longer supported by the NVidia Toolkit setup, if I look at the sample solution names. My Visual Studio 2008 now crashes on startup anyway.

  2. The directory called c:\ProgramData is hidden under my Windows Explorer, but I can see it at the command line. The samples of version 5.5 of the development kit used to be inside c:\NVidia. Can anyone tell me how to make ProgramData visible in the explorer?

  3. I tried running nvcc with a sample file and here is what I got

D:\dev\Cuda\CommandLine1>nvcc kernel.cu
nvcc fatal : Microsoft Visual Studio configuration file ‘vcvars64.bat’ could not be found for installation at ‘C:/Program Files (x86)/Microsoft Visual Studio
12.0/VC/bin/…/…’

Now there is no vcvars64.bat on my system. There is a vcvars32.bat file and in a subdirectory a file called
vcvarsx86_amd64.bat. Is that the file nvcc should be running?

OK, you can make c:\ProgramData (and hence the samples) visible by following the advice here.
http://windows.microsoft.com/en-us/windows/show-hidden-files#show-hidden-files=windows-7

I should have stated that I am running Windows 7 and so I am limited to using
Microsft Visual Studio Express 2013 for Windows Desktop
Here is my current impression:
I can nom compile and run some of the sample files but, in order to make new CUDA projects wiht the VS Express interface I need to make a copy of an existing project (for example a sample) and then modify it.

Copying an existing project is typically easier, and I don’t think this is unique to VS2013 (in my opinion, it’s been easier to work with an existing project in previous VS versions as well). In VS2013 express, here is what I did to start a “new” project:

  1. Open VS2013 Express
  2. Click on New Project…
  3. Select Visual C++, then General, then Empty Project
  4. At this point you should have a new project open. Right click on the project (name) and select Build Dependencies… Build Customizations…
  5. A new dialog opens, select the CUDA 6.5 (.targets,.props) checkbox, and click OK
  6. In your project explorer window, Right click on Source Files, select add…, C++ file, then change the name from “Source.cpp” to “Source.cu”
  7. In your project explorer window, right click on the newly created Source.cu file, and select CUDA C++, then make any changes (for example, you may want to change the build target from sm_20 to something else…)
  8. Add appropriate source code to your Source.cu file
  9. Right click on the project name, select Properties…
  10. Under Linker…Input modify Additional Dependencies to include cudart.lib
  11. Select Build…Rebuild Solution

The above steps worked for me with VS2013 express and CUDA 6.5.

Note that previous VS express versions did not natively support building 64-bit apps. This may have changed with VS 2013 express but if so I am not aware of it.

In Visual Studio 2010 Pro/Ultimate we can add CUDA Header(.cuh) or CUDA Source(.cu) files as a new items by right click the respective Project,but the problem is in Visual Studio 2013 Pro/Ultimate their is no capability to add those files in to the project.Only capability they provide us is to create a new project-> “CUDA 6.5 Runtime”,but in VS2010 we have both capabilites (to add new CUDA project and add new items in to the project as *.cuh or *.cu).
Please help on this matter,How can we solve this? Is there any user settings to addin to VS2013?

Hey there,

I’ve got Visual Studio 2013 Professional, running Windows 8.1 with an Nvidia GeForce GTX 670M.

I just installed the Cuda Toolkit 6.5 and there is no project template in the VS2013. Is there anyway for me to manually add the templates or something?

I know I could just follow txbob, but I kind of prefer things to work the way they were intended if I can. So before I go creating my own templates; has anyone solved this issue? Particularly for professional users?

Thanks,
\M

CUDA project templates are provided as part of the CUDA samples, installed with CUDA 6.5

http://docs.nvidia.com/cuda/cuda-samples/index.html#creating-cuda-projects-for-windows

My previous response was made with respect this statement:

“I can nom compile and run some of the sample files but, in order to make new CUDA projects wiht the VS Express interface I need to make a copy of an existing project (for example a sample) and then modify it.”

That is not the case and my previous response was a demonstration of that.

Oh… So that’s basically telling me that they do not integrate their own project templates into VS2013 anymore? You just have to make copies of their example templates?

If that’s the case then so be it. But how can I make VS2013 recognize the .cu as a programming file… Otherwise all my code shows up in the same color and its horrifying to try and read.

Oh… So that’s basically telling me that they do not integrate their own project templates into VS2013 anymore? You just have to make copies of their example templates?

If that’s the case then so be it. But how can I make VS2013 recognize the .cu as a programming file… Otherwise all my code shows up in the same color and its horrifying to try and read.

Hey all, fixed it when I updated VS2013 Pro to Update 4.0! The template is now in the new project interface.

\M

FYI the template is also in VS2013 Community Edition.

cb4