Skip to content

Commit a97f0e6

Browse files
Added instructions to install CUDA on a realtime kernel
1 parent c11fe35 commit a97f0e6

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,32 @@ docker compose run --rm franky-build run-tests # To run the tests
244244
docker compose run --rm franky-build build-wheels # To build wheels for all supported python versions
245245
```
246246

247+
### Can I use CUDA jointly with Franky?
248+
249+
Yes. However, you need to set `IGNORE_PREEMPT_RT_PRESENCE=1` during the installation and all subsequent updates of the CUDA drivers on the real-time kernel.
250+
251+
First, make sure that you have rebooted your system after installing the real-time kernel.
252+
Then, add `IGNORE_PREEMPT_RT_PRESENCE=1` to `/etc/environment`, call `export IGNORE_PREEMPT_RT_PRESENCE=1` to also set it in the current session and follow the instructions of Nvidia to install CUDA on your system.
253+
254+
If you are on Ubuntu, you can also use [this](tools/install_cuda_realtime.bash) script to install CUDA on your real-time system:
255+
```bash
256+
# Download the script
257+
wget https://raw.githubusercontent.com/timschneider42/franky/master/tools/install_cuda_realtime.bash
258+
259+
# Inspect the script to ensure it does what you expect
260+
261+
# Make it executable
262+
chmod +x install_cuda_realtime.bash
263+
264+
# Execute the script
265+
./install_cuda_realtime.bash
266+
```
267+
268+
Alternatively, if you are a cowboy and do not care about security, you can also use this one-liner to directly call the script without checking it:
269+
```bash
270+
bash <(wget -qO- https://raw.githubusercontent.com/timschneider42/franky/master/tools/install_cuda_realtime.bash)
271+
```
272+
247273
## 📚 Tutorial
248274

249275
Franky comes with both a C++ and Python API that differ only regarding real-time capability.

tools/install_cuda_realtime.bash

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
# Author: Tim Schneider <tim@robot-learning.de>
3+
4+
# Installs CUDA drivers on a fresh Ubuntu with realtime kernel. If other CUDA drivers are already installed, please remove them prior
5+
# to running this script, e.g. with
6+
# sudo apt purge 'nvidia-*'
7+
# sudo apt autoremove
8+
# sudo apt autoclean
9+
10+
# Install cuda drivers following https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#ubuntu
11+
# Install linux headers for your kernel version
12+
sudo apt-get -y install linux-headers-$(uname -r) &&
13+
14+
# Delete old Nvidia key
15+
sudo apt-key del 7fa2af80;
16+
17+
# Install new Nvidia key
18+
ubuntu_version=$(lsb_release -r | awk '{print $2}' | tr -d '.')
19+
arch=$(uname -m)
20+
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu${ubuntu_version}/$arch/cuda-keyring_1.1-1_all.deb -P /tmp/ &&
21+
if sudo dpkg -i /tmp/cuda-keyring_1.1-1_all.deb; then
22+
rm /tmp/cuda-keyring_1.1-1_all.deb
23+
else
24+
rm /tmp/cuda-keyring_1.1-1_all.deb
25+
exit 1
26+
fi
27+
28+
# Set IGNORE_PREEMPT_RT_PRESENCE persistently
29+
grep -qxF 'IGNORE_PREEMPT_RT_PRESENCE=1' /etc/environment || echo 'IGNORE_PREEMPT_RT_PRESENCE=1' | sudo tee -a /etc/environment > /dev/null &&
30+
31+
# Install cuda drivers
32+
sudo apt-get update &&
33+
34+
# Here we deviate from the online guide by telling the installer to ignore the presence of the realtime kernel
35+
sudo IGNORE_PREEMPT_RT_PRESENCE=1 apt-get -y install cuda-drivers &&
36+
37+
echo "Please reboot the system now."

0 commit comments

Comments
 (0)