Setting Up The Build Environment for TensorRT OSS on Ubuntu 20.04 with cuda-12.3.2

We’re here to guide you through the process step by step.

First things first: make sure your system is up to date with the latest updates and patches. You can do this by running `sudo apt update` followed by `sudo apt upgrade`. This will download any available updates and install them automatically.

Next, we need to add the NVIDIA repository to our package manager so that we can easily install cuda-12.3.2 (and other nvidia packages). To do this, run:

# Add the NVIDIA repository to the package manager
sudo add-apt-repository ppa:graphics-drivers/ppa
# Update the package lists to include the newly added repository
sudo apt update
# Upgrade any available packages to their latest versions
sudo apt upgrade

This will add the graphics-drivers PPA to our system and download any available updates. Once that’s done, we can install cuda-12.3.2 by running:

# This line adds the graphics-drivers PPA to our system
sudo add-apt-repository ppa:graphics-drivers/ppa

# This line updates the system to download any available updates
sudo apt update

# This line installs the nvidia-cuda-toolkit package with version 12.3.2-4ubuntu1~focal
sudo apt install nvidia-cuda-toolkit=12.3.2-4ubuntu1~focal

This will download and install the latest version of cuda (as of this writing) along with all its dependencies. If you’re using a different version of Ubuntu or have already installed cuda, adjust the package name accordingly.

Now that we have cuda installed, let’s move on to TensorRT OSS. To install it, run:

# Download the latest version of TensorRT for Ubuntu 20.04 and save it as a tar.gz file
wget https://developer.nvidia.com/compute/machine-learning/tensorrt/secure/downloads/latest/TensorRT_for_Ubuntu_20.04-1.7.3_linux.tar.gz

# Extract the downloaded file
tar -xzf TensorRT_for_Ubuntu_20.04-1.7.3_linux.tar.gz

# Move the extracted folder to the /opt/nvidia directory
sudo mv tensorrt-1.7.3 /opt/nvidia

# Change directory to the newly moved folder
cd /opt/nvidia/tensorrt-1.7.3

# Run the installation script with the --no-cuda-toolkit flag to install TensorRT without cuda
sudo ./install.sh --no-cuda-toolkit # this will install TensorRT without cuda, which is what we want for OSS

This will download the latest version of TensorRT (as of this writing) and extract it to a folder called `tensorrt-1.7.3`. We then move that folder into our `/opt/nvidia` directory and change into it. Finally, we run the install script with the `–no-cuda-toolkit` flag to avoid any conflicts with cuda (since we already installed it earlier).

You’re now ready to use TensorRT OSS on Ubuntu 20.04 with cuda-12.3.2.

SICORPS