DirectX + CUDA Combined Build Environment
It has been roughly twenty years since anybody paid me to write code for a living. Having wasted many productive programming years of my career as management overhead I must confess to being pretty rusty, never-the-less I am very happy to finally be able to get back to my roots. A lot of things have changed since I was writing operating systems in VAX assembly language. For one thing, almost all the code I could imagine needing has been written by somebody and posted online free for my convenience. Coding these days is less an exercise in algorithmic machinations than knowing your way around Google search and being proficient with the cut and paste hotkeys in your editor of choice. To that end, I ask myself: “What is the most useful community service a rusty graphics and operating system engineer can perform in his first blog?”
To that end I have elected, in this my inaugural blog posting, to tackle a simple but extremely tedious task. I’ve been catching up on DirectX 11.1 and Nvidia’s CUDA technology and much to my chagrin have found that Microsoft’s DirectX and Nvidia’s developer SDK’s have suffered some significant bit-rot since they were last updated. Having a deep and abiding interest in GPU computing, I have spent a great many hours recently trying to get Nvidia’s Graphics SDK 11 code to compile reliably and merge it with CUDA code. The problem is that Nvidia’s Graphics SDK has not been updated since Visual Studio 2008. Microsoft is on Visual Studio 2012, but Nvidia’s CUDA SDK and tools presently only work with Visual Studio 2010. I have undertaken the task of porting one of the Nvidia Graphic’s SDK sample projects (Island11, my personal favorite) to Visual Studio 2010 and merging it with the CUDA SDK default project sample. Naturally I also had to ensure that it compiled in x86 and x64 debug and release modes.
My expectation of course is that at some point in the near future it will be wise and necessary to move all of this code over to Windows 8, Visual Studio 2012 and some unreleased VS2012 compatible version of Nvidia’s CUDA toolset or to Windows 8 AMP when it is mature. In the near term however, I have concluded that attempting such an effort on Windows 8 is presently impractical and that avid GPU developers would be well advised to stick with Windows 7 for the time being. Having taken a preliminary stab at porting some of this code to Windows 8 I have taken some “naughty” liberties in constructing this sample build environment. I included the DirectX Utility files and DirectX include files with the build instead of using the $(DXSDK_DIR) environment variable. The purpose is to make the build as self-contained and portable as possible. I found this packaging useful when trying to move to Windows 8 because the DirectX SDK is different and merged with the Windows SDK in Windows 8 thereby invalidating all references to the $(DXSDK_DIR) in earlier Visual Studio projects.
Here then is a link to a completely self-contained DirectX 11/CUDA sample program from the Nvidia Graphics SDK 11 ported to Visual Studio 2010, merged with a CUDA project and adapted to compile in x64bit mode with the necessary DirectX include files “Included” to keep the whole package as self-contained and bit-rot resistant as possible. I tested this build on a clean Windows 7pro PC with a GeForce GTX 690 (Incredible GPU!) with the following installation steps;
- Install Visual Studio 2010 (Trial Edition)
http://www.microsoft.com/en-us/download/details.aspx?id=16057
- Install DirectX SDK
http://www.microsoft.com/en-us/download/details.aspx?id=6812
- Install Nvidia Graphics SDK 11
https://developer.nvidia.com/nvidia-graphics-sdk-11
- Install Nvidia CUDA Toolkit
https://developer.nvidia.com/cuda-toolkit
- Install Nvidia Nsight Visual Studio Edition
https://developer.nvidia.com/nvidia-nsight-visual-studio-edition
- Unzip this demo project and build it in Visual Studio 2010
http://www.alexstjohn.com/cudademo.zip
…Nothing to it… I verified that all of the build permutations compile and that the DirectX and CUDA functionality also works in this configuration environment. Good luck and thanks to all the folks responding to the many forum questions on this subject for giving me all the bread crumbs necessary to stitch this thing together.
-TheSaint


impressive !