Skip to content

Parallelize cloud generation in export/view clouds dialog and rtabmap-export - #1757

Merged
matlabbe merged 6 commits into
introlab:masterfrom
torjusti:export-cloud-parallel
Aug 31, 2026
Merged

matlabbe merged 6 commits into
introlab:masterfrom
torjusti:export-cloud-parallel

Conversation

@torjusti

Copy link
Copy Markdown
Contributor

This PR multi threads the cloud generation when exporting from the DB viewer or using the CLI export tool. Only the cloud generation is affected, the cloud assembly is still sequential.

With 32 threads it's a 16x speedup for me, very significant as I have databases with lots of nodes in them and the cloud export takes a long time. The output should be identical to the existing implementation.

The diff is a bit noisy because all the properties needed for cloud exports have been extracted to a separate data object. That's done because I'm worried about interacting with the Qt widget values on a different thread, but maybe it's fine. Open to suggestions for better ways of doing this!

Comment thread tools/Export/main.cpp Resolved
Comment thread guilib/src/ExportCloudsDialog.cpp Resolved
@torjusti
torjusti force-pushed the export-cloud-parallel branch from 27976f3 to 5dc9c63 Compare August 27, 2026 18:45

@fallenmi fallenmi left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disclosure: I used Codex to assist with this review and verified the result against exact commit be7714e7b8b5a0d14e52bd2f2ad5cfb7db2ea880.

I traced both parallel refactors against base d4940634: the GUI keeps subtraction filtering on its sequential path and publishes every other result atomically before flushing it in node order, while the CLI performs only per-node loading/generation in parallel and preserves node order for cloud assembly, pose/GPS/grid accumulation, counters, and progress.

A focused OpenMP oracle exercised 3,000 randomized 1/2/4/8-thread ordering and cancellation cases in both normal and ASan/UBSan builds; all passed. The current GitHub merge b51f4dc2 contains the same versions of all three changed files, and the exact-head upstream matrix is green across 25 executed jobs, with one dependency job intentionally skipped. I found no blocking issue.

@matlabbe

matlabbe commented Aug 30, 2026 •

Copy link
Copy Markdown
Member

I reviewed more deeply and did some minor changes (matching commits above):

Experiment: I used combined merged.db from https://github.com/introlab/rtabmap/wiki/Multi-Session-Mapping-with-RTAB-Map-Tango, then with rtabmap-export (on a 16 cores computer):

Step Before After Speedup
Cloud generation 7 s 0.7 s 10x
Mesh texturing 35 s 9 s 3.9x
Total 42 s 9.7 s 4.3x

Commands used:

# Assemble
$ rtabmap-reprocess --Optimizer/GravitySigma 0.3 --Mem/UseOdomGravity true "chalet1.db;chalet2.db;chalet3.db;chalet4.db" merged.db

# Processing with 1 thread (like before)
rtabmap-export --threads 1 --texture --texture_size 4096 --texture_range 3 --poisson_depth 9 --max_polygons 500000 --multiband --color_radius 0 --no_clean   merged.db

# Processing with 16 threads (default is 0 -> auto)
rtabmap-export --threads 0 --texture --texture_size 4096 --texture_range 3 --poisson_depth 9 --max_polygons 500000 --multiband --color_radius 0 --no_clean  merged.db

One downside for texturing is that there is a 50 MB overhead per thread. So 16 threads means 15*50MB=750MB overhead in RAM. For only cloud generation, the penalty in RAM usage is way less.

@matlabbe
matlabbe merged commit 7eb26e1 into introlab:master Aug 31, 2026
29 checks passed
torjusti added a commit to torjusti/rtabmap that referenced this pull request Sep 2, 2026
Take upstream's export-cloud parallelization (introlab#1757) and proximity BFS (introlab#1756),
keeping easy-priors anchor-point and optimizer work.
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

Successfully merging this pull request may close these issues.

3 participants