CUDA and Visual Studio 2008 Guide for Beginners?

So, I’ve been doing some reading on CUDA for the last few weeks, and learning whatever I can from the forums here, and I’m ready to try some programming now.

Unfortunately, I’m using Visual Studio 2008, which I need for work (I’m primarily a C#/.NET developer). It seems that CUDA 2.0 only supports the use of VS2005.

When asked directly, the only answer I’ve seen from the nVidia staff is to wait for official support with CUDA 2.1 – and they will only say that it will be available “by the end of the year.”

So, given that I’m stuck with using Visual Studio 2008 (and I don’t see why I should have to download and install VS2005 C++ Express to be able to use CUDA), what are my options? Are there any steps to getting CUDA 2.0 to work with VS2008? Or, will I be stuck waiting a few months for CUDA 2.1?

If you have gotten VS2008 to work with CUDA, please list (in detail) the steps you took to get it working, and any caveats you have run into. I would really like to start working with CUDA, if I can find a way to do so.

I appreciate any help you all can give on this; I am a bit baffled as to why they are both not supported, since each has quite a large userbase by this point.

EDIT: I have seen a thread about compiling with VS2008 (, but I would like to know specifically what needs to be done to get things working (i.e., step by step).

VC2005 Express is really the only way that’s supported or thoroughly tested by us. Consider how tightly nvcc integrates with the host compiler–MSVC doesn’t know anything about <<< >>> syntax, or the underscored attributes that we include, or anything like that. Driver API can probably be forced to work (as AndreiB said in the thread you linked), but VC2005 Express is honestly the best way for the majority of people. Doesn’t even really break the toolchain as far as I’m aware, since you’re just adding a -ccbin arg.

So, if I absolutely have to use VC2005 Express (which I will try if necessary), do I just need to install that, and then re-install the CUDA SDK (in order to let it install whatever extras it needs to into VC2005)? Do I need to change any other settings after I do this?

You don’t even have to reinstall CUDA–all you have to do is to tell nvcc to use the VC2005 Express compiler by setting the -ccbin parameter to the VC2005 Express version of cl.exe. Then, which compiler does what should be:

  • CUDA kernels in .cu files: nvcc

  • host support code in .cu files: VC2005 cl.exe

  • everything else: VC2008

Disclaimer: according to lots of people, this works, but I haven’t tried it myself.

On XP-64 I wasn’t able to use the Express version of VS2005 with CUDA.

I’m forgetting what the issue was exactly (maybe the downloadable Microsoft SDK not including 64-bit stuff?) – there’s a forum thread here somewhere I could dig up where other users had the same problem. I had to go to a full version of VS2005 for XP-64.

On XP-32 this isn’t an issue and the Express version is fine.

edit: clarify MS SDK issue, not CUDA SDK issue

Ahh…crap. I’m on XP x64.

So, can’t use Visual Studio 2008, and can’t use Visual Studio 2005 Express with XP x64.

Any other options?

try VC2005 Express anyway; you might just have to download the Windows SDK separately. if I get some time, I’ll give it a shot.

I didn’t mean to throw you off. I think you might be OK w/ VS2005 express because you’ll be using the full Platform SDK installed from VS2008, which probably has what you need. I didn’t have VS2008 so I had to use the downloadable Platform SDK, and it didn’t have everything needed, IIRC.

I don’t think XP64 is a problem unless you’re building 64-bit binary. I’m on Vista64 and I’ve managed to build 32-bit CUDA project (with runtime API, not driver). I’ve faced some problems when trying to compile for x64 target, probably because I have 32-bit CUDA toolkit.
Just add path to VS2005 compiler to nvcc.profile or modify CUDA build rule and you shoulld be able to use VS2008.

I’m just going to give VC++ 2005 Express a whirl, that seems to be the best way to go for now, though I really didn’t want to have to install it.

However, the installer on the 2.0 Toolkit is hanging now, so I can’t even get the VC++ part of the process yet ;)

Using VC 2005 Express (without IDE and Windows SDK) for CUDA works fine for me.

However, I had to use --ccbin (Case-correct path to VS2005 bin) to get some C++ features to work for host code (exception handling topic).