> ## Documentation Index
> Fetch the complete documentation index at: https://docs.edgeimpulse.com/llms.txt
> Use this file to discover all available pages before exploring further.

# NVIDIA GPU

> Run TensorRT-accelerated Edge Impulse models on x86_64 Linux hosts with NVIDIA workstation and datacenter GPUs, using an EIM file or a Docker container.

Edge Impulse supports NVIDIA workstation and datacenter GPUs on x86\_64 Linux hosts. You can run your impulse on the GPU in two ways:

* **EIM file:** a Linux executable that runs on the host with TensorRT and CUDA installed.
* **Docker container:** an inference container that includes CUDA and TensorRT, with an HTTP interface.

> [!TIP]
>
> Running on an NVIDIA Jetson or Jetson Orin device? See [NVIDIA Jetson](https://docs.edgeimpulse.com/hardware/boards/nvidia-jetson.md).

## Requirements

* An x86\_64 Linux host with an NVIDIA GPU that has one of the following compute capabilities: 7.5, 8.0, 8.6, 8.9, 9.0, 10.0, 10.3, 12.0, or 12.1. See [CUDA GPUs](https://developer.nvidia.com/cuda/gpus) to find your GPU's compute capability.
* Ubuntu 22.04 or 24.04. For the EIM file, other x86\_64 Linux distributions also work if they provide `glibc 2.35` or later and `GLIBCXX_3.4.30` or later.
* An impulse with an unquantized (float32) model. Quantized (int8) models don't run on the GPU.

> [!NOTE]
>
> **Instruction set architectures**
>
> If you're not sure about your instruction set architecture, run:
>
> ```text theme={"system"}
> $ uname -m
> x86_64
> ```

## Installing dependencies

### System packages

Install the build tools and `wget`:

```bash theme={"system"}
sudo apt update
sudo apt install -y wget build-essential
```

### NVIDIA driver

Both options need the NVIDIA driver on the host. The commands below add NVIDIA's CUDA 13.2 local repository, which also provides the driver, then install the driver:

> [tab] Ubuntu 22.04
>
> ```bash theme={"system"}
> wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin
> sudo mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600
> wget https://developer.download.nvidia.com/compute/cuda/13.2.0/local_installers/cuda-repo-ubuntu2204-13-2-local_13.2.0-595.45.04-1_amd64.deb
> sudo dpkg -i cuda-repo-ubuntu2204-13-2-local_13.2.0-595.45.04-1_amd64.deb
> sudo cp /var/cuda-repo-ubuntu2204-13-2-local/cuda-*-keyring.gpg /usr/share/keyrings/
> sudo apt update
> sudo apt install -y cuda-drivers
> sudo reboot
> ```

> [tab] Ubuntu 24.04
>
> ```bash theme={"system"}
> wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-ubuntu2404.pin
> sudo mv cuda-ubuntu2404.pin /etc/apt/preferences.d/cuda-repository-pin-600
> wget https://developer.download.nvidia.com/compute/cuda/13.2.0/local_installers/cuda-repo-ubuntu2404-13-2-local_13.2.0-595.45.04-1_amd64.deb
> sudo dpkg -i cuda-repo-ubuntu2404-13-2-local_13.2.0-595.45.04-1_amd64.deb
> sudo cp /var/cuda-repo-ubuntu2404-13-2-local/cuda-*-keyring.gpg /usr/share/keyrings/
> sudo apt update
> sudo apt install -y cuda-drivers
> sudo reboot
> ```

To install a specific driver version or kernel module flavor, see NVIDIA's [driver installation guide](https://docs.nvidia.com/datacenter/tesla/driver-installation-guide/latest/#switching-between-driver-module-flavors). For other x86\_64 Linux distributions, see the [CUDA 13.2 downloads](https://developer.nvidia.com/cuda-13-2-0-download-archive?target_os=Linux\&target_arch=x86_64).

After the host restarts, confirm the driver can see the GPU:

```bash theme={"system"}
nvidia-smi
```

### CUDA and TensorRT (EIM file only)

The EIM file needs CUDA 13.x and TensorRT 10.x on the host. The Edge Impulse build uses CUDA 13.2 and TensorRT 10.16.1. The EIM file doesn't use cuDNN, so you don't need to install it.

The local repository you added in the previous step also provides the CUDA 13.2 toolkit. To install it, run:

```bash theme={"system"}
sudo apt install -y cuda-toolkit-13-2
```

Then add CUDA to your environment. Add these lines to your `~/.bashrc` to keep them across sessions:

```bash theme={"system"}
export PATH=/usr/local/cuda-13.2/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-13.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
```

To install TensorRT 10.16.1 for CUDA 13.2, run:

```bash theme={"system"}
wget https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/10.16.1/tars/TensorRT-10.16.1.11.Linux.x86_64-gnu.cuda-13.2.tar.gz
tar -xf TensorRT-10.16.1.11.Linux.x86_64-gnu.cuda-13.2.tar.gz
sudo cp -a TensorRT-10.16.1.11/lib/*.so* /usr/lib/x86_64-linux-gnu/
```

### Edge Impulse Linux CLI (EIM file only)

To connect the host to Edge Impulse and run an EIM file, install the Linux CLI:

```bash theme={"system"}
sudo apt install -y curl
curl -sL https://deb.nodesource.com/setup_22.x | sudo bash -
sudo apt install -y gcc g++ make build-essential nodejs sox gstreamer1.0-tools gstreamer1.0-plugins-good gstreamer1.0-plugins-base gstreamer1.0-plugins-base-apps
sudo npm install edge-impulse-linux -g --unsafe-perm
```

> [!WARNING]
>
> Edge Impulse requires Node.js 20.x or later. Older versions can cause installation issues or runtime errors.

### NVIDIA Container Toolkit (Docker container only)

The other way to run your impulse is with Edge Impulse's NVIDIA GPU (x86) Docker
container also referred to as inference container. This inference container includes CUDA, TensorRT and the edge impulse linux CLI, so you don't need to install them on the host.
To pass the GPUs (from the host) through to the inference container, install the [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html) on the host.

## Connecting to Edge Impulse

> [!NOTE]
>
> You only need this step to collect data from the host into your project. On a server, you're more likely to collect data on other devices and use the host for inference only. In that case, skip to [Deploying back to device](#deploying-back-to-device).

With all software set up, connect your camera or microphone to the host and run:

```bash theme={"system"}
edge-impulse-linux
```

This starts a wizard that asks you to log in and choose an Edge Impulse project. To switch projects, run the command with `--clean`. To connect a different sensor, see [Next steps](#next-steps-building-a-machine-learning-model).

### Verifying that your device is connected

To verify the connection, go to [your Edge Impulse project](https://studio.edgeimpulse.com/studio/profile/projects) and click **Devices**. The host is listed there.

![Devices page listing a Linux device connected to the Edge Impulse project](https://mintcdn.com/edgeimpulse/UpfKnXz6Rfn5wm4E/.assets/images/edge-impulse-devices-page-showing-a-connected-linux.png?fit=max\&auto=format\&n=UpfKnXz6Rfn5wm4E\&q=85\&s=94dccac47b7027c2bcf8a30e5353e097)

Device connected to Edge Impulse.

## Next steps: building a machine learning model

With everything set up, you can build your first machine learning model with these tutorials:

* [Keyword spotting](https://docs.edgeimpulse.com/tutorials/end-to-end/keyword-spotting.md)
* [Sound recognition](https://docs.edgeimpulse.com/tutorials/end-to-end/sound-recognition.md)
* [Image classification](https://docs.edgeimpulse.com/tutorials/end-to-end/image-classification.md)
* [Object detection](https://docs.edgeimpulse.com/tutorials/end-to-end/object-detection-bounding-boxes.md)
* [Object detection with centroids (FOMO)](https://docs.edgeimpulse.com/tutorials/end-to-end/object-detection-centroids.md)

Looking to connect different sensors? Our [Linux SDK](https://docs.edgeimpulse.com/tools/libraries/sdks/inference/linux.md) lets you send data from any sensor and any programming language into Edge Impulse, with examples in Node.js, Python, Go, and C++.

## Deploying back to device

### Using an EIM file

On the **Deployment** page in Edge Impulse Studio, select **NVIDIA GPU (x86)** and build. Studio produces an `.eim` file that runs inference on the GPU with TensorRT. Copy it to the host, then run:

```bash theme={"system"}
chmod u+x downloaded-model.eim
edge-impulse-linux-runner --model-file downloaded-model.eim
```

> [!NOTE]
>
> Running `edge-impulse-linux-runner` without `--model-file` downloads the CPU build for x86\_64 Linux, which doesn't use the GPU.

On the first run, TensorRT optimizes the model for your GPU before it starts classifying. This can take several minutes. For example, a YOLOv5 model took about 85 seconds to load on an NVIDIA L4.

Our [Linux SDK](https://docs.edgeimpulse.com/tools/libraries/sdks/inference/linux.md) has examples that show how to integrate the `.eim` file with your favorite programming language.

#### Image model?

If you have an image model, you can see what your device sees from a browser on the same network. Find the "Want to see a feed of the camera and live classification in your browser" message in the console, then open the URL it shows. The page displays the camera feed and the classification results.

#### Checking an EIM file

To print information about an `.eim` file, such as its input shape, labels, and parameters, run:

```bash theme={"system"}
./downloaded-model.eim --print-info
```

Here is an excerpt of the output for a YOLOv5 object detection model:

```json theme={"system"}
{
    "inferencing_engine": {
        "engine_type": 6,
        "properties": []
    },
    "model_parameters": {
        "image_input_height": 320,
        "image_input_width": 320,
        "image_resize_mode": "squash",
        "inferencing_engine": 6,
        "label_count": 1,
        "labels": [
            "vehicle"
        ],
        "model_type": "object_detection",
        "thresholds": [
            {
                "id": 9,
                "min_score": 0.5,
                "type": "object_detection"
            }
        ]
    },
    "success": true
}
```

### Using the Docker container

The container includes the runtime dependencies for the EIM file. The host only needs a supported GPU, the [NVIDIA driver](#nvidia-driver), and the [NVIDIA Container Toolkit](#nvidia-container-toolkit-docker-container-only).

On the **Deployment** page, select **Docker container (NVIDIA GPU (x86))**. Studio shows the `docker run` command to start the container, with your project's API key filled in. For example, this command runs your model with an HTTP server on port 1337:

```bash theme={"system"}
docker run --rm -it \
    -p 1337:1337 \
    --runtime=nvidia \
    --gpus all \
    public.ecr.aws/g7a8t7v6/inference-container-nvidia:latest \
        --api-key ei_0d... \
        --run-http-server 1337
```

The `--runtime=nvidia --gpus all` flags pass the GPUs to the container. See [Docker container](https://docs.edgeimpulse.com/hardware/deployments/run-docker.md) for how to call the HTTP interface.

To run a quantized model on the CPU instead, use the standard **Docker container** deployment.

## Troubleshooting

## Further resources

* [Run Linux EIM](https://docs.edgeimpulse.com/hardware/deployments/run-linux-eim.md)
* [Docker container](https://docs.edgeimpulse.com/hardware/deployments/run-docker.md)
* [Linux CLI](https://docs.edgeimpulse.com/tools/clis/edge-impulse-linux-cli.md)
* [NVIDIA Jetson](https://docs.edgeimpulse.com/hardware/boards/nvidia-jetson.md)
