nvcc error in 2.2.0 build - Visual Studio/MSVC

90 views
Skip to first unread message

Robin Rofallski

unread,
Apr 21, 2023, 5:12:29 AM4/21/23
to Ceres Solver
Hi everyone,
I've tried building ceres version 2.2.0 in MSVC with CUDA support. When trying to build ceres_cuda_kernels, the following error comes up and I can't seem to resolve it.

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

The error statement from Visual Studio, including the call to nvcc is as follows:
MSB3721 The call to ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\bin\nvcc.exe" -gencode=arch=compute_52,code=\"sm_52,compute_52\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64" -x cu    -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\include"     --keep-dir x64\Release  -maxrregcount=0  --machine 64 --compile -cudart static /wd4018 /wd4267 /wd4099 /wd4996 /wd4800 /wd4244 /wd4251 /bigobj -std=c++17 -Xcompiler="/EHsc -Ob2"   -D_WINDOWS -DNDEBUG -D_USE_MATH_DEFINES -D_VARIADIC_MAX=10 -DNOMINMAX -D"CERES_SUITESPARSE_VERSION=\"5.8.0\"" -D"CERES_METIS_VERSION=\"5.1.0\"" -D"CMAKE_INTDIR=\"Release\"" -Dceres_cuda_kernels_EXPORTS -D_WINDLL -D_MBCS -D"CMAKE_INTDIR=\"Release\"" -Dceres_cuda_kernels_EXPORTS -Xcompiler "/EHsc /W3 /nologo /O2 /Fdceres_cuda_kernels.dir\Release\vc142.pdb /FS   /MD /GR" -o ceres_cuda_kernels.dir\Release\cuda_kernels.cu.obj "D:\Libs\ceres-solver\internal\ceres\cuda_kernels.cu.cc"" finished with code 1.

In the Nvidia forum, the error is pointed towards a blank space in an output file which would cause nvcc to interpret it as separate files. However, I don't see that issue applying here and would like to ask if anyone has similar experience under Visual Studio?

Any help is highly appreciated
Robin
Message has been deleted

Jason

unread,
May 15, 2023, 9:23:53 PM5/15/23
to Ceres Solver
It looks like the CMakeLists.txt files weren't updated when CUDA support was added. For this particular error, the issue seems to be that nvcc can't handle these flags "/wd4018 /wd4267 /wd4099 /wd4996 /wd4800 /wd4244 /wd4251 /bigobj". I have attached two updated CMakeLists.txt files: the first should replace the one in the top-level ceres-solver directory, and the second should replace the one in internal/ceres. With these files, you should be able to build Ceres with CUDA in Visual Studio.
CMakeLists.txt
CMakeLists.txt

Sameer Agarwal

unread,
May 16, 2023, 10:19:13 AM5/16/23
to ceres-...@googlegroups.com
Jason, would you consider sending me a patch on gerrit ?
Sameer


--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/a9d5015e-1758-454b-910d-a2992282af6an%40googlegroups.com.

Jason

unread,
May 17, 2023, 4:29:21 AM5/17/23
to Ceres Solver
Sure, I can do that, though I'm not a CMake expert. Those changes allowed me to build with the latest version of Visual Studio.

Sameer Agarwal

unread,
May 17, 2023, 8:16:46 AM5/17/23
to ceres-...@googlegroups.com
Ty, Alex or Sergiu know cmake well. They will review.

Reply all
Reply to author
Forward
0 new messages