zju3dv / DetectorFreeSfM

Code for "Detector-Free Structure from Motion", CVPR 2024
Apache License 2.0
602 stars 35 forks source link

Installation issue #59

Open hardikdava opened 3 months ago

hardikdava commented 3 months ago

Hello great work. Thank you for the wonderful idea and trying to solve core issue of sfm. I am trying to install modified version of colmap as per install.md guide but hitting a wall with the installation in docker.

1226.7 /usr/local/cuda/include/cuda_runtime.h:1726:55:   required from 'cudaError_t cudaBindTextureToArray(const texture<T, dim, readMode>&, cudaArray_const_t) [with T = float; int dim = 242; cudaTextureReadMode readMode = cudaReadModeElementType; cudaError_t = cudaError; cudaArray_const_t = const cudaArray*]'
1226.7 /colmap/src/mvs/patch_match_cuda.cu:1518:36:   required from here
1226.7 /usr/local/cuda/include/cuda_runtime.h:1685:32: warning: 'cudaError_t cudaBindTextureToArray(const textureReference*, cudaArray_const_t, const cudaChannelFormatDesc*)' is deprecated [-Wdeprecated-declarations]
1226.7  1685 |   return ::cudaBindTextureToArray(&tex, array, &desc);
1226.7       |        ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
1226.7 /usr/local/cuda/include/cuda_runtime_api.h:8898:46: note: declared here
1226.7  8898 | extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaBindTextureToArray(const struct textureReference *texref, cudaArray_const_t array, const struct cudaChannelFormatDesc *desc);
1226.7       |                                              ^~~~~~~~~~~~~~~~~~~~~~
1226.7 /usr/local/cuda/include/cuda_runtime.h: In instantiation of 'cudaError_t cudaBindTextureToArray(const texture<T, dim, readMode>&, cudaArray_const_t, const cudaChannelFormatDesc&) [with T = float; int dim = 2; cudaTextureReadMode readMode = cudaReadModeElementType; cudaError_t = cudaError; cudaArray_const_t = const cudaArray*]':
1226.7 /usr/local/cuda/include/cuda_runtime.h:1726:55:   required from 'cudaError_t cudaBindTextureToArray(const texture<T, dim, readMode>&, cudaArray_const_t) [with T = float; int dim = 2; cudaTextureReadMode readMode = cudaReadModeElementType; cudaError_t = cudaError; cudaArray_const_t = const cudaArray*]'
1226.7 /colmap/src/mvs/patch_match_cuda.cu:1629:36:   required from here
1226.7 /usr/local/cuda/include/cuda_runtime.h:1685:32: warning: 'cudaError_t cudaBindTextureToArray(const textureReference*, cudaArray_const_t, const cudaChannelFormatDesc*)' is deprecated [-Wdeprecated-declarations]
1226.7  1685 |   return ::cudaBindTextureToArray(&tex, array, &desc);
1226.7       |        ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
1226.7 /usr/local/cuda/include/cuda_runtime_api.h:8898:46: note: declared here
1226.7  8898 | extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaBindTextureToArray(const struct textureReference *texref, cudaArray_const_t array, const struct cudaChannelFormatDesc *desc);
1226.7       |                                              ^~~~~~~~~~~~~~~~~~~~~~
1227.1 CMake Error at colmap_cuda_generated_patch_match_cuda.cu.o.Release.cmake:280 (message):
1227.1   Error generating file
1227.1   /colmap/build/src/CMakeFiles/colmap_cuda.dir/mvs/./colmap_cuda_generated_patch_match_cuda.cu.o
1227.1 
1227.1 
1227.1 make[2]: *** [src/CMakeFiles/colmap_cuda.dir/build.make:91: src/CMakeFiles/colmap_cuda.dir/mvs/colmap_cuda_generated_patch_match_cuda.cu.o] Error 1
1227.1 make[1]: *** [CMakeFiles/Makefile2:723: src/CMakeFiles/colmap_cuda.dir/all] Error 2
1227.1 make: *** [Makefile:136: all] Error 2
BedirYilmaz commented 3 months ago

Hi, can you post the full error stack?

The error suggests that your version of cuda is using some deprecated elements, are you using an older version of cuda? Can you post your dockerfile as well?

BedirYilmaz commented 3 months ago

Yes, it is possible to disable dense reconstruction when building COLMAP. This can be done by modifying the CMake configuration. You can add the following flag when running CMake:

-DCMAKE_BUILD_TYPE=Release -DCUDA_ENABLED=OFF

This will disable CUDA and, consequently, the dense reconstruction module which relies heavily on CUDA. If you want to keep CUDA enabled but just disable the MVS (Multi-View Stereo) (see colmap's cmake for more info) module, you can use:

-DCMAKE_BUILD_TYPE=Release -DMVS_ENABLED=OFF

Remember to clean your build directory before reconfiguring with CMake.

hardikdava commented 2 months ago

@hxy-123 can you help me out here? Thanks in advance.

hxy-123 commented 2 months ago

Hi, could you please specify the CUDA version of your device? This error seems to show that the current CUDA version doesn't support some functions required by COLMAP.

hardikdava commented 2 months ago

@hxy-123 Thanks for the reply.

I am using ubuntu-22.04 docker with cuda-11.8. Fyi: I am able to install normal version colmap without any issue.

hxy-123 commented 2 months ago

The newest COLMAP version has removed some CUDA dependencies to support new CUDA versions (>= 11.8). Therefore, we also updated the COLMAP in our modified version. You can try to install the modified COLMAP in this branch. However, the results may be a little different compared with the paper version since our experiments are conducted on the old COLMAP version.

hardikdava commented 2 months ago

@hxy-123 okay. I will try it out and let you know how it goes.

hardikdava commented 2 months ago

@hxy-123 What's the reason of using older version of ceres-solver? I think colmap uses newer version

hxy-123 commented 2 months ago

Our modified part is not relevant to the ceres lib. I think any newer version of ceres lib can be installed as long as it conforms COLMAP's requirements.

hardikdava commented 2 months ago

@hxy-123 Thanks for the clarification. I want to test this project to work with 3D gaussian splatting which requires sfm output. Is there anyway to disable dense reconstruction in building stage?

hxy-123 commented 2 months ago

Yes, it is possible to disable dense reconstruction when building COLMAP. This can be done by modifying the CMake configuration. You can add the following flag when running CMake:

-DCMAKE_BUILD_TYPE=Release -DCUDA_ENABLED=OFF

This will disable CUDA and, consequently, the dense reconstruction module which relies heavily on CUDA. If you want to keep CUDA enabled but just disable the MVS (Multi-View Stereo) (see colmap's cmake for more info) module, you can use:

-DCMAKE_BUILD_TYPE=Release -DMVS_ENABLED=OFF

Remember to clean your build directory before reconfiguring with CMake.

I think you can try out this reply. However, I haven't disabled compiling dense reconstruction parts previously.

hardikdava commented 2 months ago

@hxy-123 i tried with DFSfM_modify_support_cuda12 branch. I am getting error from building SiftGPU

7.860 [ 23%] Building C object lib/VLFeat/CMakeFiles/vlfeat.dir/mathop_sse2.c.o
14.20 [ 25%] Linking C static library liblsd.a
14.54 [ 25%] Built target lsd
17.76 [ 27%] Linking C static library libvlfeat.a
17.82 [ 27%] Built target vlfeat
18.58 make[1]: *** [CMakeFiles/Makefile2:508: lib/SiftGPU/CMakeFiles/sift_gpu.dir/all] Error 2
18.58 make[1]: *** Waiting for unfinished jobs....
135.1 [ 30%] Linking CXX static library libpoisson_recon.a
135.2 [ 30%] Built target poisson_recon
135.2 make: *** [Makefile:136: all] Error 2
hxy-123 commented 2 months ago

We have tested compiling this branch on the device with CUDA version > 11.8, which works quite well. Maybe you can try to pull this branch to a new repo and compile it again?