First. Thanks for taking a look and showing a clear example. It differs from the instructions in the Getting Started web-page. In the end, I think you fixed the problem, but not without the notes below and I still think there is a configuration bug (mentioned in 4th bullet)


Compilation was not the trouble I was having. After running the executable multiple time (usually >= 3) the program would throw an exception.


The example above doesn’t complete config step of cmake, because CUDA is only compatible with 64 bit builds.


CUDA support not available with 32-bit windows.  Did you forget to set
  Win64 in the generator target?

I solved this by adding -G “Visual Studio 15 2017 Win64” option on the command line to cmake

The example above does not build for me because it is looking for CUDA 9.2 during the cmake --build . --config Release command

LINK : fatal error LNK1181: cannot open input file 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\lib\x64\cudart_static.lib' [C:\Users\Mik
e\Libs\torch\example-app\build\example-app.vcxproj]

I don’t know why it is doing this. I never  had CUDA 9.2 installed. My CUDA_PATH is set correctly, so cmake should find the correct CUDA. Also, CMakeCache.txt only mentions CUDA 10.0.


In the generated example-app.vcxproj, cudart_static.lib is listed twice for each build type (Release, Debug, …)  I deleted mention of non-existent cudart_static.lib and the build worked


On my 3rd execution of the program I got the same error pop up as before.



Then I noticed I didn’t copy the dlls over to my release directory. The program usually still ran, and I never get a message about not having them available.

Why does the program need the dlls? My program seems to only links .lib files. I initially skipped this step. THIS IS THE KEY STEP. now it runs every time.