Step-by-step mini guide to CUDA compiling on Visual Studio 2008 - windows 7 - 64 bits Step-by-step m

It took me a while to be able to simply rebuild/compile all SDK examples using Visual Studio 2008 on windows 7 - 64 bits…

Here is a step-by step guide to how I finally managed to get it to work seamlessly.

I hope this will be of help to others who are struggling like I did !

(incidentally, my laptop is a HP Pavillion intel core 5 - 4G ram with NVIDIA Geforce G105M)

First of all, install last versions of:

    [*]Visual Studio C++ professionnal 2008 - (don’t forget the x64 component under vc++ … for me, it did not install itself by default !!!)

    [*]Windows SDK

    [*]Direct X

    [*]CUDA toolkit

    [*]CUDA developer SDK

    [*]NVIDIA Driver

Then you can start the setup…

Step1:

Go to file:

C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\vcvarsamd64.bat

Edit that file (in Windows 7 you have to open notepad as administrator = right click on notepad in the accessories and then → run as administrator )

Step 2:

Under the line that gives the install directory of visual studio - something like :

@SET VCINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC

Add a new line that contains the path to the last version of your windows SDK:

@SET WIN64SDKDIR=C:\Program Files\Microsoft SDKs\Windows\v7.1

(here v7.1 could be replaced by whatever other version you have)

Step 3:

Edite the line that starts like : @set PATH=%VCINSTALLDIR (…lots of stuff…) %PATH%

by adding this at the end just before the %PATH%:

WIN64SDKDIR%\Bin\x64;%WIN64SDKDIR%\Bin\x64\vsstools;c:\CUDA\bin64;

(note that “c:\CUDA\bin64;” could be changed with whatever is your cuda bin64 path)

So you get something like :

@set PATH=%VCINSTALLDIR%\BIN\amd64;%FrameworkDir%%FrameworkVersion%;%VCINSTALLDIR%\VCPackages;%VSINSTALLDIR%\Common7\IDE;%VSINSTALLDIR%\Common7\Tools;%WIN64SDKDIR%\Bin\x64;%WIN64SDKDIR%\Bin\x64\vsstools;c:\CUDA\bin;%PATH%

Step 4:

Edit the line that starts like

@set INCLUDE=%VCINSTALLDIR%\INCLUDE (…stuff…)%INCLUDE%

such that you add %WIN64SDKDIR%\INCLUDE; just before the %INCLUDE%

So you get something like:

@set INCLUDE=%VCINSTALLDIR%\INCLUDE;%WIN64SDKDIR%\INCLUDE;%INCLUDE%

Step 5:

Edit the line that starts like

@set LIB=%VCINSTALLDIR%\LIB\amd64 (…stuff…)%LIB%

such that you add %WIN64SDKDIR%\INCLUDE; just before the %LIB%

So you get something like:

@set LIB=%VCINSTALLDIR%\LIB\amd64;%WIN64SDKDIR%\Lib\x64;%LIB%

Step 6

Go to your SDK examples folders, and open a project with Visual Studio 2008

Make sure x64 is chosen in the the combo-box top-center.

Change project → properties → Configuration properties → Cuda Build Rule vx.x → Hybrid Cuda/C++ options → Runtime Library from Multi-Threaded (/MT) to Multi-Threaded Debug (/MTd)

That’s it !!

Feel free to build/compile and run…

This was working fine on cuda 3.1 - the new Cuda 3.2 seems to behave slightly differently. (I just got it to work by copying cUtil64D.lib in each project directory).

Good luck!

Alternatively, I’ve been able to use the 32 bit libraries that install with CUDA. This is obviously a different solution and either this or the above may be better depending on your situation.

Just use the library files at “${CUDA_BIN_PATH}..\lib”.

~ Raz

Alternatively, I’ve been able to use the 32 bit libraries that install with CUDA. This is obviously a different solution and either this or the above may be better depending on your situation.

Just use the library files at “${CUDA_BIN_PATH}..\lib”.

~ Raz

I Can’t Find the amd64 folder…

I know this means i don’t have support for x64. Where can I find the complement?

I have installed Windows SDK 7.1 but it i can’t target x64 plataform.

I have VISUAL STUDIO 2008 Cuda Toolkit 3.2, and i can RUN all the examples already compiled…

Please Help!!!

You 're tutorial was quite thorough and very helpful. I followed it step by step and i managed to compile and run the cuda examples successfully. Moreover, I would really appreciate it if you could be more specific on the following instruction:

I wasn’t able to find the above selection, and I would be really grateful if you could help me out.

Thank you again for your splendid tutorial.

Regards External Image

Hi,

I think I had the same problem.

You need to reinstall Visual Studio 2008 in custom mode. Then You will have the option to tick the box to install the x64 module…

Hopefully, that should work…

Hi,

If I remember well, in Cuda 3.2 the way visual studio project are built is different from Cuda 3.1. You can’t access any more this rather strange Cuda Build Rule vx.x since Cuda 3.2. Hopefully (last time I played with Cuda was several months ago, so my memory of the whole installation thing is quite blurry now), this should not be an issue.

Cheers!

Oh, ok then External Image

Again, thanks for your help External Image

[quote name=‘popanik’ date=‘27 February 2011 - 07:38 AM’ timestamp=‘1298813938’ post=‘1199447’]

You 're tutorial was quite thorough and very helpful. I followed it step by step and i managed to compile and run the cuda examples successfully. Moreover, I would really appreciate it if you could be more specific on the following instruction:

I wasn’t able to find the above selection, and I would be really grateful if you could help me out.

Thank you again for your splendid tutorial.

Regards External Image

/quote]

I just completed this tutorial as well, I was able to change the debugging, but I was not able to compile within this new environment. Regardless, I’ve attached a screen shot of where to find the run time debug change.

Thanks for the detailed explanation! External Image
Just one simple addition : You have to install DirectX SDK, not just DirectX :)
Otherwise, it will keep asking for “d3dx9.h” :)