Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling CUDA with Visual Studio 2010

I have used Visual Studio 2008 to compile and run CUDA applications before. I have switched to Visual Studio 2010 and Windows 7. I've been trying to get integration set up all morning, but haven't had complete success. I've downloaded the toolkit, installed Nsight, made sure the libraries/include/bin paths are set, checked the box to use a Build Customization of CUDA 3.2, and set the properties of the individual .cu file to be of type CUDA C/C++ instead of C/C++. I got an error about not supporting compiler v100, so I set the project platform to v90 and am downloading Visual Studio 2008 now. I was hoping that I wouldn't have to have two versions of visual studio installed, but oh well. Anyway, most of the syntax highlighting is enabled, some keywords like "int" is blue, comments are green, and strings are red. However, cuda-specific keywords like __ global__ aren't. Also, I've checked through the include directories and can't find cutil.h, so I'm wondering if there's anything else that wasn't included in the install of the 3.2 SDK (I have included cuda_runtime.h instead, but I don't know if this will solve my problems). Does anyone know how to fix this?

Edit: I have Visual Studio 2008 installed. When I try to compile, I get a giant list of errors, starting with 1>C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\crtdefs.h(490): error : invalid redeclaration of type name "size_t", while most of the following errors have to deal with the size_t type. All of the errors are in included files, most of which I've never seen. Does anyone know what's going on? Or if there's a simple, step-by-step guide to getting VS2010 to use cuda?

Edit 2: Apparently I had one of the many current settings as 64-bit, and the others as 32-bit. Changing the active configuration, Cuda C/C++ Target Machine Platform, and Linker|Advanced Target Machine all to 32-bit or 64-bit allowed me to compile and run. I still don't have any idea how to fix the __ global__ and such syntax highlighting, but it's not that big of an issue.

like image 557
user450775 Avatar asked Nov 15 '22 06:11

user450775


1 Answers

You'll find a complete guide here:

How to Run CUDA In Visual Studio 2010

like image 91
jwdmsd Avatar answered Dec 25 '22 15:12

jwdmsd