CUDA 10.1 samples not working on VS2017

I am using Windows 10 Enterprise.
I install Visual Studio 2017 15.9.8.
I install cuda_10.1.105_418.96_win10.exe
I start “C:\ProgramData\NVIDIA Corporation\CUDA Samples\v10.1\Samples_vs2017.sln”
I build and run vectorAddDrv. I got the following:
Vector Addition (Driver API)
checkCudaErrors() Driver API error = 0999 “CUDA_ERROR_UNKNOWN” from file <c:\programdata\nvidia corporation\cuda samples\v10.1\0_simple\vectoradddrv\vectoradddrv.cpp>, line 69.

C:\ProgramData\NVIDIA Corporation\CUDA Samples\v10.1\0_Simple\vectorAddDrv…/…/bin/win64/Debug/vectorAddDrv.exe (process 20912) exited with code 1.
To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
Press any key to close this window . . .

I get similar error with all samples I have tried.
Please advise.

Thanks,
Aik-Siong Koh

either you don’t have a GPU, your GPU is too old, or your CUDA install is broken.

Thanks for helping.

I have a powerful, one year old desktop
Name NVIDIA Quadro P4000
PNP Device ID PCI\VEN_10DE&DEV_1BB1&SUBSYS_11A3103C&REV_A1\4&FC7F53B&0&0018
Adapter Type Quadro P4000, NVIDIA compatible
Adapter Description NVIDIA Quadro P4000
Adapter RAM (1,048,576) bytes
Installed Drivers C:\WINDOWS\System32\DriverStore\FileRepository\nv_dispui.inf_amd64_61dc4507bfd55d28\nvldumdx.dll,C:\WINDOWS\System32\DriverStore\FileRepository\nv_dispui.inf_amd64_61dc4507bfd55d28\nvldumdx.dll,C:\WINDOWS\System32\DriverStore\FileRepository\nv_dispui.inf_amd64_61dc4507bfd55d28\nvldumdx.dll,C:\WINDOWS\System32\DriverStore\FileRepository\nv_dispui.inf_amd64_61dc4507bfd55d28\nvldumdx.dll
Driver Version 25.21.14.1896
INF File oem259.inf (Section112 section)
Color Planes Not Available
Color Table Entries Not Available
Resolution Not Available
Bits/Pixel Not Available
Memory Address 0xF2000000-0xF30FFFFF
Memory Address 0xE0000000-0xF1FFFFFF
Memory Address 0xF0000000-0xF1FFFFFF
I/O Port 0x00002000-0x00002FFF
Driver c:\windows\system32\driverstore\filerepository\nv_dispui.inf_amd64_61dc4507bfd55d28\nvlddmkm.sys (25.21.14.1896, 19.74 MB (20,703,272 bytes), 2019-03-11 2:12 PM)

All the installs of VS2017 and CUDA described previously were done fresh without errors.
I also have Intel compiler installed. That shouldn’t affect CUDA, right?

Build was without errors.
1>------ Rebuild All started: Project: vectorAddDrv, Configuration: Debug x64 ------
1>
1>C:\ProgramData\NVIDIA Corporation\CUDA Samples\v10.1\0_Simple\vectorAddDrv>“C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc.exe” -ccbin “C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64” -x cu -I./ -I…/…/common/inc -I./ -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1/include" -I…/…/common/inc -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" -G --keep-dir x64\Debug -maxrregcount=0 --machine 64 -ptx -Xcompiler “/wd 4819” -o data/vectorAdd_kernel64.ptx “C:\ProgramData\NVIDIA Corporation\CUDA Samples\v10.1\0_Simple\vectorAddDrv\vectorAdd_kernel.cu” -clean
1>vectorAdd_kernel.cu
1>Compiling CUDA source file vectorAdd_kernel.cu…
1>
1>C:\ProgramData\NVIDIA Corporation\CUDA Samples\v10.1\0_Simple\vectorAddDrv>“C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc.exe” -gencode=arch=compute_30,code=“compute_30,compute_30” --use-local-env -ccbin “C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64” -x cu -I./ -I…/…/common/inc -I./ -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1/include" -I…/…/common/inc -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" -G --keep-dir x64\Debug -maxrregcount=0 --machine 64 -ptx -cudart static -Xcompiler “/wd 4819” -o data/vectorAdd_kernel64.ptx “C:\ProgramData\NVIDIA Corporation\CUDA Samples\v10.1\0_Simple\vectorAddDrv\vectorAdd_kernel.cu”
1>vectorAdd_kernel.cu
1>vectorAddDrv.cpp
1>LINK : …/…/bin/win64/Debug//vectorAddDrv.exe not found or not built by the last incremental link; performing full link
1>vectorAddDrv_vs2017.vcxproj -> C:\ProgramData\NVIDIA Corporation\CUDA Samples\v10.1\0_Simple\vectorAddDrv…/…/bin/win64/Debug/vectorAddDrv.exe
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

But CUDA exits at the first cuFunction
checkCudaErrors(cuInit(0));

The thread 0x5e84 has exited with code 0 (0x0).
‘vectorAddDrv.exe’ (Win32): Unloaded ‘C:\Windows\System32\dwmapi.dll’
‘vectorAddDrv.exe’ (Win32): Unloaded ‘C:\Windows\System32\ole32.dll’
‘vectorAddDrv.exe’ (Win32): Unloaded ‘C:\Windows\System32\dxgi.dll’
‘vectorAddDrv.exe’ (Win32): Unloaded ‘C:\Windows\System32\nvapi64.dll’
The thread 0x5d34 has exited with code 1 (0x1).
The thread 0x4ca0 has exited with code 1 (0x1).
The thread 0x5d2c has exited with code 1 (0x1).
The program ‘[22868] vectorAddDrv.exe’ has exited with code 1 (0x1).

Please advise.
Aik-Siong Koh

I’m not able to diagnose the problem. vectorAddDrv should only depend on having a properly installed driver.

Have you rebooted the system at all since installing the 418.96 driver?

As a diagnostic, you could also try running the vectoAddDrv as administrator.

I rebooted. Same result.
I cannot run VS2017 under administrator.
I uninstalled all components of CUDA 10.1.
Reinstalled cuda_9.2.88_win10.exe
I can run vectorAddDrv again.
So, something is wrong with cuda_10.1.105_418.96_win10.exe on my machine.

Same for me here. Any call to cudaGetDeviceProperties (at least when run under debugger) fails with error 999. It somehow succeeds sometimes when not running with a debugger.

I have VS2017 with CUDA v10.1 installed and I am using the 419.67 drivers and all my projects and the samples compile and run correctly. Maybe you should try those drivers.

The only thing I see a little odd with the build commands is it uses only computation level 3.0. Is that what the P4000 requires? Try changing it 5.2 or higher and see if you get different results if you can.