The IX device plugin for Kubernetes is a Daemonset that allows you to automatically:
The list of prerequisites for running the IX device plugin is described below:
make all
This will build the ix-device-plugin binary and ix-device-plugin image, see logging for more details.
The IX device plugin has a number of options that can be configured for it. These options can be configured via a config file when launching the device plugin. Here we explain what each of these options are and how to configure them in configmap.
# ix-config.yaml
apiVersion: v1
kind: ConfigMap
data:
ix-config: |-
version: "4.2.0"
flags:
splitboard: false
sharing:
timeSlicing:
replicas: 4
metadata:
name: ix-config
namespace: kube-system
kubectl create -f ix-config.yaml
Field |
Type |
Description |
---|---|---|
flags.splitboard |
boolean | Split GPU devices in every board(eg.BI-V150) if splitboard is true |
sharing.timeSlicing.replicas |
integer | Specifies the number of GPU time-slicing replicas for shared access |
Once you have configured the options above on all the GPU nodes in your cluster, you can enable GPU support by deploying the following Daemonset:
# ix-device-plugin.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: iluvatar-device-plugin
namespace: kube-system
labels:
app.kubernetes.io/name: iluvatar-device-plugin
spec:
selector:
matchLabels:
app.kubernetes.io/name: iluvatar-device-plugin
template:
metadata:
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ""
labels:
app.kubernetes.io/name: iluvatar-device-plugin
spec:
priorityClassName: "system-node-critical"
securityContext:
null
containers:
- name: iluvatar-device-plugin
securityContext:
capabilities:
drop:
- ALL
privileged: true
image: "ix-device-plugin:4.2.0"
imagePullPolicy: IfNotPresent
livenessProbe:
exec:
command:
- ls
- /var/lib/kubelet/device-plugins/iluvatar-gpu.sock
periodSeconds: 5
startupProbe:
exec:
command:
- ls
- /var/lib/kubelet/device-plugins/iluvatar-gpu.sock
periodSeconds: 5
resources:
{}
volumeMounts:
- mountPath: /var/lib/kubelet/device-plugins
name: device-plugin
- mountPath: /run/udev
name: udev-ctl
readOnly: true
- mountPath: /sys
name: sys
readOnly: true
- mountPath: /dev
name: dev
- name: ixc
mountPath: /ixconfig
volumes:
- hostPath:
path: /var/lib/kubelet/device-plugins
name: device-plugin
- hostPath:
path: /run/udev
name: udev-ctl
- hostPath:
path: /sys
name: sys
- hostPath:
path: /etc/udev/
name: udev-etc
- hostPath:
path: /dev
name: dev
- name: ixc
configMap:
name: ix-config
kubectl create -f ix-device-plugin.yaml
GPU can be exposed to a pod by adding iluvatar.com/gpu
to the pod definition, and you can restrict the GPU resource by adding resources.limits
to the pod definition.
$ cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
name: corex-example
spec:
containers:
- name: corex-example
image: corex:4.0.0
command: ["/usr/local/corex/bin/ixsmi"]
args: ["-l"]
resources:
limits:
iluvatar.com/gpu: 1 # requesting 1 GPUs
EOF
kubectl logs corex-example
+-----------------------------------------------------------------------------+
| IX-ML: 4.0.0 Driver Version: 4.1.0 CUDA Version: N/A |
|-------------------------------+----------------------+----------------------|
| GPU Name | Bus-Id | Clock-SM Clock-Mem |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 Iluvatar BI-V150S | 00000000:8A:00.0 | 500MHz 1600MHz |
| 0% 33C P0 N/A / N/A | 114MiB / 32768MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Process name Usage(MiB) |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+
The IX device plugin allows splitting one GPU board into multiple GPU Devices through a set of extended options in its configuration file.
The extended options for splitting board can be seen below:
version: "4.2.0"
flags:
splitboard: false
That is, flags.splitboard
, a boolean flag can now be specified. If this flag is set to true, the plugin will split the GPU board into multiple GPUs and
kubelet will advertise multiple iluvatar.com/gpu
resources to Kubernetes instead of 1 for one GPU board. Otherwise, the plugin will advertise only 1 iluvatar.com/gpu
resource for one GPU board.
For example:
version: "4.2.0"
flags:
splitboard: true
If this configuration were applied to a node with 1 GPUs(eg. Bi-V150, which has 2 GPU chips on it) on it, the plugin
would now advertise 2 iluvatar.com/gpu
resources to Kubernetes instead of 1.
$ kubectl describe node
...
Capacity:
iluvatar.com/gpu: 2
...
The IX device plugin allows oversubscription of GPUs through a set of extended options in its configuration file.
The extended options for sharing using time-slicing can be seen below:
version: "4.2.0"
sharing:
timeSlicing:
replicas: <num-replicas>
...
That is, sharing.timeSlicing.replicas
, a number of replicas can now be specified. These replicas represent the number of shared accesses that will be granted for a GPU.
For example:
version: "4.2.0"
flags:
splitboard: false
sharing:
timeSlicing:
replicas: 4
If this configuration were applied to a node with 2 GPUs on it, the plugin
would now advertise 8 iluvatar.com/gpu
resources to Kubernetes instead of 2.
$ kubectl describe node
...
Capacity:
iluvatar.com/gpu: 8
...
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。