Building from Source
This document provides instructions for building TensorRT-LLM from source code on Linux
Fetching the Sources
1. Install git-lfs
git-lfsgit lfs installThis command prepares your local Git environment to handle large files by not storing them directly in the repository but as references.
This initial setup is crucial for working with large files efficiently and is required only once per repository to ensure that your Git configuration is optimized for LFS operations.
It replaces these large files with text pointers inside Git, while storing the file contents on a remote server like GitHub LFS.
2. Clone the TensorRT-LLM repository
To start working with the TensorRT-LLM, you first need to clone the repository to your local machine.
This can be done by executing the following command in your terminal:
git clone https://github.com/NVIDIA/TensorRT-LLM.gitThis command clones the entire repository from GitHub to your local directory, allowing you to work with the files, including large files that are handled efficiently through Git Large File Storage (LFS).
3. Move into the directory
cd TensorRT-LLM4. Initialise and  update the submodules
git submodule update --init --recursiveThis command performs several actions:
--initinitialises your local configuration file to include the submodules defined in the.gitmodulesfile of the repository.--updatefetches all the data from the project and checks out the appropriate commit as specified in your project.--recursiveensures that this command is run not only in the current module but also in any nested submodules, effectively updating all the submodules within the project.
5. Pulling Large Files with Git LFS
After initialising and updating your repository's submodules, you'll need to handle large files managed with Git Large File Storage (LFS).   This is where git lfs pull comes into play. 
Running this command will download the large files associated with the current branch from the remote repository, based on the tracking configurations established by Git LFS.
git lfs pullThis step ensures all the necessary assets, which are too large to be efficiently managed by standard Git operations, are properly downloaded and available for use.
It's a step before proceeding with operations that depend on these large files, such as building Docker images or executing large-scale data processing tasks.
Building TensorRT-LLM in One Step
Once Git LFS is set up and the necessary files are pulled, you can proceed to build the TensorRT-LLM Docker image.
This can be done with a single command:
make -C docker release_buildThis command builds a Docker image that contains everything you need to run TensorRT-LLM, simplifying the setup process and ensuring consistency across environments.
Optionally specify GPU architectures with
CUDA_ARCHS
The build process will take some time
Fire up the Docker Container
Once built, execute the Docker container using make -C docker release_run.
make -C docker release_runTo run as a local user instead of root, use
LOCAL_USER=1.
Last updated
Was this helpful?


