# Enable GPU Support in SKS Nodes

Exoscale SKS allows you to run GPU-accelerated workloads, such as Machine
Learning (ML), data analytics, and video transcoding, on your cluster. In this
documentation, we will guide you through the steps to enable GPU support in
Exoscale SKS nodes.


## Prerequisites

As a prerequisite for the following documentation, you need:

- An Exoscale SKS cluster on the Pro plan.
- An organization with at least one GPU instance type authorized.
- Access to your cluster via `kubectl`.
- Basic Linux knowledge.

If you do not have access to an SKS cluster, follow the [Quick Start Guide]({{< ref "/product/compute/instances/quick-start/">}}).

SKS relies on nvidia-open package. The following Exoscale compute GPU profiles are supported by SKS through this driver:

- gpu3 (A40)
- gpua30
- gpu3080ti
- gpua5000
- gpurtx6000pro

> [!NOTE]
> Starting with Kubernetes 1.33.0, gpu2 profile is not compatible anymore with SKS as it relies on deprecated nvidia proprietary driver.

## Enabling GPU Support in SKS

> [!IMPORTANT] 
> If you are running nodes with Kubernetes version 1.31.12, 1.32.8, 1.33.4, or
> 1.34.0 or above, this section is **not relevant** anymore, and you can skip
> it. On those versions of SKS node OS, the device plugin is **already
> installed** as a system service directly communicating with the Kubelet
> process. If you previously deployed the NVIDIA Device Plugin DaemonSet, you
> can remove it once you upgraded all GPU nodes of your cluster to such
> versions.

To use GPUs in Kubernetes, the [NVIDIA Device Plugin][1] is required. The
NVIDIA Device Plugin is a [DaemonSet][2] that automatically enumerates the
number of GPUs on each node of the cluster and allows Pods to run on GPUs.

To enable GPU support in Exoscale SKS nodes, you need to deploy the following
DaemonSet:

```shell
kubectl create -f https://raw.githubusercontent.com/NVIDIA/k8s-device-plugin/main/deployments/static/nvidia-device-plugin.yml
```

> [!NOTE]
> This is a simple static DaemonSet meant to demonstrate the basic features of
> the `nvidia-device-plugin`.

[1]: https://github.com/NVIDIA/k8s-device-plugin/
[2]: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/


## Running and Testing GPU Jobs

Once nodes with GPU are ready, NVIDIA GPUs can be requested by a container
using the `nvidia.com/gpu` resource type:

```bash
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
  name: gpu-pod
spec:
  restartPolicy: Never
  containers:
    - name: cuda-container
      image: nvcr.io/nvidia/k8s/cuda-sample:vectoradd-cuda10.2
      resources:
        limits:
          nvidia.com/gpu: 1 # requesting 1 GPU
  tolerations:
  - key: nvidia.com/gpu
    operator: Exists
    effect: NoSchedule
EOF
```

```bash
kubectl logs gpu-pod
[Vector addition of 50000 elements]
Copy input data from the host memory to the CUDA device
CUDA kernel launch with 196 blocks of 256 threads
Copy output data from the CUDA device to the host memory
Test PASSED
Done
```

