GPU Partitioning Tutorial#
This tutorial shows you how to install, launch, and test
isaac_ros_gpu_partitioning.
Quickstart#
Set Up Development Environment#
Set up your development environment by following the instructions in getting started.
(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#
Activate the Isaac ROS environment:
isaac-ros activateInstall the prebuilt Debian package:
sudo apt-get update
sudo apt-get install -y ros-lyrical-isaac-ros-gpu-partitioning
Clone the Isaac ROS Common repository under
${ISAAC_ROS_WS}/src:cd ${ISAAC_ROS_WS}/src && \ git clone -b release-5.0 https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_common.git isaac_ros_common
Activate the Isaac ROS environment:
isaac-ros activateUse
rosdepto install the package dependencies:sudo apt-get update
rosdep update && \ rosdep install --from-paths \ ${ISAAC_ROS_WS}/src/isaac_ros_common/isaac_ros_gpu_partitioning \ --ignore-src -y
Build the package from source:
cd ${ISAAC_ROS_WS} && \ colcon build --symlink-install \ --packages-up-to isaac_ros_gpu_partitioning \ --base-paths \ ${ISAAC_ROS_WS}/src/isaac_ros_common/isaac_ros_gpu_partitioning
Source the ROS workspace:
Note
Repeat this step in every terminal in the Isaac ROS environment.
source install/setup.bash
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.
Confirm that the Debian package is available:
sudo apt-get update apt-cache policy python3-pynvml-pip-shim
Install the package if it is not already installed:
sudo apt-get install -y python3-pynvml-pip-shim
Verify that the ROS Python interpreter can import
pynvml:/usr/bin/python3 -c "import pynvml; print(pynvml.__file__)"
Run the Launch File#
Run the example that creates GPU partitions from a YAML configuration:
ros2 launch isaac_ros_gpu_partitioning partitioning_config.launch.py
Open another terminal in the Isaac ROS environment:
isaac-ros activateList 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#
Run the launch tests with
colcon:colcon test \ --packages-select isaac_ros_gpu_partitioning \ --event-handlers console_direct+
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#
Stop the launch process with Ctrl+C.
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.