fixstars / cuda-bundle-adjustment

A CUDA implementation of Bundle Adjustment
Apache License 2.0
365 stars 46 forks source link

cuda_block_solver.cu(147): error: no instance of overloaded function "atomicAdd" matches the argument list argument types are: (cuba::Scalar *, cuba::Scalar) #16

Open nakole2 opened 1 year ago

nakole2 commented 1 year ago

I am trying to build this setup in external SSD where I have installed Ubuntu 22.04. I am getting this error while running make command. I have added the results of "cmake .." command followed by "make". Please help me to resolve this issue.

nisha@nisha-OMEN:~/cuda-bundle-adjustment/build$ cmake .. -- Automatic GPU detection failed. Building for common architectures. -- Autodetected CUDA architecture(s): 5.3;6.0;6.1;7.0;7.5;8.0;8.6;8.6+PTX -- CUDA_ARCH: "-gencode;arch=compute_53,code=sm_53;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_80,code=sm_80;-gencode;arch=compute_86,code=sm_86;-gencode;arch=compute_86,code=compute_86" -- Configuring done -- Generating done -- Build files have been written to: /home/nisha/cuda-bundle-adjustment/build

nisha@nisha-OMEN:~/cuda-bundle-adjustment/build$ make [ 14%] Building NVCC (Device) object src/CMakeFiles/cuda_bundle_adjustment.dir/cuda_bundle_adjustment_generated_cuda_block_solver.cu.o /usr/include/c++/11/bits/std_function.h:435:145: error: parameter packs not expanded with ‘...’: 435 | function(_Functor&& f) | ^ /usr/include/c++/11/bits/std_function.h:435:145: note: ‘_ArgTypes’ /usr/include/c++/11/bits/std_function.h:530:146: error: parameter packs not expanded with ‘...’: 530 | operator=(_Functor&& f) | ^ /usr/include/c++/11/bits/std_function.h:530:146: note: ‘_ArgTypes’ CMake Error at cuda_bundle_adjustment_generated_cuda_block_solver.cu.o.cmake:280 (message): Error generating file /home/nisha/cuda-bundle-adjustment/build/src/CMakeFiles/cuda_bundle_adjustment.dir//./cuda_bundle_adjustment_generated_cuda_block_solver.cu.o

make[2]: [src/CMakeFiles/cuda_bundle_adjustment.dir/build.make:955: src/CMakeFiles/cuda_bundle_adjustment.dir/cuda_bundle_adjustment_generated_cuda_block_solver.cu.o] Error 1 make[1]: [CMakeFiles/Makefile2:115: src/CMakeFiles/cuda_bundle_adjustment.dir/all] Error 2 make: *** [Makefile:136: all] Error 2

tzukpolinsky commented 1 year ago

i solved it by changing the CMakeLists.txt file in the src dir

set(CUBA_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include)
include_directories(${CUBA_INCLUDE_DIR})

# CUDA
find_package(CUDAToolkit REQUIRED)
include_directories(${CUDA_INCLUDE_DIRS})
set(CUDA_ARCH "${ARCH_FLAGS}" CACHE STRING "Value of the NVCC -arch option." FORCE)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} ${CUDA_ARCH} -lineinfo -gencode=arch=compute_61,code=sm_61")

basically i changed the architecture to sm_60 after reading: https://forums.developer.nvidia.com/t/why-does-atomicadd-not-work-with-doubles-as-input/56429

let me know if you have more troubles @atakagi-fixstars maybe it's something to consider adding to the CMakeLists.txt