Hi all. This is my third day struggling with compiling a simple HelloCuda CUDA project in visual studio 2019 (Enterprise). I installed the latest Nvidia CUDA 10.1 Toolkit without errors. Please see the ‘Error List’. I cannot work out what this error means except that it appears the target (versions) between MSVC & CUDA Toolkit 10.1 might be mismatching and I really do not know what how to resolve that. These are the only errors I get.
Try copy/pasting the nvcc.exe command-line to a command prompt in your project directory, run it, and see if there is a more detailed warning/error message from nvcc.
Hmm is there a cl.exe under C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.22.27905\bin\HostX86\x64 on your machine?
Another thing to check is run the command-line again while running Process Monitor (Process Monitor - Windows Sysinternals | Microsoft Docs). Filter for only file activity, for when nvcc.exe is the process, and the path contains cl.exe, and see where all it’s looking for cl.exe.
One more option to help diagnose it, run msbuild /v:diag [project].vcxproj in the command-line, redirect the output to a file (it will be very verbose), and see how the build is configuring the path in the log file.
Yes, cl.exe is in the C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.22.27905\bin[b]HostX86[/b]\x64 folder.
I had added the link C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.22.27905\bin[b]Hostx64[/b]\x64, which differs to your link by the bolded ‘HostX86 vs Hostx64’ and I got the following error ‘Compiler ‘cl.exe’ in PATH different than the one specified with -ccbin’.
I’m now going to try your version and also your other suggestions and let you know of my progress. Thank you for your support once again - its greatly appreciated.
Getting there. After adding your version of the MSVC, the 'Compiler ‘cl.exe’ in PATH different than the one specified with -ccbin’error is now gone, but still having compiler problems. I have attached the /v:diag txt file for your analysis. HelloCuda.zip (29.4 KB)
Elton, thought this might help. Ran /v:diag in command prompt without directing to file so I can get the benefits of error highlighting. The Only error I see is this:
C:\Program Files (x86)\Microsoft Visual Studio019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(376
,5): error MSB8013: This project doesn't contain the Configuration and Platform combination of Debug|Win32. [C:\Working
\NVIDIA\HelloCuda\HelloCuda.vcxproj]
I hope this helps. I had figured out from the error message that there was a conflict with the build targets, but my skills are limited, so was stuck. I have alredy learnt a few great skills from you, thanks.
Looking at your build log file, it looks like the path has both HostX86\x86 and HostX86\x64 paths, this looks suspicious to me. Hopefully explicitly specifying x64 platform resolves that. What platform were you trying to build within VS?
I misunderstood your previous instruction of specifying a platform, now ran this: msbuild /v:diag HelloCuda.vcxproj /p:Configuration=Debug /p:Platform=x64
Results are attached. The error is what I get in VS Output.
I created the trivial example (HelloCuda) project using the CUDA Template. The project does not have an option to select Platform x86, I know I can add it manually, but my understading is that CUDA Toolkit 10.1 is only for x64 or did I misunderstand?
You should only be building for x64. I realized that the error produced by nvcc.exe on the command-line may not be the same as from msbuild or VS because the build system sets the path. When you tested the nvcc.exe command-line before, did you do it from a VS developer command-prompt so there would be a cl.exe in the path?
Another thing to try, run the MSBuild command line with this and see if we get any more info:
It might be me but there seems a bit of confusion. Steps are broadly;
Step 1: Download and install the recommended NVIDIA Display Driver
Is this the latest driver for the Display Card or a specific driver that macthes the CUDA Toolkit?
There are drivers in CUDA Toolkit, what does this mean, after this step has been done already?
I currently have Nvidia Geforce GTX 1050 ti 431.86, HDC, Studio Driver. Is this correct?
Step 2: Download and install the CUDA Toolkit 10.1 Update 2
This toolkit, as I mentioned above, has Drivers in it!
It also contains Nsight Visual Studio Edition, which is supposed to be installed in Step 3!
Step 3: Download and install Nsight Visual Studio Edition installer
Is this necessary if CUDA Toolkit already contains the installer?
Please help me clarify the installation steps. I searched around online for the past few days in my numerous attempts and cannot really say which is the proper progression. I think this might be the cause of my problems.
Great joy! After working all night on re-installing my system and the NVIDIA CUDA package, my project now works.
My steps, which are different from my previous attempts are:
Step 1: Update NVIDIA Graphics Card to the latest update.
Step 2: Install CUDA Toolkit 10.1 using Custom Installation - then unticking the Driver Options
Step 3: Install Nsight visual studio 2019.3 which replaces the outdated Nsight visual studio it installed in Step 2
Step 4: Add the folder to MSCV to the PATH in environment variables
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.22.27905\bin\Hostx64\x64
I can now compile from within Visual Studio and through the command line as you instructed.
Thank you a million for your support. This had to work because its part of a project I have been working on for 4 years.