|
| 1 | +--- |
| 2 | +title: KAI Integration |
| 3 | +sidebarTitle: KAI Integration |
| 4 | +layout: ../_core/DocsLayout |
| 5 | +category: Learn |
| 6 | +sublinks: Configuration, Example |
| 7 | +permalink: /learn/kai/ |
| 8 | +next: /learn/codeapi/ |
| 9 | +--- |
| 10 | + |
| 11 | +The **KAI Scheduler** lets you control how your algorithms use resources. |
| 12 | +It allows assigning algorithms to queues, limiting memory, and sharing GPUs between multiple algorithms to improve efficiency. |
| 13 | + |
| 14 | +## What is KAI Scheduler? |
| 15 | + |
| 16 | +**KAI Scheduler** is a Kubernetes component that manages how workloads are scheduled. |
| 17 | +It supports advanced features like GPU sharing (using fractions of a GPU) and queue prioritization — allowing multiple algorithms to use the same GPU efficiently. |
| 18 | + |
| 19 | +You can find the KAI Scheduler source code and installation guide [here](https://github.com/NVIDIA/KAI-Scheduler). |
| 20 | + |
| 21 | +> **Important:** |
| 22 | +> To use this feature, the KAI Scheduler **must be installed and configured** in your cluster. |
| 23 | +> It requires **Kubernetes version 1.24.x or higher**. |
| 24 | +> Make sure all **prerequisites** mentioned in the [KAI GitHub repository](https://github.com/NVIDIA/KAI-Scheduler) are met before enabling this integration. |
| 25 | +> If your algorithm tries to use more resources than assigned at runtime, the request will not be strictly limited. |
| 26 | +
|
| 27 | +--- |
| 28 | + |
| 29 | +## Configuration |
| 30 | + |
| 31 | +KAI-related settings are defined in the `kaiObject` section inside your algorithm specification. |
| 32 | +This section allows you to control how the algorithm interacts with the scheduler, including queue assignment, memory allocation, and GPU fraction usage. |
| 33 | + |
| 34 | +**Example of `kaiObject` configuration:** |
| 35 | + |
| 36 | +```json |
| 37 | +{ |
| 38 | + "kaiObject": { |
| 39 | + "queue": "gpu-queue", |
| 40 | + "memory": "512Mi", |
| 41 | + "fraction": 0.5 |
| 42 | + } |
| 43 | +} |
| 44 | +``` |
| 45 | + |
| 46 | +### **Properties** |
| 47 | + |
| 48 | +| Field | Type | Description | Required | |
| 49 | +| :----------- | :----- | :--------------------------------------------------------- | :------- | |
| 50 | +| **queue** | string | Name of the KAI queue to assign the algorithm to. | ✅ Yes | |
| 51 | +| **memory** | string | Memory limit for the algorithm (e.g., `"512Mi"`, `"1Gi"`). | ❌ No | |
| 52 | +| **fraction** | number | Fraction of GPU usage (e.g., `0.5` for 50% GPU). | ❌ No | |
| 53 | + |
| 54 | +--- |
| 55 | + |
| 56 | +## Example |
| 57 | + |
| 58 | +Below is a minimal algorithm configuration that includes `kaiObject`: |
| 59 | + |
| 60 | +```json |
| 61 | +{ |
| 62 | + "name": "gpu-fraction-algorithm", |
| 63 | + "algorithmImage": "docker.io/hkubedevtest/my-gpu-algo:latest", |
| 64 | + "cpu": 0.5, |
| 65 | + "mem": "512Mi", |
| 66 | + "gpu": 1, |
| 67 | + "kaiObject": { |
| 68 | + "queue": "gpu-queue", |
| 69 | + "memory": "512Mi", |
| 70 | + "fraction": 0.5 |
| 71 | + } |
| 72 | +} |
| 73 | +``` |
| 74 | + |
| 75 | +In this example: |
| 76 | + |
| 77 | +* The algorithm requests **one GPU** but sets a **fraction of 0.5**, allowing the GPU to be shared between two algorithms. |
| 78 | +* The **queue** defines which KAI-managed queue handles this algorithm. |
| 79 | +* The **memory** value specifies an optional memory limit. |
| 80 | + |
| 81 | +--- |
0 commit comments