Cannot compile CUDA code in VS 2015

I recently installed the Cuda 8.0 toolkit in my windows 10 desktop (after removing all v7.5 components). Despite previous versions being incompatible with Visual Studio Enterprise 2015 I was happy to see that Nsight actually create a CUDA project and samples came with VS 2015 versions of the “*.sln” files.

The problem is that when compiling the samples I get errors like this one:

1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\BuildCustomizations\CUDA 8.0.targets(168,9): **error MSB4062**: The "Nvda.Build.CudaTasks.SanitizePaths" task could not be loaded from the assembly C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\BuildCustomizations\Nvda.Build.CudaTasks.v8.0.dll. Could not load file or assembly 'Microsoft.Build.Utilities.v3.5, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

The other strange thing is that earlier today I was able to compile the CUDA samples in my laptop that differs only in that it has VS2015 Community Edition installed (I mean software-wise they’re similar, the hardware is different but always Intrel CPU + NVIDIA graphics card). Any suggestions?


The deviceQuery sample that contains the cuda headers :

#include <cuda_runtime.h>
#include <helper_cuda.h>

in its single “cpp” file (but no actual .cu files) is the only one that compiles and runs fine (I do have a CUDA compatible graphics card if that’s what you’re wondering, as matter of fact all the pre-install actions described in the installation guide were followed). This was the output

C:\NVIDIA\Samples\1_Utilities\deviceQuery…/…/bin/win64/Debug/deviceQuery.exe Starting…

CUDA Device Query (Runtime API) version (CUDART static linking)

Detected 1 CUDA Capable device(s)

Device 0: “GeForce GTX 650”
CUDA Driver Version / Runtime Version 8.0 / 8.0
CUDA Capability Major/Minor version number: 3.0
Total amount of global memory: 2048 MBytes (2147483648 bytes)
( 2) Multiprocessors, (192) CUDA Cores/MP: 384 CUDA Cores
GPU Max Clock rate: 1059 MHz (1.06 GHz)
Memory Clock rate: 2500 Mhz
Memory Bus Width: 128-bit
L2 Cache Size: 262144 bytes
Maximum Texture Dimension Size (x,y,z) 1D=(65536), 2D=(65536, 65536), 3D=(4096, 4096, 4096)
Maximum Layered 1D Texture Size, (num) layers 1D=(16384), 2048 layers
Maximum Layered 2D Texture Size, (num) layers 2D=(16384, 16384), 2048 layers
Total amount of constant memory: 65536 bytes
Total amount of shared memory per block: 49152 bytes
Total number of registers available per block: 65536
Warp size: 32
Maximum number of threads per multiprocessor: 2048
Maximum number of threads per block: 1024
Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
Max dimension size of a grid size (x,y,z): (2147483647, 65535, 65535)
Maximum memory pitch: 2147483647 bytes
Texture alignment: 512 bytes
Concurrent copy and kernel execution: Yes with 1 copy engine(s)
Run time limit on kernels: Yes
Integrated GPU sharing Host Memory: No
Support host page-locked memory mapping: Yes
Alignment requirement for Surfaces: Yes
Device has ECC support: Disabled
CUDA Device Driver Mode (TCC or WDDM): WDDM (Windows Display Driver Model)
Device supports Unified Addressing (UVA): Yes
Device PCI Domain ID / Bus ID / location ID: 0 / 1 / 0
Compute Mode:
< Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >

deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 8.0, CUDA Runtime Version = 8.0, NumDevs = 1, Device0 = GeForce GTX 650
Result = PASS

I also here that “Fermi family GPUs, and older families, are no longer supported with Nsight™ Visual Studio Edition 5.2 or better”. Does this affect my system? (I believe that my GTX 650 is a Kepler architecture card that is newer than Fermi)

System Details

  • Windows 10 Pro
  • Cuda compilation tools, release 8.0, V8.0.44
  • MS Visual Studio Enterprise 2015 / Version 14.0.25431.01 Update 3
  • Microsoft Visual Studio Enterprise 2015 / Version 14.0.25431.01 Update 3 / Microsoft .NET Framework / Version 4.6.01586
  • NVIDIA CUDA 8.0 Wizards 8.0
  • Wizards to create new NVIDIA CUDA projects and source files.
  • NVIDIA Nsight Visual Studio Edition
  • Solution here