GPU Partitioning Tutorial#

This tutorial shows you how to install, launch, and test isaac_ros_gpu_partitioning.

Quickstart#

Set Up Development Environment#

  1. Set up your development environment by following the instructions in getting started.

  2. (Optional) Install dependencies for any sensors you want to use by following the sensor-specific guides.

    Note

    We strongly recommend installing all sensor dependencies before starting any quickstarts. Some sensor dependencies require restarting the development environment during installation, which will interrupt the quickstart process.

Before continuing, verify that the system has an NVIDIA GPU that supports static NVIDIA CUDA Multi-Process Service (MPS) streaming multiprocessor (SM) partitioning. Stop other workloads that use CUDA MPS.

Verify that the installed MPS control binary reports version 13010 or later:

nvidia-cuda-mps-control -v

Build isaac_ros_gpu_partitioning#

  1. Activate the Isaac ROS environment:

    isaac-ros activate
    
  2. Install the prebuilt Debian package:

    sudo apt-get update
    
    sudo apt-get install -y ros-lyrical-isaac-ros-gpu-partitioning
    

Install and Verify the NVML Python Package#

The GPU partition manager imports pynvml from the NVIDIA nvidia-ml-py package. The binary package and rosdep install the python3-pynvml-pip-shim dependency automatically.

  1. Confirm that the Debian package is available:

    sudo apt-get update
    apt-cache policy python3-pynvml-pip-shim
    
  2. Install the package if it is not already installed:

    sudo apt-get install -y python3-pynvml-pip-shim
    
  3. Verify that the ROS Python interpreter can import pynvml:

    /usr/bin/python3 -c "import pynvml; print(pynvml.__file__)"
    

Run the Launch File#

  1. Run the example that creates GPU partitions from a YAML configuration:

    ros2 launch isaac_ros_gpu_partitioning partitioning_config.launch.py
    
  2. Open another terminal in the Isaac ROS environment:

    isaac-ros activate
    
  3. List the MPS partitions:

    export CUDA_MPS_PIPE_DIRECTORY=/tmp/nvidia-mps
    export CUDA_MPS_LOG_DIRECTORY=/tmp/nvidia-mps
    nvidia-cuda-mps-control lspart
    

The output lists each partition ID, allocated chunk count, and SM count.

Run the Tests#

  1. Run the launch tests with colcon:

    colcon test \
      --packages-select isaac_ros_gpu_partitioning \
      --event-handlers console_direct+
    
  2. Display the test results:

    colcon test-result --verbose
    

Each test starts MPS, creates one or more static SM partitions, loads a test component, and verifies the SM count reported by the component.

Stop the MPS Server#

  1. Stop the launch process with Ctrl+C.

  2. After all component containers exit, stop the MPS server:

    ros2 run isaac_ros_gpu_partitioning stop_cuda_mps.sh
    

Do not stop MPS while a component container uses a partition. The MPS control command waits for active clients to exit.