Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .github/workflows/testpr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,6 @@ jobs:
run: |
# Uncomment to force-rebuild a package with a corrupted cache entry.
# rm -rf ${{ matrix.folder_cache }}/<package>* 2>/dev/null || true
rm -rf ${{ matrix.folder_cache }}/ros2-roboplan* 2>/dev/null || true
rm -rf ${{ matrix.folder_cache }}/ros-rolling-roboplan* 2>/dev/null || true
rm -rf ${{ matrix.folder_cache }}/ros-rolling-rosidl-generator-py* ${{ matrix.folder_cache }}/ros2-rosidl-generator-py* 2>/dev/null || true
rm -rf ${{ matrix.folder_cache }}/ros-rolling-rosidl-core-generators* ${{ matrix.folder_cache }}/ros2-rosidl-core-generators* 2>/dev/null || true
rm -rf ${{ matrix.folder_cache }}/ros-rolling-rosidl-default-generators* ${{ matrix.folder_cache }}/ros2-rosidl-default-generators* 2>/dev/null || true
rm -rf ${{ matrix.folder_cache }}/ros-rolling-std-msgs* ${{ matrix.folder_cache }}/ros2-std-msgs* 2>/dev/null || true
mkdir -p ${{ matrix.folder_cache }}
pixi run rattler-index fs ${{ matrix.folder_cache }}/.. --force

Expand Down
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,49 @@ If you use RoboStack in your academic work, please refer to the following paper:
## Installation, FAQ, and Contributing Instructions

Please see our instructions [here](https://robostack.github.io/GettingStarted.html).

## CUDA buffer builds

On Linux, `cuda_buffer` and `cuda_buffer_backend` build two variants. The
`cuda_buffer_cuda_version` matrix in `conda_build_config.yaml` is preserved by
the matching override in `vinca_pinning.yaml`.

| Build SDK | Runtime constraint | CUDA runtime ABI |
| --- | --- | --- |
| 12.9 | `cuda-version >=12.9,<13` | `libcudart.so.12` |
| 13.0 | `cuda-version >=13.0,<14` | `libcudart.so.13` |

`pixi run build` builds both variants. To debug the dependency chain, run
`pixi run build-one ros2-cuda-buffer` followed by
`pixi run build-one ros2-cuda-buffer-backend`. Select the installed variant by
constraining `cuda-version` in the consuming environment; the package build
hashes distinguish the two variants. Match that CUDA major with GPU LibTorch
when using both libraries in the same environment.

CUDA buffer and GPU LibTorch builds use GCC 14 on Linux, to satisfy the CUDA
tool packages' compiler constraints. Native build tools live in the build
prefix; target CUDA runtime,
driver stubs and CRT headers live in the host prefix. The installed packages
depend on the CUDA runtime, without bundling driver stubs or requiring nvcc at
runtime. The NVIDIA driver supplies `libcuda.so.1` on the target machine.
macOS and Windows skip these packages because the sources use POSIX IPC and
`librt`. LibTorch and the message-only packages retain their existing platform
support.

## LibTorch CPU and GPU builds

`libtorch_vendor` reuses conda-forge's `libtorch` through `find_package(Torch)`.
The default builds use its CPU variant. Set `CF_CUDA_ENABLED=True` to additionally
build CUDA 12.9 and 13.0 variants on `linux-64`, `linux-aarch64`, and `win-64`:

```bash
CF_CUDA_ENABLED=True pixi run build
```

This uses the existing `cuda_compiler_version` matrix in `vinca_pinning.yaml`;
macOS keeps CPU builds even with the flag enabled. LibTorch and
`torch_conversions` runtime dependencies select the same CPU/CUDA variant.
Linux GPU `torch_conversions` also enables `cuda_buffer`, with the matching
CUDA major. Builds use the CUDA SDK and driver stubs, so an NVIDIA driver and
GPU are not required for compilation. Running CUDA tensor operations requires
a compatible NVIDIA driver and GPU.
11 changes: 10 additions & 1 deletion conda_build_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ c_compiler_version: # [unix]
- 15 # [linux]
- 21 # [osx]
- 14 # [linux and (x86_64 or aarch64) and os.environ.get("CF_CUDA_ENABLED", "False") == "True"]
- 14 # [linux and (x86_64 or aarch64) and os.environ.get("CF_CUDA_ENABLED", "False") == "True"]
c_stdlib:
- sysroot # [linux]
- macosx_deployment_target # [osx]
Expand All @@ -21,6 +22,7 @@ c_stdlib_version: # [unix]
- 2.28 # [linux and not riscv64]
- 2.39 # [linux and riscv64]
- 2.28 # [linux and (x86_64 or aarch64) and os.environ.get("CF_CUDA_ENABLED", "False") == "True"]
- 2.28 # [linux and (x86_64 or aarch64) and os.environ.get("CF_CUDA_ENABLED", "False") == "True"]
- 14.0 # [osx]
cxx_compiler:
- gxx # [linux]
Expand All @@ -31,6 +33,7 @@ cxx_compiler_version: # [unix]
- 15 # [linux]
- 21 # [osx]
- 14 # [linux and (x86_64 or aarch64) and os.environ.get("CF_CUDA_ENABLED", "False") == "True"]
- 14 # [linux and (x86_64 or aarch64) and os.environ.get("CF_CUDA_ENABLED", "False") == "True"]
llvm_openmp: # [osx]
- 21 # [osx]
fortran_compiler: # [unix or win]
Expand All @@ -41,6 +44,7 @@ fortran_compiler_version: # [unix or win]
- 5 # [win64]
- 22 # [win and arm64]
- 14 # [linux and (x86_64 or aarch64) and os.environ.get("CF_CUDA_ENABLED", "False") == "True"]
- 14 # [linux and (x86_64 or aarch64) and os.environ.get("CF_CUDA_ENABLED", "False") == "True"]
m2w64_c_compiler: # [win]
- gcc # [win]
m2w64_c_compiler_version: # [win]
Expand Down Expand Up @@ -81,6 +85,7 @@ cuda_compiler:
cuda_compiler_version:
- None
- 12.9 # [((linux and (x86_64 or aarch64)) or win64) and os.environ.get("CF_CUDA_ENABLED", "False") == "True"]
- 13.0 # [((linux and (x86_64 or aarch64)) or win64) and os.environ.get("CF_CUDA_ENABLED", "False") == "True"]
cuda_compiler_version_min:
- None # [not ((linux and (x86_64 or aarch64)) or win64)]
- 12.9 # [((linux and (x86_64 or aarch64)) or win64)]
Expand Down Expand Up @@ -979,7 +984,6 @@ python:
- 3.14.* *_cp314
python_impl:
- cpython

python_min:
# minimum supported python version per CFEP-25
# bump to next minor version when we drop python versions
Expand Down Expand Up @@ -1172,6 +1176,11 @@ zlib_ng:
- '2.3'
zstd:
- '1.5'
cuda_buffer_cuda_version:
- '12.9'
- '13.0'
# Build commands provide their channels with `-c`, so omit the inherited
# conda-forge-pinning channel_sources value from the rendered configuration.
libzenohc:
- 1.10.1
libzenohcxx:
Expand Down
62 changes: 62 additions & 0 deletions patch/dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,68 @@ sdl2_vendor:
libcurl_vendor:
add_host: ["libcurl"]
add_run: ["libcurl"]
libtorch_vendor:
# Torch_FOUND skips the upstream download. CPU/cu12/cu13 must stay consistent.
add_build: &libtorch_build
- "${{ compiler('cuda') if cuda_compiler_version != 'None' else '' }}"
add_host:
- "libtorch * ${{ 'cpu' if cuda_compiler_version == 'None' else 'cuda' ~ (cuda_compiler_version | replace('.', '')) }}*"
- "${{ 'cuda-version ' ~ cuda_compiler_version ~ '.*' if cuda_compiler_version != 'None' else '' }}"
- "${{ 'cuda-cudart-dev' if cuda_compiler_version != 'None' else '' }}"
- "${{ 'cuda-driver-dev' if linux and cuda_compiler_version != 'None' else '' }}"
- "${{ 'cuda-nvrtc-dev' if cuda_compiler_version != 'None' else '' }}"
- "${{ 'nvtx-c' if cuda_compiler_version != 'None' else '' }}"
- "${{ 'arm-variant * sbsa' if aarch64 and cuda_compiler_version != 'None' else '' }}"
add_run:
- "libtorch * ${{ 'cpu' if cuda_compiler_version == 'None' else 'cuda' ~ (cuda_compiler_version | replace('.', '')) }}*"
- "${{ 'cuda-version >=' ~ cuda_compiler_version ~ ',<' ~ ((cuda_compiler_version | split('.'))[0] | int + 1) if cuda_compiler_version != 'None' else '' }}"
torch_conversions:
add_build: *libtorch_build
add_host:
- "libtorch * ${{ 'cpu' if cuda_compiler_version == 'None' else 'cuda' ~ (cuda_compiler_version | replace('.', '')) }}*"
- "${{ 'cuda-version ' ~ cuda_compiler_version ~ '.*' if cuda_compiler_version != 'None' else '' }}"
- "${{ 'cuda-cudart-dev' if cuda_compiler_version != 'None' else '' }}"
- "${{ 'cuda-driver-dev' if linux and cuda_compiler_version != 'None' else '' }}"
- "${{ 'cuda-nvrtc-dev' if cuda_compiler_version != 'None' else '' }}"
- "${{ 'nvtx-c' if cuda_compiler_version != 'None' else '' }}"
- "${{ 'arm-variant * sbsa' if aarch64 and cuda_compiler_version != 'None' else '' }}"
- "${{ 'ros2-cuda-buffer' if linux and cuda_compiler_version != 'None' else '' }}"
add_run:
- "libtorch * ${{ 'cpu' if cuda_compiler_version == 'None' else 'cuda' ~ (cuda_compiler_version | replace('.', '')) }}*"
- "${{ 'cuda-version >=' ~ cuda_compiler_version ~ ',<' ~ ((cuda_compiler_version | split('.'))[0] | int + 1) if cuda_compiler_version != 'None' else '' }}"
- "${{ 'ros2-cuda-buffer' if linux and cuda_compiler_version != 'None' else '' }}"
cuda_buffer:
# No .cu sources: nvcc is used only by FindCUDAToolkit for discovery/versioning.
# The CUDA 12.9/13.0 tool packages constrain GCC to <15, even for --version.
remove_build: ["${{ compiler('c') }}", "${{ compiler('cxx') }}"]
add_build:
- "gcc_${{ target_platform }} 14.*"
- "gxx_${{ target_platform }} 14.*"
- "cuda-nvcc-tools ${{ cuda_buffer_cuda_version }}.*"
add_host:
- "cuda-version ${{ cuda_buffer_cuda_version }}.*"
- cuda-cudart-dev
- cuda-driver-dev
- "cuda-crt-dev_${{ target_platform }} ${{ cuda_buffer_cuda_version }}.*"
- if: aarch64
then: "arm-variant * sbsa"
add_run:
- "cuda-version >=${{ cuda_buffer_cuda_version }},<${{ (cuda_buffer_cuda_version | split('.'))[0] | int + 1 }}"
cuda_buffer_backend:
remove_build: ["${{ compiler('c') }}", "${{ compiler('cxx') }}"]
add_build:
- "gcc_${{ target_platform }} 14.*"
- "gxx_${{ target_platform }} 14.*"
- "cuda-nvcc-tools ${{ cuda_buffer_cuda_version }}.*"
add_host:
- "cuda-version ${{ cuda_buffer_cuda_version }}.*"
- cuda-cudart-dev
- cuda-driver-dev
- "cuda-crt-dev_${{ target_platform }} ${{ cuda_buffer_cuda_version }}.*"
- if: aarch64
then: "arm-variant * sbsa"
add_run:
- "cuda-version >=${{ cuda_buffer_cuda_version }},<${{ (cuda_buffer_cuda_version | split('.'))[0] | int + 1 }}"
intra_process_demo:
add_host: ["${{ 'libgl-devel' if linux }}", "${{ 'libopengl-devel' if linux }}"]
# Depends on opencv with gui support, see https://github.com/ros2/demos/blob/8f361a1ece2daae54016959f3ea9ab2e7692ddbb/intra_process_demo/include/image_pipeline/image_view_node.hpp#L58
Expand Down
12 changes: 12 additions & 0 deletions patch/ros-rolling-torch-conversions.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -46,3 +46,3 @@
if(_torch_has_cuda AND CUDAToolkit_FOUND)
- target_link_libraries(${PROJECT_NAME} INTERFACE CUDA::cudart)
+ target_link_libraries(${PROJECT_NAME} INTERFACE CUDA::cudart CUDA::cuda_driver)
target_compile_definitions(${PROJECT_NAME} INTERFACE
@@ -68,3 +68,3 @@
ament_export_dependencies(
- libtorch_vendor rosidl_buffer tensor_msgs rmw rcutils)
+ libtorch_vendor Torch rosidl_buffer tensor_msgs rmw rcutils)
if(_torch_has_cuda AND CUDAToolkit_FOUND)
20 changes: 20 additions & 0 deletions pkg_additional_info.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ compressed_depth_image_transport:
additional_cmake_args: "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON"
console_bridge_vendor:
additional_cmake_args: "-DAMENT_VENDOR_POLICY=NEVER_VENDOR_IGNORE_SATISFIED_CHECK"
cuda_buffer:
# nvcc runs in the build environment; headers/libraries come from the host SDK.
# BIN_DIR prevents FindCUDAToolkit from replacing host includes with nvcc's build paths.
additional_cmake_args:
if: aarch64
then: "-DCUDAToolkit_BIN_DIR=$PREFIX/bin -DCUDAToolkit_NVCC_EXECUTABLE=$BUILD_PREFIX/bin/nvcc -DCUDAToolkit_INCLUDE_DIRECTORIES=$PREFIX/targets/sbsa-linux/include"
else: "-DCUDAToolkit_BIN_DIR=$PREFIX/bin -DCUDAToolkit_NVCC_EXECUTABLE=$BUILD_PREFIX/bin/nvcc -DCUDAToolkit_INCLUDE_DIRECTORIES=$PREFIX/targets/x86_64-linux/include"
cuda_buffer_backend:
additional_cmake_args:
if: aarch64
then: "-DCUDAToolkit_BIN_DIR=$PREFIX/bin -DCUDAToolkit_NVCC_EXECUTABLE=$BUILD_PREFIX/bin/nvcc -DCUDAToolkit_INCLUDE_DIRECTORIES=$PREFIX/targets/sbsa-linux/include"
else: "-DCUDAToolkit_BIN_DIR=$PREFIX/bin -DCUDAToolkit_NVCC_EXECUTABLE=$BUILD_PREFIX/bin/nvcc -DCUDAToolkit_INCLUDE_DIRECTORIES=$PREFIX/targets/x86_64-linux/include"
cyclonedds:
generate_dummy_package_with_run_deps:
dep_name: cyclonedds
Expand Down Expand Up @@ -202,6 +214,10 @@ gz_sim_vendor:
additional_cmake_args: "-DAMENT_VENDOR_POLICY=NEVER_VENDOR_IGNORE_SATISFIED_CHECK"
# Rebuild with qt6-main 6.11 (b29 was built against qt6-main 6.12, which pyqt6 6.11 can't install with).
build_number: 30
libtorch_vendor:
# CUDA architecture is only for Torch's compiler probe; no kernels are built here.
build_number: 31
additional_cmake_args: "-DFORCE_BUILD_VENDOR_PKG=OFF -DCMAKE_CUDA_ARCHITECTURES=75"
rqt_plot:
# Rebuild with qt6-main 6.11 (b29 was built against qt6-main 6.12, which pyqt6 6.11 can't install with).
build_number: 30
Expand Down Expand Up @@ -232,6 +248,10 @@ rviz_satellite:
rviz_visual_testing_framework:
# Rebuild with qt6-main 6.11 (b29 was built against qt6-main 6.12, which pyqt6 6.11 can't install with).
build_number: 30
torch_conversions:
# Rebuild the exported Torch/CUDA targets and the variant-specific dependencies.
build_number: 31
additional_cmake_args: "-DCMAKE_CUDA_ARCHITECTURES=75"
turtlesim:
# Rebuild with qt6-main 6.11 (b29 was built against qt6-main 6.12, which pyqt6 6.11 can't install with).
build_number: 30
6 changes: 6 additions & 0 deletions vinca.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ packages_skip_by_deps:

- if: not linux
then:
- cuda_buffer
- cuda_buffer_backend
- pendulum_control
- rttest
- tlsf
Expand All @@ -66,6 +68,8 @@ packages_remove_from_deps:

- if: not linux
then:
- cuda_buffer
- cuda_buffer_backend
- pendulum_control
- rttest
- tlsf
Expand Down Expand Up @@ -312,6 +316,7 @@ packages_select_by_deps:
- teleop
- teleop_tools
- toppra
- torch_conversions
- tracetools
- tracetools_launch
- tracetools_trace
Expand All @@ -333,6 +338,7 @@ packages_select_by_deps:
- apriltag_ros # Depends on camera_ros
- avt_vimba_camera
- camera_ros # Depends on libcamera that is only available on linux
- cuda_buffer_backend # Depends on CUDA
- libcamera
- livox_ros_driver2
- mavros # libmavconn currently fails to build on macOS and windows
Expand Down
10 changes: 9 additions & 1 deletion vinca_pinning.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ migrations:
- urdfdom6
- vtk970
pinning_overrides:
# Only CUDA buffer recipes use this key; do not expand the global compiler matrix.
cuda_buffer_cuda_version:
- '12.9'
- '13.0'
# Build commands provide their channels with `-c`, so omit the inherited
# conda-forge-pinning channel_sources value from the rendered configuration.
channel_sources: null
Expand All @@ -22,23 +26,28 @@ pinning_overrides:
- 2.28 # [linux and not riscv64]
- 2.39 # [linux and riscv64]
- 2.28 # [linux and (x86_64 or aarch64) and os.environ.get("CF_CUDA_ENABLED", "False") == "True"]
- 2.28 # [linux and (x86_64 or aarch64) and os.environ.get("CF_CUDA_ENABLED", "False") == "True"]
- 14.0 # [osx]
c_compiler_version:
- 15 # [linux]
- 21 # [osx]
- 14 # [linux and (x86_64 or aarch64) and os.environ.get("CF_CUDA_ENABLED", "False") == "True"]
- 14 # [linux and (x86_64 or aarch64) and os.environ.get("CF_CUDA_ENABLED", "False") == "True"]
cxx_compiler_version:
- 15 # [linux]
- 21 # [osx]
- 14 # [linux and (x86_64 or aarch64) and os.environ.get("CF_CUDA_ENABLED", "False") == "True"]
- 14 # [linux and (x86_64 or aarch64) and os.environ.get("CF_CUDA_ENABLED", "False") == "True"]
fortran_compiler_version:
- 15 # [unix]
- 5 # [win64]
- 22 # [win and arm64]
- 14 # [linux and (x86_64 or aarch64) and os.environ.get("CF_CUDA_ENABLED", "False") == "True"]
- 14 # [linux and (x86_64 or aarch64) and os.environ.get("CF_CUDA_ENABLED", "False") == "True"]
cuda_compiler_version:
- None
- 12.9 # [((linux and (x86_64 or aarch64)) or win64) and os.environ.get("CF_CUDA_ENABLED", "False") == "True"]
- 13.0 # [((linux and (x86_64 or aarch64)) or win64) and os.environ.get("CF_CUDA_ENABLED", "False") == "True"]
libzenohc:
- 1.10.1
libzenohcxx:
Expand Down Expand Up @@ -67,4 +76,3 @@ pinning_overrides:
- false
python_impl:
- cpython

Loading