Enabling Application Machines with GPUs in On-Premise Kubernetes Deployments

Prev Next

This procedure sets up an application machine with a GPU to run ORCA (Optical Reasoning and Cognition Agent) VLMs in an on-premise Kubernetes deployment of Hyperscience. It is for system administrators.

To use ORCA VLMs, your instance needs at least 1 application machine that has both a GPU (graphics processing unit) and a CPU (central processing unit).

Availability

Application machines with GPUs are supported in v41 and later, and only for ORCA use cases.

Prerequisites

On bare-metal clusters, complete the following checks before stage 1.

Verify the GPU hardware

Make sure that your GPU meets the hardware requirements in Kubernetes Installation Overview.

Verify that your GPU supports CUDA

CUDA is a parallel computing platform and programming model created by NVIDIA. To check whether your GPU supports CUDA, run the following command:

lspci | grep -i nvidia

For more information, see NVIDIA’s CUDA GPUs - Compute Capability and NVIDIA CUDA Installation Guide for Linux.

Verify that you have a supported version of Linux

Follow the instructions in NVIDIA’s NVIDIA CUDA Installation Guide for Linux to check your version of Linux. Then, make sure your Linux version is supported by the latest CUDA Toolkit by reviewing NVIDIA’s NVIDIA CUDA Toolkit Release Notes.

Verify that gcc is installed

The CUDA Toolkit requires the gcc compiler. To check that gcc is installed, follow the instructions in NVIDIA’s NVIDIA CUDA Installation Guide for Linux.

Verify the kernel headers and development packages

The CUDA driver requires the kernel headers and development packages for the kernel version that your system runs. It requires them when you install the driver and whenever the driver is rebuilt. For example, if your system runs kernel version 3.17.4-301, you need the 3.17.4-301 kernel headers and development packages.

To install them, or to confirm that they are installed, run the following command on Ubuntu:

apt-get install linux-headers-$(uname -r)

For the commands for other Linux distributions, see NVIDIA’s NVIDIA CUDA Installation Guide for Linux.

1. Set up the GPU nodes

For ORCA to use the GPU, the Kubernetes nodes must have the correct drivers or AMIs, and the containers must be able to access the GPU. Follow the section for your platform.

Bare metal

The Hyperscience images include the CUDA Toolkit. The CUDA drivers on the host OS must be compatible with that toolkit version. For toolkit and driver versions, see NVIDIA’s NVIDIA CUDA Toolkit Release Notes.

CUDADriversAndToolkits.png

Remove existing CUDA drivers

Remove any CUDA drivers that are installed on the system. For example, on Ubuntu, run the following command:

apt-get clean; apt-get update; apt-get purge -y cuda*; apt-get purge -y nvidia-*; apt-get -y autoremove

Adjust the command for your Linux distribution.

Install nvidia-container-toolkit or nvidia-docker2

Prepare the Docker host so that it can expose the GPU to containers. Containers share the host’s kernel, but they cannot access the system packages that are installed on the host. Without this preparation, containers do not have the device drivers that interface with the GPU.

(Ubuntu 21 and later) Install nvidia-container-toolkit.

To add support for NVIDIA GPUs, install the NVIDIA Container Toolkit:

distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
       && curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
       && curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | \
             sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
             tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
       apt-get update && apt-get install -y nvidia-container-toolkit

(Ubuntu 20) Install nvidia-docker2.

To add support for NVIDIA GPUs, install nvidia-docker2:

distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
        && curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - \
        && curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
        apt-get update && apt-get install -o Dpkg::Options::="--force-confold"   -y nvidia-docker2

Configure the container runtime

Run the following nvidia-ctk command to configure the container runtime. The command updates the /etc/docker/daemon.json file on the host so that Docker can use the NVIDIA Container Runtime.

nvidia-ctk runtime configure --runtime=docker
systemctl restart docker

Open the /etc/docker/daemon.json file and confirm that Docker uses the NVIDIA Container Runtime. When new containers start, the system injects the GPU device connections.

Install the latest CUDA drivers

Run the following command to install the latest CUDA drivers:

distribution=$(. /etc/os-release;echo $ID$VERSION_ID | sed -e 's/\.//g')
wget https://developer.download.nvidia.com/compute/cuda/repos/$distribution/x86_64/cuda-keyring_1.0-1_all.deb
dpkg -i cuda-keyring_1.0-1_all.deb
apt-get update && apt-get -y install cuda-drivers

We recommend the latest CUDA driver. For the minimum driver version that your version of Hyperscience requires, see Kubernetes Installation Overview.

Deploy the nvidia-device-plugin DaemonSet

To deploy the DaemonSet, follow the instructions in the “Enabling GPU Support in Kubernetes” section of the NVIDIA device plugin for Kubernetes documentation in GitHub.

AWS EKS

  1. Use the pre-built GPU AMIs that AWS provides with all the necessary drivers installed. For more information, see the “Amazon EKS optimized accelerated Amazon Linux AMIs” section of AWS’s Amazon EKS optimized Amazon Linux AMIs. For a list of pre-built GPU AMIs by Kubernetes version, see Amazon EKS AMI’s Releases list in GitHub.

  2. Deploy nvidia-plugin-daemonset by following the instructions in the “Enabling GPU Support in Kubernetes” section of the NVIDIA device plugin for Kubernetes documentation in GitHub.

Azure AKS

To set up GPUs for Azure AKS, follow the steps in Microsoft’s Use GPUs for compute-intensive workloads on Azure Kubernetes Service (AKS). These steps set up the GPU nodes and install the nvidia-device-plugin DaemonSet.

Google GKE

Follow Google Cloud’s Run GPUs in GKE Standard node pools to set up GPU node pools with drivers and the DaemonSet.

Checkpoint: The GPU nodes have CUDA drivers, and the NVIDIA device plugin DaemonSet is deployed.

2. Configure Hyperscience to schedule ORCA on the GPU nodes

You do not need to run any commands on the GPU nodes. In Kubernetes deployments, the HyperOperator starts the ORCA block automatically when tasks for it are queued. Each ORCA pod requests 1 GPU (nvidia.com/gpu: 1).

  • For ORCA 1.0, the block is VISION_LANGUAGE_MODEL_GPU.

  • For any other ORCA base model, including ORCA 2 and ORCA PubSec, the block is VISION_LANGUAGE_MODEL_GPU_2.

Set the following values in your Helm values.yaml file. For more information about the file, see Helm Chart.

  1. Target the GPU nodes. Set blocks.gpu.nodeAffinity or blocks.gpu.nodeSelector. By default, GPU blocks are scheduled only on nodes labeled hs-component=platform. Label your GPU nodes, or override the affinity.

  2. Add tolerations. If your GPU nodes are tainted, set blocks.gpu.tolerations.

  3. (Optional) Scale the ORCA block to zero when idle. Set blocks.autoscaling.enabled: true. Then, under blocks.env, set BLOCK_VISION_LANGUAGE_MODEL_GPU_2_AUTOSCALE_MIN: "0". After an idle period, the first task waits for the pod to start and the model to load. To keep the block warm, set the value to "1", or use blocks.autoscaling.schedules.

  4. Set the NVIDIA driver path. If your NVIDIA drivers are in a non-standard path, set nvidiaBasePath.

If Hyperscience is already installed, run helm upgrade to apply the changes.

Checkpoint: After an ORCA task is queued, the ORCA block pod is Running on a GPU node.

Next steps

To install an ORCA base model, see Installing ORCA VLMs.