{"id":20264597,"url":"https://github.com/chrockey/benchmark_sparse","last_synced_at":"2025-04-11T02:23:15.510Z","repository":{"id":181805283,"uuid":"594737441","full_name":"chrockey/benchmark_sparse","owner":"chrockey","description":"Benchmarking various sparse convolution libraries: MinkowskiEngine, SpConv, TorchSparse, and Open3D.","archived":false,"fork":false,"pushed_at":"2023-04-10T02:57:35.000Z","size":5479,"stargazers_count":12,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T23:51:26.269Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chrockey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-01-29T13:49:21.000Z","updated_at":"2024-11-27T07:15:09.000Z","dependencies_parsed_at":"2023-07-17T15:31:46.096Z","dependency_job_id":null,"html_url":"https://github.com/chrockey/benchmark_sparse","commit_stats":null,"previous_names":["chrockey/benchmark_sparse"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrockey%2Fbenchmark_sparse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrockey%2Fbenchmark_sparse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrockey%2Fbenchmark_sparse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrockey%2Fbenchmark_sparse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chrockey","download_url":"https://codeload.github.com/chrockey/benchmark_sparse/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248328495,"owners_count":21085325,"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":[],"created_at":"2024-11-14T11:41:39.896Z","updated_at":"2025-04-11T02:23:15.477Z","avatar_url":"https://github.com/chrockey.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Benchmark of sparse convolution libraries\nBenchmarking various sparse convolution libraries: [MinkowskiEngine](https://github.com/NVIDIA/MinkowskiEngine), [SpConv](https://github.com/traveller59/spconv), [TorchSparse](https://github.com/mit-han-lab/torchsparse), and [Open3D](https://github.com/isl-org/Open3D).\n\n### Environments\n- A6000 GPU\n- Ubuntu 22.04\n- CUDA 11.7\n- PyTorch 2.0.0\n- SpConv v2.3.5\n- MinkowskiEngine v0.5.4\n- TorchSparse v1.4.0\n- libsparsehash-dev # apt-get install libsparsehash-dev\n\n\n### Installation\n```bash\n~/benchmark_sparse$ conda create -n bench python=3.8 -y\n~/benchmark_sparse$ conda activate bench\n(bench) ~/benchmark_sparse$ pip install torch ninja open3d\n(bench) ~/benchmark_sparse$ pip install spconv-cu117\n(bench) ~/benchmark_sparse$ pip install -U git+https://github.com/NVIDIA/MinkowskiEngine -v --no-deps \\\n                                                                                            --install-option=\"--blas_include_dirs=${CONDA_PREFIX}/include\" \\\n                                                                                            --install-option=\"--blas=openblas\"\n(bench) ~/benchmark_sparse$ pip install --upgrade git+https://github.com/mit-han-lab/torchsparse.git@v1.4.0\n```\n\n### Comparsion\n| Library         | Voxelization | Mixed Precision Training |\n|:----------------|:------------:|:------------------------:|\n| MinkowskiEngine | :white_check_mark: |  |\n| SpConv          | :white_check_mark: | :white_check_mark: |\n| TorchSparse     | :white_check_mark: | :white_check_mark: |\n\n\n### Benchmark results\nEach forward/backward time is the minimum time of 10 trials.\n#### 1. Sample data (1,296,440 points) \u0026 Single convolution layer\n| Library         | Forward Time (ms) | Backward Time (ms) |\n|:----------------|------------------:|-------------------:|\n| MinkowskiEngine | 14.879 | 10.764 |\n| SpConv          |  8.764 |  0.492 |\n| TorchSparse     | 29.397 |  7.705 |\n\n#### 2. Sample data (1,296,440 points) \u0026 Cylindrical network (no down/up sampling)\nThe cylindrical network is a stack of eight conv-bn-relu blocks.\n| Library         | Forward Time (ms) | Backward Time (ms) |\n|:----------------|------------------:|-------------------:|\n| MinkowskiEngine | 49.448 | 67.557 |\n| SpConv          | 24.142 |  3.119 |\n| TorchSparse     | 146.081 | 132.985 |\n\n#### 3. ScanNetV2 \u0026 [MinkowskiNet42](https://openaccess.thecvf.com/content_CVPR_2019/papers/Choy_4D_Spatio-Temporal_ConvNets_Minkowski_Convolutional_Neural_Networks_CVPR_2019_paper.pdf)\nI measured the average time of each training iteration (forward + backward) of MinkowskiNet42 on ScanNetV2 (3D semantic segmentation) with voxel size of 2cm and batch size of 8.\nNote that each time includes data loading time with common data augmentations (e.g., random rotation).\n| Library         | Average time (sec/iter) |\n|:----------------|------------------------:|\n| MinkowskiEngine | 0.943 |\n| SpConv          | 0.452 |\n\n\n### Conclusion\nFor now, the benchmark results show that SpConv is the fastest sparse conovlution library among MinkowskiEngine, SpConv, and TorchSparse.\nHowever, it is worth noting that MinkowskiEngine with [TensorField](https://github.com/NVIDIA/MinkowskiEngine/blob/master/MinkowskiEngine/MinkowskiTensorField.py) support is more flexible than SpConv and TorchSparse, which is a big advantage for researchers.\nTherefore, I recommend using MinkowskiEngine for research purposes and SpConv for production purposes where latency matters.\nAny feedback is welcome!\n\n### Todos\n- [x] Benchmark results with a more complex network (e.g., UNet).\n- [x] Benchmark the actual training time of the network on 3D semantic segmentation task.\n- [ ] Add Open3D's sparse convolution.\n\n\n### Acknowlegement\nThis repo heavily borrowed codes from [Chris Choy's benchmark code](https://gist.github.com/chrischoy/d8e971daf8308aa1dcba1524bf1fd91a).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrockey%2Fbenchmark_sparse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchrockey%2Fbenchmark_sparse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrockey%2Fbenchmark_sparse/lists"}