VS 2019 and CUDA 10.1 fatal error MSV3721

While updateing VS2017 to VS2019 and Cuda 10.0 to Cuda 10.1 I ran into this error (35 times): MSV3721

8> C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\BuildCustomizations\CUDA 10.1.targets(757,9): error MSB3721: The command ““C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc.exe” -gencode=arch=compute_35,code="sm_35,compute_35" --use-local-env -ccbin “C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.20.27508\bin\HostX86\x64” -x cu -I…\inc -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include” -I…/…/…/…/…/…/SomePath -I…/…/…/…/…/…/SomeOtherPath (many times) -IInc -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" -I…\inc -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" --keep-dir …/…/…/…/…/…/Output\Release\x64\Objects\PCVLib -maxrregcount=0 --machine 64 --compile -cudart static /FS -DWIN32 -DNDEBUG -D_LIB -DNOMINMAX -DVRLIB_USES_LIBTIFF -DVRLIB_USES_LIBJPEG -DVRLIB_USES_WDP -DVT_IMG_COPY_ASSIGNABLE -DNDEBUG -DWIN64 -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -DUNICODE -Xcompiler “/EHsc /W3 /nologo /O2 /Fd…/…/…/…/…/…/Output\Release\x64\Symbols\SomeProject.pdb /Zi /MD " -o …/…/…/…/…/…/Output\Release\x64\Objects\SomeProejct\obj\some_file.cu.obj “D:\Path\SomeProject\src\someProject\algorithms\some_file.cu”” exited with code 1.

and because i already read the important stuff is above the error message, here is it:

8> D:\Path\SomeProject\build>“C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc.exe” -gencode=arch=compute_35,code="sm_35,compute_35" --use-local-env -ccbin “C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.20.27508\bin\HostX86\x64” -x cu -I…\inc -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include"-I…/…/…/…/…/…/SomePath -I…/…/…/…/…/…/SomeOtherPath (many times) -IInc -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" -I…\inc -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" --keep-dir …/…/…/…/…/…/Output\Release\x64\Objects\SomeProject -maxrregcount=0 --machine 64 --compile -cudart static /FS -DWIN32 -DNDEBUG -D_LIB -DNOMINMAX -DVRLIB_USES_LIBTIFF -DVRLIB_USES_LIBJPEG -DVRLIB_USES_WDP -DVT_IMG_COPY_ASSIGNABLE -DNDEBUG -DWIN64 -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -DUNICODE -Xcompiler "/EHsc /W3 /nologo /O2 /Fd…/…/…/…/…/…/Output\Release\x64\Symbols\SomeProject.pdb /Zi /MD " -o …/…/…/…/…/…/Output\Release\x64\Objects\SomeProject\obj\some_file.cu.obj “D:\Path\SomeProject\src\someProject\algorithms\some_file.cu”

8> nvcc fatal : A single input file is required for a non-link phase when an outputfile is specified

Other information:
It worked fine with VS2019 before i upgraded the toolset to vc142 and cuda to 10.0.

Any thoughts on how to fix this? :)

Thanks,
Michael

Did you add /FS to your project configuration somewhere along the way?

Yes i added it to the failing project because i got some error like: more then one task is writing to the .pdb file at the same time.

Before adding /FS i had both issues.

/FS wasn’t necessary before the vc142 and Cuda 10.1 update

1 Like

well you did it wrong.

I can’t tell you exactly how you did it wrong because I don’t have your project to inspect. But /FS is not a switch that is recognized by nvcc, therefore it is treating it as a file specification, here:

… --compile -cudart static /FS -DWIN32 …

which is not correct. As a result, nvcc thinks you are passing more than one input file and it says:

A single input file is required for a non-link phase when an outputfile is specified

/FS is a switch that is only recognized by the host compiler (i.e. cl.exe from VS) and so it needs to be prefaced by the -Xcompiler switch the same way other / switches are prefaced here:

… -Xcompiler "/EHsc /W3 /nologo /O2 /Fd…/…/…/…/…/…/Output\Release\x64\Symbols\SomeProject.pdb /Zi /MD " …

I’ve had set it at: Project Properties → CUDA C/C++ → Command Line → Additional Options.

One last Question: Where is the right place to set it? :)

Thanks,
Michael

I finally found the issue. “/FS” was set in the project before upgrading it to toolset v142. Now after adding 2019 in the CUDA 10.1.props sheet to:

    <CudaClVersion Condition="'$(PlatformToolset)' == 'v100'">2010</CudaClVersion>
    <CudaClVersion Condition="'$(PlatformToolset)' == 'Windows7.1SDK'">2010</CudaClVersion>
    <CudaClVersion Condition="'$(PlatformToolset)' == 'v110'">2012</CudaClVersion>
    <CudaClVersion Condition="'$(PlatformToolset)' == 'v120'">2013</CudaClVersion>
    <CudaClVersion Condition="'$(PlatformToolset)' == 'v140'">2015</CudaClVersion>
    <CudaClVersion Condition="'$(PlatformToolset)' == 'v141'">2017</CudaClVersion>
    
    <CudaClVersion Condition="'$(CudaClVersion)' == ''">2010</CudaClVersion>

“/FS” is set in the right place: -Xcompiler "/EHsc /nologo /FS /Zi "

Is this line missing or is this desired behavior?

Thanks,
Michael

It’s already fixed in CUDA 10.1.168

Michael