There are several steps required to add CUDA support to an XLL+ project.
Warning: take extreme care when installing new drivers on a computer, and consult with support staff as required.
"CUDA Toolkit Downloads" (Windows), either 32-bit or 64-bit, and install it. Note that if you install the 32-bit toolkit you will not be able to build 64-bit code, but that the 64-bit toolkit will let you build both 32-bit and 64-bit add-ins.
"GPU Computing SDK Downloads" (Windows)and install it.
Using XLL+ 7, create a standard XLL+ add-in project.
You should choose the STL run-time libraries, not the MFC libraries. This guide assumes that you create a 64-bit version as well as a 32-bit version.
In Visual Studio 2010, select the project in the Solution Explorer and right-click the Build Customizations... menu.
Put a check against
CUDA 4.1 (.targets, .props), as shown below, and click OK.
In Visual Studio 2008 or 2005, select the project in the Solution Explorer and right-click the Custom Build Rules... menu.
Put a check against
CUDA Runtime API Build Rule, as shown below, and click OK.
This step is a little more complicated than it should be because the CUDA support in Visual Studio is incomplete:- .cu files are not available in the New File dialog.
General/Text File; Click OK.
All Files (*.*). Save the (still empty) file as (e.g.)
YourFileName.cuand click on OK.
Note that this step needs to follow after the Add CUDA source file step above, because the CUDA C/C++ node will not appear in the Project Properties dialog until after a .cu file has been added.
Under Visual Studio 2010:
xlllibsd.lib;cudart.lib;curand.lib;Select Release configuration and All Platforms, and remain on the Linker / Input node. Add the following to the start of the Additional Dependencies list:
Under Visual Studio 2008 or 2005:
xlllibsd.lib cudart.lib curand.lib;Select Release configuration and All Platforms, and remain on the Linker / Input node. Add the following to the start of the Additional Dependencies list:
xlllibsr.lib cudart.lib curand.lib;
Note that because of a bug in the GPU toolkit, under Visual Studio 2008 and 2005, you may need to (a) close the Project Properties dialog, (b) change the active configuration and/or platform and then (c) reopen the Project Properties dialog each time you make a change to the CUDA Runtime API node or any of its child nodes.
You should now be able to build the project under all configurations and platforms.