Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dense reconstruction without CUDA #192

Closed
hy9be opened this issue Aug 4, 2017 · 11 comments
Closed

Dense reconstruction without CUDA #192

hy9be opened this issue Aug 4, 2017 · 11 comments

Comments

@hy9be
Copy link

hy9be commented Aug 4, 2017

Telling from the code: https://github.com/colmap/colmap/blob/master/src/controllers/automatic_reconstruction.cc#L237, it seems not possible to do dense reconstruction without CUDA. But my mac does not have a Nvidia graphic card. Any workaround?

@zhanlv600
Copy link

Hello, I also come across the problem like you. I compile the whole program successfully on my ubuntu (Parallel Desktop Virtue Machines without cuda), but I can just run sfm successfully and when I run mvs to get stereo maps, it will display cuda not found. I don't know where the problem is and I set the gpu index = -1 to only use cpu. But it doesnn't work.

@ahojnnes
Copy link
Contributor

ahojnnes commented Aug 4, 2017

Dense reconstruction is only implemented on the GPU using CUDA. A CPU implementation would be too slow. If you do not have access to a CUDA-enabled GPU, you could use CMVS/PMVS as described in the documentation here https://colmap.github.io/tutorial.html#dense-reconstruction

Let me know if you have other questions.

@ahojnnes ahojnnes closed this as completed Aug 4, 2017
@10110111
Copy link

A CPU implementation would be too slow.

But what about OpenCL? It's supported on much wider range of hardware, and seems a viable alternative to use on CUDA-less systems.

@wavexx
Copy link

wavexx commented Jul 30, 2018

I'll chime in on this, even though the report is closed. I'd also like an OpenCL and/or CPU version of patch_dense_stereo, even if the performance penalty would be big.

I only have a single rig with a CUDA system and it's remote (not really convenient to use, not with the GUI at least). All the laptops I have access to don't have it either as it's mostly intel HD graphics.

I'm now using colmap for sparse reconstruction, and OpenMVS for the rest. It's a bit slow, but it's actually not too bad for the datasets I've thrown it at so far.

@enzyme69
Copy link

enzyme69 commented Sep 4, 2018

@wavexx I am also a bit frustrated that my Mac cannot use its GPU for dense reconstruction... :( But curious about the OpenMVS, do you have article / vlog / tutorial to show how it is done?

So far, I collect only the sparse point cloud... they are ok, but I need to mesh them somewhat and would be nice to be able to process the dense data.

@ottokiksmaler
Copy link

ottokiksmaler commented Sep 8, 2018

Here you can find explanation on using OpenMVS (dense+mesh+texture) with COLMAP
https://pfalkingham.wordpress.com/2018/04/01/colmap-openmvs-scripts-updated/

@s-wtnb
Copy link

s-wtnb commented Sep 12, 2018

CPU implementation of the MVS part of COLMAP
https://github.com/mitjap/pwmvs

@ahojnnes
Copy link
Contributor

ahojnnes commented Sep 12, 2018 via email

@balaclava9
Copy link

I was able to get COLMAP and pmvs2 going on my c. 2018 Hackintosh with only the iGPU (no CUDA). I already had command line developer tools. Homebrew makes it possible for a non-programmer like me.

(1)
I followed the instructions for building COLMAP. I got a nice sparse reconstruction from my files.
https://colmap.github.io/install.html#id2
I had to link qt5 as suggested, and I had to fix the directory after -DQt5_DIR to point to my homebrew install.
for me I think it was /usr/local/Cellar/qt@5/5.15.10/lib/cmake/Qt5

(2)
but without CUDA I couldn't do the dense reconstruction. I followed the instructions to export to pmvs2
https://colmap.github.io/tutorial.html#dense-reconstruction

this wasn't easy to build from source, not knowing much at all, but homebrew really helped.
I started with the code in the tar file from 2011
https://www.di.ens.fr/cmvs/

I had to install tons of packages from homebrew.
I set the include folders in the cmvc make file to /usr/local/include and library to /usr/lib
I kept installing dependencies, whenever "make depend" would show a missing library
I would do a brew search and find the package needed.

I got stuck on jpeglib.h which eventually I got with a homebrew install of gtk+.

eventually I had to install clapack manually as it's not in homebrew
https://netlib.org/clapack/
and copy the .h files into usr/local/include and the .a file into /usr/lib.

and then a compiled pvms2! and it worked on my colmap output!

cmvs didn't compile because of an error (some unknown fopenmp compile flag), but I didn't need it as I was only working with 15 images.

@balaclava9
Copy link

one more thought. it looks like openMVS just added support for COLMAPs sparse output.
https://github.com/cdcseacave/openMVS/releases/tag/v2.2.0

I will try it out when I have time. right now pmvs2 is crunching away.

@metacollin
Copy link

metacollin commented Aug 17, 2023

This is fantastic. How does it compare in terms of speed?

Very slow. When @ahojnnes says a CPU implementation would be too slow... he isn't joking.

I have dual Xeon Platinum 8360m CPUs. That gives me 48 physical cores. Xeon Gold and Platinum CPUs have 2 AVX512 FMA units per core, whereas all other intel CPUs with AVX512 have only one per core. Ultimately, I have 96 physical AVX512 units on my workstation capable of running at 2.6GHz (AVX cores run at a lower turbo speed, this is common to all intel CPUS).

With my 96 AVX512 FMA cores, I manage about 8% the performance of a AMD Radeon 6900 XT running OpenCL for a raytracing workload. A raytracing workload is much more forgiving to CPUs than colmap's dense reconstruction algorithm is.

Of course, the difference will be even more asymmetric if you don't have 96 AVX512 FMA units at your disposable. Any CPU that has an IGPU will have as many as you have cores (not threads). So if you, say, have an 8 core cpu, even allowing for the higher turbo frequency, you should expect between 1-2% the performance of AMD Radeon 6900 XT.

Using an AMD Radeon 6900 XT, dense reconstruction workloads for complex scenes can still take many hours or even a couple of days using MetashapePro (commercial photogrammetry software with an OpenCL kernel) as reference. I believe it implements a similar algorithm but I am not sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants