error MSB3721: exited with code 2

Hi,

I know this error might look kind of old, but I couldn’t solve it :(
I’m working on an opensource c++ project that I’m suppose to add a cuda module to that.
Which I’m getting the bellow error:
Error 2 error MSB3721: The command ““C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.2\bin\nvcc.exe” -gencode=arch=compute_20,code=“sm_20,compute_20” --use-local-env --cl-version 2010 -ccbin “C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin” -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.2\include” --keep-dir “RelWithDebInfo” -maxrregcount=0 --machine 32 --compile -Xcompiler “/EHsc /nologo /Od /Zi /MD " -o “DiffusionSolver_GPUShared.dir\RelWithDebInfo\DiffusionSolver_GPU_Kernels.cu.obj” “D:\CompuCell3D_V080414\CompuCell3D\core\CompuCell3D\steppables\DiffusionSolver_GPU\DiffusionSolver_GPU_Kernels.cu”” exited with code 2. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\CUDA 4.2.targets 361 10 DiffusionSolver_GPUShared

I know it’s most likely because of the environment setting, but I couldn’t find the problem. I would appreciate any help.

Thank you in advance

It’s helpful to see the actual error that was generated by nvcc. This should be right before the output you have posted. If it isn’t, modify your Visual Studio settings to get more verbose output, so that you can see the actual error generated by nvcc.

is this what you are asking about

D:\CC3D_Test_Version_Build_GPU_V080414\core\CompuCell3D\steppables\DiffusionSolver_GPU>“C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.5\bin\nvcc.exe” -ccbin “C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin” -ID:/CompuCell3D_V080414/CompuCell3D -ID:/CompuCell3D_V080414/CompuCell3D/core -ID:/CompuCell3D_V080414/CompuCell3D/core/CompuCell3D/steppables/DiffusionSolver_GPU -ID:/CompuCell3D_V080414/CompuCell3D/core/CompuCell3D/steppables/DiffusionSolver_GPU/CUDA -ID:/CompuCell3D_V080414/CompuCell3D/core/CompuCell3D/steppables -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.5\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.5\include" -maxrregcount=0 --machine 32 --compile -DWIN32 -D_WINDOWS -DNDEBUG -DPDESOLVERSGPU_EXPORT_COMPILER_DEFINITION -D"CMAKE_INTDIR=“RelWithDebInfo”" -DDiffusionSolver_GPUShared_EXPORTS -D_WINDLL -D_MBCS -Xcompiler “/EHsc /W3 /nologo /O2 /Zi /MD /GR " -o DiffusionSolver_GPUShared.dir\RelWithDebInfo\DiffusionSolver_GPU_Kernels.cu.obj “D:\CompuCell3D_V080414\CompuCell3D\core\CompuCell3D\steppables\DiffusionSolver_GPU\DiffusionSolver_GPU_Kernels.cu” -clean
13> Building Custom Rule D:/CompuCell3D_V080414/CompuCell3D/core/CompuCell3D/steppables/DiffusionSolver_GPU/CMakeLists.txt
13> CMake does not need to re-run because D:\CC3D_Test_Version_Build_GPU_V080414\core\CompuCell3D\steppables\DiffusionSolver_GPU\CMakeFiles\generate.stamp is up-to-date.
13> Compiling CUDA source file …\CompuCell3D_V080414\CompuCell3D\core\CompuCell3D\steppables\DiffusionSolver_GPU\DiffusionSolver_GPU_Kernels.cu…
13>
13> D:\CC3D_Test_Version_Build_GPU_V080414\core\CompuCell3D\steppables\DiffusionSolver_GPU>“C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.5\bin\nvcc.exe” -gencode=arch=compute_10,code=“sm_10,compute_10” --use-local-env --cl-version 2010 -ccbin “C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin” -ID:/CompuCell3D_V080414/CompuCell3D -ID:/CompuCell3D_V080414/CompuCell3D/core -ID:/CompuCell3D_V080414/CompuCell3D/core/CompuCell3D/steppables/DiffusionSolver_GPU -ID:/CompuCell3D_V080414/CompuCell3D/core/CompuCell3D/steppables/DiffusionSolver_GPU/CUDA -ID:/CompuCell3D_V080414/CompuCell3D/core/CompuCell3D/steppables -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.5\include” -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.5\include" -maxrregcount=0 --machine 32 --compile -cudart static -DWIN32 -D_WINDOWS -DNDEBUG -DPDESOLVERSGPU_EXPORT_COMPILER_DEFINITION -D"CMAKE_INTDIR=“RelWithDebInfo”" -DDiffusionSolver_GPUShared_EXPORTS -D_WINDLL -D_MBCS -Xcompiler "/EHsc /W3 /nologo /O2 /Zi /MD /GR " -o DiffusionSolver_GPUShared.dir\RelWithDebInfo\DiffusionSolver_GPU_Kernels.cu.obj “D:\CompuCell3D_V080414\CompuCell3D\core\CompuCell3D\steppables\DiffusionSolver_GPU\DiffusionSolver_GPU_Kernels.cu”

Yes, that is the command in question. However the output from that command is missing. If there is nothing between that and the other output you posted, then you need to change the verbosity settings on your Visual Studio

First of all, thanks for your time.

I’ve added /VERBOSE to get that, should I add any other option?

No, that’s not what I’m referring to. The specific steps will vary depending on your VS version, but here are some sample steps for VS2010:

1.In Tools…Settings select “Expert Settings”
2.In Tools…Options…Projects and Solutions…Build and Run change the “MSBuild project build output verbosity” setting from “Minimal” to “Normal” (or perhaps a higher verbosity setting)
3.Then select Build…Rebuild Solution, and you should see the verbose output in the build output window.

Hello,
I am very new with CUDA and I am having the same error, but I cannot find a real solution online.
I am using CUDA 4.2 on VisualStudio 2010 on a shared machine. For my colleague the c++ code worked in the past, for me it doesn’t. Here is the output log I obtain :

1>------ Build started: Project: PinHoleSimple, Configuration: Debug x64 ------
1>Build started 12/15/2014 2:35:51 PM.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(299,5): warning MSB8004: Output Directory does not end with a trailing slash. This build instance will add the slash as it is required to allow proper evaluation of the Output Directory.
1>InitializeBuildStatus:
1> Touching “x64\Debug\PinHoleSimple.unsuccessfulbuild”.
1>AddCudaCompileDeps:
1>Skipping target “AddCudaCompileDeps” because all output files are up-to-date with respect to the input files.
1>AddCudaCompilePropsDeps:
1>Skipping target “AddCudaCompilePropsDeps” because all output files are up-to-date with respect to the input files.
1>CudaBuild:
1> Compiling CUDA source file …\src\projection_simple.cu…
1>
1> C:\Users\Tiziana\Documents\Image Reconstruction\PinholeSPECTGPU\PinHoleSimple\PinHoleSimple>“C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.2\bin\nvcc.exe” -gencode=arch=compute_20,code=“sm_20,compute_20” --use-local-env --cl-version 2010 -ccbin “C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64” -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.2\include" -G -maxrregcount=0 --machine 64 --compile -I. -g -Xcompiler "/EHsc /nologo /Od /Zi /MDd " -o “x64\Debug\projection_simple.cu.obj” “C:\Users\Tiziana\Documents\Image Reconstruction\PinholeSPECTGPU\src\projection_simple.cu”
1> projection_simple.cu
1>C:/Users/Tiziana/Documents/Image Reconstruction/PinholeSPECTGPU/src/projection_simple.cu(71): error : no instance of constructor “XSPECT::XSPECT [with T=float]” matches the argument list
1> argument types are: (int, const char [17], int, int3vector, float, int3vector, float, int, const float, Isotope::tracer)
1>
1>C:/Users/Tiziana/Documents/Image Reconstruction/PinholeSPECTGPU/src/projection_simple.cu(33): warning : variable “dt” was declared but never referenced
1>
1>C:/Users/Tiziana/Documents/Image Reconstruction/PinholeSPECTGPU/src/projection_simple.cu(33): warning : variable “min” was declared but never referenced
1>
1>C:/Users/Tiziana/Documents/Image Reconstruction/PinholeSPECTGPU/src/projection_simple.cu(33): warning : variable “sec” was declared but never referenced
1>
1>C:/Users/Tiziana/Documents/Image Reconstruction/PinholeSPECTGPU/src/projection_simple.cu(55): warning : variable “Nproj” was declared but never referenced
1>
1> 1 error detected in the compilation of “C:/Users/Tiziana/AppData/Local/Temp/tmpxft_0000985c_00000000-3_projection_simple.cpp1.ii”.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\CUDA 4.2.targets(361,9): error MSB3721: The command ““C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.2\bin\nvcc.exe” -gencode=arch=compute_20,code=“sm_20,compute_20” --use-local-env --cl-version 2010 -ccbin “C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64” -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.2\include” -G -maxrregcount=0 --machine 64 --compile -I. -g -Xcompiler “/EHsc /nologo /Od /Zi /MDd " -o “x64\Debug\projection_simple.cu.obj” “C:\Users\Tiziana\Documents\Image Reconstruction\PinholeSPECTGPU\src\projection_simple.cu”” exited with code 2.
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:02.94
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Please give me hint, I am super new with CUDA and struggling even with the basis.

The problem is here, at line 71 in projection_simple.cu:

1>C:/Users/Tiziana/Documents/Image Reconstruction/PinholeSPECTGPU/src/projection_simple.cu(71): error : no instance of constructor “XSPECT::XSPECT [with T=float]” matches the argument list
1> argument types are: (int, const char [17], int, int3vector, float, int3vector, float, int, const float, Isotope::tracer)

I doubt anyone could help you further without seeing projection_simple.cu, as well as any necessary files to see the definition of the XSPECT templated class, and it’s constructor.

You’re not likely to find a solution to this online. It is unique/specific to your code, and has to do with C++ usage, not CUDA, I don’t think.

Severity Code Description Project File Line Suppression State
Error MSB3721 The command ““C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1\bin\nvcc.exe” -ccbin “C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\HostX86\x86” -x cu -IC:\cuda\include -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1\include” -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1\include" -G --keep-dir Debug -maxrregcount=0 --machine 32 --compile -g -D_MBCS -Xcompiler “/EHsc /W3 /nologo /Od /FS /Zi /RTC1 /MDd " -o Debug\activation_kernels.cu.obj “C:\darknet\src\activation_kernels.cu” -clean” exited with code 1. darknet C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\BuildCustomizations\CUDA 9.1.targets 883

PLEASE HELP