Compiling CUDA on Win 7 64-bit

Hi all

I’m trying to compile CUDA stuff on 64-bit Windows 7 using MSVC 8 (2005). I’m using the 64-bit v3.2 of the toolkit, and corresponding driver and SDK. I’ve got two programs, one a standalone executable which manages to compile in 32-bit mode (haven’t tried 64-bit yet), but then hangs before it even reaches main(), and the other a MATLAB dll which I can compile in 64-bit mode but which crashes when the first cuda function is called. Both programs compile and runs fine on a 32-bit system.

For the standalone executable, built using a MSVC 8 project, I’m just using a Win32 configuration that builds and runs fine under 32-bit Windows. The command line for the CUDA code is:
“C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\bin\nvcc.exe” -gencode=arch=compute_11,code=“sm_11,compute_11” --machine 32 -ccbin “C:\Program Files (x86)\Microsoft Visual Studio 8\VC\bin” -Xcompiler “/EHsc /W3 /nologo /O2 /Zi /MT " -I"include” -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\include" -maxrregcount=128 --compile -o “Release/blah.vcproj.obj” blah.vcproj
It builds, but then hangs before even getting to the start of main().

For the MATLAB (R2010b 64-bit) dll I first separately compile each .cu file into a .cpp file using nvcc --cuda -m64, passing in the path to the 32-bit MSVC compiler and include directory. Then I compile the dll from all the .cpp files using MATLAB’s mex command, passing in the path to the 64-bit CUDA libraries. The compilation succeeds, but MATLAB crashes on the first call to a CUDA function. I know that a few people have had success using the nvmex package, but I’d really like to avoid using this.

Any help on either of these issues would be much appreciated.

Many thanks.

I have made some progress as follows:
I tried to build an SDK application for both 32 and 64 bit platforms. This gave me an unresolved symbol from one of the shared libraries (shrUtils). Rebuilding this library fixed that problem. Then I was missing cutil32.dll, so I built this. Having done that, when I ran the program it crashed, saying the the driver didn’t match the toolkit, so I reinstalled the correct driver. Finally both versions of the test application ran fine. This also fixed the problem with my MATLAB dll crashing. My standalone application still hangs before main(), but having made sure that my CUDA related compilation settings are the same as those for the SDK app, I know think that this is a problem with a non-CUDA library.

Just wanted to point out the Jacket SDK as an option to get CUDA code to run in MATLAB, which may help you avoid this hassle. Here’s a blog post describing the difference between DIY CUDA in MATLAB and the Jacket SDK: