{"id":28411931,"url":"https://github.com/megviirobot/megba","last_synced_at":"2025-06-24T07:32:42.446Z","repository":{"id":37745664,"uuid":"429459029","full_name":"MegviiRobot/MegBA","owner":"MegviiRobot","description":"MegBA: A GPU-Based Distributed Library for Large-Scale Bundle Adjustment","archived":false,"fork":false,"pushed_at":"2024-06-03T23:06:23.000Z","size":1360,"stargazers_count":467,"open_issues_count":10,"forks_count":61,"subscribers_count":21,"default_branch":"main","last_synced_at":"2025-06-03T07:09:52.141Z","etag":null,"topics":["bundleadjustment","cuda","distributed","gpu-acceleration","graph-optimization","high-performance"],"latest_commit_sha":null,"homepage":"","language":"Cuda","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MegviiRobot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-18T14:22:53.000Z","updated_at":"2025-06-03T05:14:45.000Z","dependencies_parsed_at":"2023-12-13T13:45:36.966Z","dependency_job_id":"9c81e26c-98cb-4ab6-acc4-1f48ca040173","html_url":"https://github.com/MegviiRobot/MegBA","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MegviiRobot/MegBA","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MegviiRobot%2FMegBA","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MegviiRobot%2FMegBA/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MegviiRobot%2FMegBA/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MegviiRobot%2FMegBA/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MegviiRobot","download_url":"https://codeload.github.com/MegviiRobot/MegBA/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MegviiRobot%2FMegBA/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261628470,"owners_count":23186825,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bundleadjustment","cuda","distributed","gpu-acceleration","graph-optimization","high-performance"],"created_at":"2025-06-02T19:17:50.221Z","updated_at":"2025-06-24T07:32:42.433Z","avatar_url":"https://github.com/MegviiRobot.png","language":"Cuda","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MegBA: A High-Performance and Distributed Library for Large-Scale Bundle Adjustment\n\nThis repo contains an official implementation of [MegBA](https://arxiv.org/abs/2112.01349).\n\nMegBA is a fast and distributed library for large-scale Bundle Adjustment (BA). MegBA has a novel end-to-end vectorised BA algorithm which can fully exploit the massive parallel cores on GPUs, \nthus speeding up the entire BA computation. It also has a novel distributed BA algorithm that can automatically partition BA problems, \nand solve BA sub-problems using distributed GPUs. The GPUs synchronise intermediate solving state using network-efficient collective communication, \nand the synchronisation is designed to minimise communication cost. MegBA has a memory-efficient GPU runtime and it exposes g2o-compatible APIs. \nExperiments show that MegBA can out-perform state-of-the-art BA libraries (i.e., Ceres and DeepLM) by ~50x and ~5x respectively, in public large-scale BA benchmarks.\n\n\n## Version\n\n* 2021/12/06 Beta version released! It corresponds to this [paper](https://arxiv.org/abs/2112.01349)\n* 2022/02/18 Stable version released! We have refactored MegBA and fixed some existing bugs, e.g., incorrect rollback in the LM reject step.\n* 2022/02/25 Analytical differentiation module available; We also provide BAL_X_analytical.cpp under examples/. Compared with automatic diff, time and space are reduced by ~30% and ~40%, respectively.\n\n## Todo\n- [ ] memory-efficient version with implicit Hessian (TBD)\n- [ ] IMU factor, prior factor (TBD)\n\nPaper: https://arxiv.org/abs/2112.01349 (updated version)\n\n\n## Quickstart\n\nDependencies:\n\n- C++14\n- CMake (\u003e= 3.15)\n- [CUDA](https://developer.nvidia.com/cuda-downloads) (\u003e= 11.2)\n- [gflags](https://github.com/gflags/gflags)\n- NCCL2 (if you need Distributed features) https://developer.nvidia.com/nccl/nccl-download\n\nYou can also easily install all dependencies with script: [script](https://drive.google.com/file/d/154whcVH2VcJCYnTSlnfo_tbIIaQvSax3/view?usp=sharing)\n\n\nDemo with BAL dataset:\n\n* Download any pre.txt.bz2 file from BAL Dataset: https://grail.cs.washington.edu/projects/bal/ and uncompressed.\n\n* Compile\n\n  If you want to use the distributed feature, use `cmake -DMEGBA_ENABLE_NCCL ..` instead of `cmake ..`.\n\n  ```bash\n  git submodule update --init\n  mkdir build\n  cd build\n  cmake ..  # enable nccl by using cmake -DMEGBA_ENABLE_NCCL ..\n  make -j4 BAL_Double\n  ```\n\n* Run the demo (Venice-1778)\n\n  ```bash\n  cd examples\n  ./BAL_Double --path /path/to/your/dataset --world_size 2 --max_iter 100 --solver_tol 1e-1 --solver_refuse_ratio 1 --solver_max_iter 100 --tau 1e4 --epsilon1 1 --epsilon2 1e-10\n  ```\n\n  - world_size: number of GPUs available\n  - max_iter: the maximal number of LM iteration\n  - epsilon1 \u0026 epsilon2: threshold in LM\n  - solver_tol: tolerance of solver (distributed PCG solver)\n  - solver_refuse_ratio: early stop for the solver\n  - solver_max_iter: the maximal iteration of solver\n  - tau: the initial region\n\n\n## Notes for the practitioners\n\n* ~~Currently, MegBA implements automatic differentiation only for generalizability. Please consider implementing your own analytical differentiation module.~~ Analytical differentiation module is provided.\n* If you use devices without modern inter-device communication (i.e., NVLinks..), you might find the data transfer is the bottleneck.\n* Empirically, we found it is necessary to customize the LM trust-region strategies and tune its hyper-parameters to further boost the performance. \n\n\n## Documentation\n\nUnder doc/  (Coming soon...)\n\n\n## Collaborate with Us\n\nPlease check here for [MegBA's future plan](https://docs.google.com/document/d/1fHYuw_qRFHrBcGSeQ8Ld4y2wK9oxF0am3xA9r6veUwM/edit?usp=sharing).\n\nIf you are interested in MegBA and want to collaborate, you can:\n\n* Sorry, we can no longer host Interns.\n* As an external collaborator (coding), just fork this repo and send PRs. We will review your PR carefully (and merge it into MegBA).\n* As an algorithm/novelty contributor, please send an email to MegBA@googlegroups.com.\n* Any new feature request, you can send an email to MegBA@googlegroups.com as well. *Note that it is not guaranteed the requested feature will be added or added soon*\n\n\nContact Information:\n\n* Jie Ren jieren9806@gmail.com\n* Wenteng Liang wenteng_liang@163.com\n* Ran Yan yanran@megvii.com\n* Shiwen Liu lswbblue@163.com\n* Xiao Liu liuxiao@foxmail.com\n\n## BibTeX Citation\n\nIf you find MegBA useful for your project, please consider citing:\n\n```\n@inproceedings{2021megba,\n  title={MegBA: A GPU-Based Distributed Library for Large-Scale Bundle Adjustment}, \n  author={Jie Ren and Wenteng Liang and Ran Yan and Luo Mai and Shiwen Liu and Xiao Liu},\n  booktitle={European Conference on Computer Vision},\n  year={2022}\n}\n\n```\n\n\n## License\n\nMegBA is licensed under the Apache License, Version 2.0.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmegviirobot%2Fmegba","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmegviirobot%2Fmegba","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmegviirobot%2Fmegba/lists"}