Visual Studio 2008 architecture building weirdness

Hi, I have come across something I would consider a bit weird with building for various architectures in VS2008 (Cuda 5.0) and was wondering whether anyone could shed some light.

Build 1 - Architectures selected 1.1, 2.0 and 3.5. Builds fine, runs fine on all machines.
Build 2 - Architectures selected 2.0 and 3.5. Builds fine but only runs on Titan machine, not a 580 GTX which is compute 2.0. Eyebrows were raised.
Build 3 - Architectures selected 2.0. DOES NOT BUILD, complains that AtomicInc is undefined.
Build 4 - Archiectures selected 1.1, 2.0. Builds fine and runs on all machines (but obviously without 3.5 optimisations).

Why is AtomicInc not defined in 2.0, and why does the compiler allow the arch 2.0 to successfully build when it relies on something to do with the 3.5 architecture to build correctly? (The kernel that uses AtomicInc basically creates garbage). This has made me nervous about how the compiler is selecting what kernels and options to use if it happily continues using things it should know it cannot use.




  • make sure kernel files are inheriting their architecture target settings from the project and not being overridden
  • make sure you haven't hard-coded the device id into your device selection logic
  • verify that the "item type" of the CUDA files is "CUDA C/C++" and not "C/C++ Compiler"

What you’re describing should not be happening. I routinely build multi-target projects in VS2010 (and previously 2008).

My guess is that your project is damaged.