Skip to content

Commit 30b5023

Browse files
Add a new page for CUDA installation (#449)
* Add a new page for CUDA installation * Nvidia Samples -> CUDA Samples * Add CUDA samples to external links, add newline to EOF
1 parent 9e73961 commit 30b5023

File tree

1 file changed

+112
-0
lines changed
  • docs_versioned_docs/version-ros2jazzy/ros/installation

1 file changed

+112
-0
lines changed
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
---
2+
title: CUDA Installation
3+
sidebar_label: CUDA Installation
4+
sidebar_position: 8
5+
toc_min_heading_level: 2
6+
toc_max_heading_level: 4
7+
---
8+
9+
:::note
10+
11+
CUDA is a proprietary framework developed by Nvidia. To use CUDA you must have a compatible GPU from Nvidia.
12+
13+
:::
14+
15+
## Verify your GPU supports CUDA
16+
17+
To check that you have an Nvidia GPU, run the following command:
18+
19+
```bash
20+
lspci | grep -i nvidia
21+
```
22+
23+
Check that
24+
1. there is at least one graphics card listed, and
25+
2. that your GPU model [supports CUDA](https://developer.nvidia.com/cuda-gpus)
26+
27+
## Add Nvidia package sources
28+
29+
The easiest way to install CUDA is to add Nvidia's `apt` sources to your configuration. Run the following
30+
commands on the robot:
31+
32+
```bash
33+
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb
34+
sudo dpkg -i cuda-keyring_1.1-1_all.deb
35+
sudo apt-get update
36+
```
37+
38+
## Install CUDA
39+
40+
:::note
41+
42+
If you have a realtime Linux kernel installed (`PREEMPT_RT`) you may encounter errors when installing CUDA, as it
43+
does not officially support realtime kernels. To work around these errors add `IGNORE_PREEMPT_RT_PRESENCE=1`
44+
before any `apt` or `apt-get` commands, e.g.
45+
```
46+
sudo IGNORE_PREEMPT_RT_PRESENCE=1 apt-get install cuda-toolkit
47+
```
48+
49+
:::
50+
51+
To install CUDA, run the following command:
52+
```bash
53+
sudo apt-get install cuda-toolkit
54+
```
55+
56+
Optionally you can also install all GDS packages:
57+
```bash
58+
sudo apt-get install nvidia-gds
59+
```
60+
61+
Reboot the computer after installing the packages.
62+
63+
## Configure environment
64+
65+
:::note
66+
67+
At the time of writing, CUDA `12.9` is the latest version. The instructions below assume this version is
68+
being installed, but if you installed a different version you will need to modify the instructions
69+
accordingly.
70+
71+
:::
72+
73+
After rebooting, it is recommended to modify `$HOME/.bashrc` to update your environment variables to
74+
enable CUDA tools. Add the following to `.bashrc`:
75+
76+
```
77+
export PATH=/usr/local/cuda-12.9/bin${PATH:+:${PATH}}
78+
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda-12.9/lib64
79+
```
80+
81+
After modifying `.bashrc` either close the terminal and re-open it or run `source $HOME/.bashrc` to apply
82+
the changes.
83+
84+
### CUDA samples
85+
86+
You can optionally download and build the [CUDA samples](https://github.com/NVIDIA/cuda-samples) to verify
87+
your installation:
88+
89+
```bash
90+
git clone https://github.com/NVIDIA/cuda-samples.git
91+
cd cuda-samples
92+
mkdir build
93+
cd build
94+
cmake ..
95+
make
96+
```
97+
98+
Run the `deviceQuery` sample from the `build` directory to make sure CUDA can run correctly on your system:
99+
```bash
100+
./Samples/1_Utilities/deviceQuery/deviceQuery
101+
```
102+
You should see `Result = PASS` at the bottom of the output, indicating a CUDA-capable GPU was is
103+
detected and usable.
104+
105+
Refer the [CUDA samples documentation](https://github.com/NVIDIA/cuda-samples/tree/master?tab=readme-ov-file#samples-list)
106+
for details on additional sample programs.
107+
108+
## External Links
109+
110+
- [CUDA installation guide for Linux](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/)
111+
- [CUDA supported GPUs](https://developer.nvidia.com/cuda-gpus)
112+
- [CUDA samples](https://github.com/NVIDIA/cuda-samples)

0 commit comments

Comments
 (0)