FoundationPose icon indicating copy to clipboard operation
FoundationPose copied to clipboard

Add RTX 50 series GPU compatibility via PyTorch 2.7 and CUDA 12.8

Open wualbert opened this issue 4 months ago • 3 comments

This PR addresses multiple compatibility issues that prevent FoundationPose from building and running on RTX 50 series (sm_120 architecture) GPUs with modern PyTorch versions.

  • PyTorch API Updates: Replaced deprecated .type() calls with .scalar_type() in 3 locations in bundlesdf/mycuda/common.cu to fix compilation errors with PyTorch 2.7+
  • C++ Standard Upgrade: Updated from C++14 to C++17 in bundlesdf/mycuda/setup.py to meet modern PyTorch requirements
  • Format String Fixes: Fixed printf format warnings in mycpp/src/app/pybind_api.cpp by changing %d to %zu for size_t values
  • PyTorch Version Update: Updated requirements.txt to use PyTorch 2.7.1 with CUDA 12.8 for RTX 50 series compatibility
  • Import Path Fix: Corrected mycpp import path in Utils.py from mycpp.build.mycpp to mycpp
  • RTX 50 Series Guide: Added comprehensive setup instructions for RTX 50 series GPUs in readme.md
  • Troubleshooting Section: Detailed common build and runtime issues with specific error messages and solutions

wualbert avatar Jul 31 '25 23:07 wualbert

There are currently no Docker images that can run on RTX 50 series GPU. The one built for RTX 40 series card (see https://github.com/NVlabs/FoundationPose/issues/27) does not work on RTX 50 series due to the issues addressed in this PR.

wualbert avatar Aug 01 '25 00:08 wualbert

Thank you! It works on RTX 5090 in WSL with docker. Except that I still need to import Utils.py from mycpp.build.mycpp, and solve the issue in #293 .

yanglicb avatar Aug 21 '25 15:08 yanglicb

Hi, I have followed your instruction. However, there is an error says "No module named 'torch'" when i tried to bash build_all_conda.sh to install mycpp. I am sure theres pytorch 2.7.1 with cuda 12.8 on my 5090D PC. And the detail of bugs is listed below. Could you please let me know why and what should i do? CMAKE_PREFIX_PATH=$CONDA_PREFIX/lib/python3.9/site-packages/pybind11/share/cmake/pybind11 bash build_all_conda.sh -- The C compiler identification is GNU 15.2.0 -- The CXX compiler identification is GNU 15.2.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /home/dell/miniconda3/envs/foundationpose/bin/x86_64-conda-linux-gnu-cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /home/dell/miniconda3/envs/foundationpose/bin/x86_64-conda-linux-gnu-c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Warning (dev) at CMakeLists.txt:10 (find_package): Policy CMP0167 is not set: The FindBoost module is removed. Run "cmake --help-policy CMP0167" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

This warning is for project developers. Use -Wno-dev to suppress it.

-- Found Boost: /home/dell/miniconda3/envs/foundationpose/lib/cmake/Boost-1.85.0/BoostConfig.cmake (found version "1.85.0") found components: system program_options -- Found OpenMP_C: -fopenmp (found version "4.5") -- Found OpenMP_CXX: -fopenmp (found version "4.5") -- Found OpenMP: TRUE (found version "4.5") CMake Warning (dev) at /home/dell/miniconda3/envs/foundationpose/lib/python3.9/site-packages/pybind11/share/cmake/pybind11/FindPythonLibsNew.cmake:101 (message): Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules are removed. Run "cmake --help-policy CMP0148" for policy details. Use the cmake_policy command to set the policy and suppress this warning, or preferably upgrade to using FindPython, either by calling it explicitly before pybind11, or by setting PYBIND11_FINDPYTHON ON before pybind11. Call Stack (most recent call first): /home/dell/miniconda3/envs/foundationpose/lib/python3.9/site-packages/pybind11/share/cmake/pybind11/pybind11Tools.cmake:44 (find_package) /home/dell/miniconda3/envs/foundationpose/lib/python3.9/site-packages/pybind11/share/cmake/pybind11/pybind11Common.cmake:226 (include) /home/dell/miniconda3/envs/foundationpose/lib/python3.9/site-packages/pybind11/share/cmake/pybind11/pybind11Config.cmake:257 (include) CMakeLists.txt:13 (find_package) This warning is for project developers. Use -Wno-dev to suppress it.

-- Found PythonInterp: /home/dell/miniconda3/envs/foundationpose/bin/python (found suitable version "3.9.23", minimum required is "3.8") -- Found PythonLibs: /home/dell/miniconda3/envs/foundationpose/lib/libpython3.9.so -- Performing Test HAS_FLTO_AUTO -- Performing Test HAS_FLTO_AUTO - Success -- Found pybind11: /home/dell/miniconda3/envs/foundationpose/lib/python3.9/site-packages/pybind11/include (found version "3.0.1") -- Configuring done (0.6s) -- Generating done (0.0s) -- Build files have been written to: /home/dell/gxy/FoundationPose/mycpp/build [ 33%] Building CXX object CMakeFiles/mycpp.dir/src/app/pybind_api.cpp.o [ 66%] Building CXX object CMakeFiles/mycpp.dir/src/Utils.cpp.o [100%] Linking CXX shared module mycpp.cpython-39-x86_64-linux-gnu.so [100%] Built target mycpp install: missing destination file operand after 'mycuda' Try 'install --help' for more information. Obtaining file:///home/dell/gxy/FoundationPose/bundlesdf/mycuda Installing build dependencies ... done Checking if build backend supports build_editable ... done Getting requirements to build editable ... error error: subprocess-exited-with-error

× Getting requirements to build editable did not run successfully. │ exit code: 1 ╰─> [19 lines of output] Traceback (most recent call last): File "/home/dell/miniconda3/envs/foundationpose/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in main() File "/home/dell/miniconda3/envs/foundationpose/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 373, in main json_out["return_val"] = hook(**hook_input["kwargs"]) File "/home/dell/miniconda3/envs/foundationpose/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 157, in get_requires_for_build_editable return hook(config_settings) File "/tmp/pip-build-env-0xeol_fp/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 473, in get_requires_for_build_editable return self.get_requires_for_build_wheel(config_settings) File "/tmp/pip-build-env-0xeol_fp/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 331, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=[]) File "/tmp/pip-build-env-0xeol_fp/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 301, in _get_build_requires self.run_setup() File "/tmp/pip-build-env-0xeol_fp/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 512, in run_setup super().run_setup(setup_script=setup_script) File "/tmp/pip-build-env-0xeol_fp/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 317, in run_setup exec(code, locals()) File "", line 12, in ModuleNotFoundError: No module named 'torch' [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed to build 'file:///home/dell/gxy/FoundationPose/bundlesdf/mycuda' when getting requirements to build editable

GXYsteven avatar Nov 14 '25 03:11 GXYsteven