-
Notifications
You must be signed in to change notification settings - Fork 173
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
π§ Overview
Hello maintainers,
Iβd like to share the issues I faced when trying to set up TorchSparse on a modern development environment, and hopefully get advice on any workarounds β or initiate a discussion for future compatibility updates.
π Goal
To build and use torchsparse
with GPU acceleration for high-performance point cloud processing tasks on a modern CUDA-capable system.
π§ͺ Reproduction Environment
Component | My Version | TorchSparse Compatibility |
---|---|---|
OS | Ubuntu 22.04 | β |
Python | 3.11 | β (<= 3.10) |
PyTorch | 2.4.0 | β (1.13 ~ 2.0.x) |
CUDA | 12.1 | β (11.1 ~ 11.8) |
GCC | 13.3.0 | β (CUDA 11.x only supports <= GCC 11) |
β What Went Wrong
1. π§ Installation Command:
pip install git+https://github.com/mit-han-lab/torchsparse.git
2. 𧨠Compile Errors:
<command-line>: fatal error: cuda_runtime.h: No such file or directory
cuda_fp8.hpp: error: missing binary operator before token "("
(__CUDA_ARCH_HAS_FEATURE__(SM100_ALL)) || ...
3. π΅οΈ Root Causes Identified:
cuda_runtime.h
andcuda_fp8.hpp
were missing due to CUDA_HOME not being picked up correctly.- Conda's symbolic link to
nvcc
conflicted with system-installed CUDA. cuda_fp8.hpp
errors indicated macro incompatibility with GCC 13.- Even manually creating fallback macros didnβt solve all compile issues.
- GCC version > 11 is simply not compatible with CUDA 11.8 (required by TorchSparse).
π οΈ Troubleshooting Attempts
β Attempted Fixes:
-
Forced compilation with
--allow-unsupported-compiler
-
Created header patch:
#ifndef __CUDA_ARCH_HAS_FEATURE__ #define __CUDA_ARCH_HAS_FEATURE__(x) 0 #endif
-
Installed older GCC:
conda install -c conda-forge gcc_linux-64=11 gxx_linux-64=11
-
Set environment variables:
export CUDA_HOME=$CONDA_PREFIX export CUDACXX=$CUDA_HOME/bin/nvcc export CPATH=$CUDA_HOME/include:$CUDA_HOME/targets/x86_64-linux/include export TORCH_CUDA_ARCH_LIST="7.5"
-
Tried source install with:
pip install -v -e .
β Result:
None of these efforts led to a successful GPU build.
β Temporary Workaround: CPU-Only Mode
Eventually, I got it working with the CPU backend only:
conda create -n scenescript python=3.10 pytorch=2.0.0 pytorch-cuda=11.8 -c pytorch -c nvidia -y
conda activate scenescript
export FORCE_CPU=1
pip install git+https://github.com/mit-han-lab/torchsparse.git
No CUDA was compiled, but it successfully installed and runs on CPU.
π Notes for Others
- Donβt mix system CUDA and conda CUDA.
- Use Python β€ 3.10.
- Downgrade GCC to β€ 11 via conda-forge.
- Use
FORCE_CPU=1
if you need to proceed without GPU.
π My Requests to Maintainers
Would you consider providing any of the following?
- β
A reference conda environment file (
environment.yml
) that does support GPU? - π¦ A Dockerfile that guarantees successful GPU compilation (with exact PyTorch, CUDA, Python, GCC)?
- π£οΈ A compatibility roadmap β e.g., plans to support PyTorch 2.1+, CUDA 12.x, Python 3.11+?
- π§ A patched or future-proofed build system that fails more gracefully or has better version checks?
π¬ Final Thoughts
TorchSparse is critical for several point cloud projects β especially for high-speed inference and voxelization. It would be amazing to have either:
- A prebuilt wheel for common environments
- Or a minimal set of installable requirements that allow GPU build to succeed
Iβd be happy to test or contribute to compatibility improvements if needed.
Thanks for all the work youβve done maintaining this project!
Expected Behavior
No response
Environment
- GCC:
- NVCC:
- PyTorch:
- PyTorch CUDA:
- TorchSparse:
Anything else?
No response