Configuration of CUDA and Visual Studio 2008 in a Windows Server 2008 64 bits environment

First Steps

To start, you must install your copy of Windows Server in the target computer, and install the GPU in the computer - but only the hardware part. You shall not have many problems here.

Beware that you must install CUDA 2.1 to support VS2008. - I just found it out after installing CUDA 2.0, so all the screenshots below refer to the 2.0 version. Still, all the tests were redone.

Key components

As you may find in NVIDIA's website, you need to install three key components to develop with CUDA: the driver, the toolkit and the SDK code samples. The code samples are usefull to see if everything is fine.

win1.jpg
Figure 1. Key components._

You just need to install them in order (Driver, Toolkit, SDK). There were no problems in this phase. It was much, much easier than the installation in linux, as seen in the linux guide. Below, you can see the SDK window and some of the samples that come with it.

win2.jpg
Figure 2. CUDA SDK window.

win4.jpg
Figure 3. N-body simulation with CUDA.

win3.jpg
Figure 4. fluidsGL, as seen in the linux guide.

Visual Studio configuration

First, I tried to install the Visual Studio 2005, but I discovered some problems with compatibility between it and the Windows Server 2008, as can be seen in Figure 5. When installing VS 2008 in a 64b environment, do not forget to install Visual C++ x64 tools! They are not installed by default!

win5.jpg
Figure 5. Compatibility issues.

After installing Visual Studio 2008, I searched for some code samples, to guarantee that the instalation was fine. The tested samples can be find here. Below, the result of the compilation and runing of the test C++\International\unires.

8unicode.jpg
Figure 6. "When the world wants to talk, it speaks Unicode."

Ok, now we have VS2008 and CUDA running in the same machine under the same OS (Windows Server 2008 64b). Now we have to make them work together.

First, we download the CUDA VS Wizard. It integrates VS and CUDA. We will work with the version for 64 bits systems.

After downloading and installing it, you will try to create a new CUDA64 project. But it will not work! Here is the problem: the file “your path for VS 2008”\VC\vcprojects\CUDA64WinApp.sz is like follows:

VSWIZARD 7.0
Wizard=VsWizard.VsWizardEngine.8.0
Param="WIZARD_NAME = CUDAWinApp"
{'Param="RELATIVE_PATH = VCWizards\CUDA64""}
Param="CONSOLE_TYPE_ONLY = true"
Param="FALLBACK_LCID = 1033"

You must change the second line for “.9.0”, as follows:

VSWIZARD 7.0
Wizard=VsWizard.VsWizardEngine.9.0
Param="WIZARD_NAME = CUDAWinApp"
Param="RELATIVE_PATH = VCWizards\CUDA64"
Param="CONSOLE_TYPE_ONLY = true"
Param="FALLBACK_LCID = 1033"

Now you can create your project. When creating a project, VS presents you with an example file sample.cu. To compile it, you must guarantee that your solution platform is set to x64. If you use the Win32 plataform, you will get a message 1>LINK : fatal error LNK1181: cannot open input file 'cutil32D.lib' when building your project.

Finally, to run the project, you may have problems with the cutil64D.dll file. The simplest solution is to copy the file to the project folder.

To test if your configuration is working, you may build and run your sample project, or one of the many that come with the SDK. You may find the projects in C:\ProgramData\NVIDIA Corporation\NVIDIA CUDA SDK\projects\ . When opening the project, a popup window will appear, asking you if you want to convert the project to VS2008. I believe you may run the project without converting it, but the conversion works fine too. After this, just change the solution platform to x64, build it and run.

works.jpg
Figure 7. Running the deviceQuery project

Now, to enable syntax highlighting, you just have to follow the steps listed in C:\ProgramData\NVIDIA Corporation\NVIDIA CUDA SDK\doc\syntax_highlighting\visual_studio_8\readme.txt . It is the same way in Visual Studio 2008 (alias “Visual Studio 9”). I will just copy it below:

Want pretty syntax highlighting when editing your .cu files in Visual Studio?_
Here's how:

---
Visual Studio .Net 2005 / Visual Studio 8:

1. If you don't have a usertype.dat file in your "Microsoft Visual Studio 8\Common7\IDE" folder, then copy the included usertype.dat file there. If you do, append the contents of the included usertype.dat onto the end of the "Microsoft Visual Studio 8\Common7\IDE\usertype.dat"

2. Start Visual Studio 8. Select the menu "Tools->Options...". Open "Text Editor" in the tree view on the left, and click on "File Extension". Type cu in the "Extension" box, and click "Add". Click "OK" on the dialog box.

3. Restart Visual Studio and your CUDA code should now have syntax highlighting.

high.jpg
Figure 8. Syntax highlighted!!

Now you have your own CUDA environment on Windows Server 2008 64b :)

Last edited Apr 20, 2009 at 2:31 PM by Pilla, version 12

Comments

No comments yet.