OpenShift 4 整合 GPU 资源

2020-05-19  本文已影响0人  陈光辉_akr8s

背景

先拍个砖

  1. GPU Operator 目前不支持 vGPU,不要在这个方向浪费时间。
  2. 参考 NVIDIA 官方的操作文档,我没法验证成功,如有成功实现的大师,请多指教。

实现过程

  1. 部署 Node Feature Discovery,自动发现 OpenShift 节点的功能特性,这一步非常简单,不会遇到什么问题。
git clone https://github.com/openshift/cluster-nfd-operator.git
cd cluster-nfd-operator
git checkout release-4.3
make deploy
  1. 部署 Special Resource Operator
# 在 RHEL worker 节点上操作,开机即 disable 的方法 google 一下就有了。
modprobe -r nouveau
# 因为项目中用到的 .run 驱动脚本较大,而代码里是使用 curl 下载,在国内的网络会经常异常退出,所以改为本地地址,方便成功下载;或者将 curl 改成 wget。
git clone https://gitlab.com/nvidia/driver.git
cd driver

## RHEL 节点改 rhel7 目录下的 Dockerfile
vim rhel7/Dockerfile
## RHCOS 节点改 rhel8 目录下的 Dockerfile
vim rhel8/Dockerfile

## 修改的内容对比如下,注意匹配具体环境的驱动版本
20c20
< ARG DRIVER_VERSION=440.33.01
---
> ARG DRIVER_VERSION=440.56-grid
25c25
<     curl -fSsl -O $BASE_URL/$DRIVER_VERSION/NVIDIA-Linux-x86_64-$DRIVER_VERSION.run && \
---
>     curl -fSsl -O http://10.72.35.240/repos/rhcos/NVIDIA-Linux-x86_64-440.56-grid.run && \

修改完后将代码 push 到私有代码仓库,比如(https://github.com/xxxx/drivermaster.git)

git clone https://github.com/openshift-psap/special-resource-operator.git
cd special-resource-operator

## 修改 buildconfig 指向上一步我们修改 Dockerfile 的私有代码仓库,注意匹配驱动版本。
recipes/nvidia-gpu/manifests/0000-state-driver-buildconfig.yaml
29c29
<       uri: https://github.com/xxxx/drivermaster.git
---
>       uri: https://gitlab.com/nvidia/driver.git
36c36
<           value: "440.56-grid"
---
>           value: "440.33.01"

## 部署
PULLPOLICY=Always make deploy
oc -n nvidia-gpu nvidia-gpu-driver-container-rhel7-xxxxx
chcon -t container_file_t  /dev/nvidia*
  1. RHEL 节点如果想要手工部署,可以参考红帽的 KB

参考

Enabling and monitoring Nvidia GPUs on Openshift 4 for AI workloads

上一篇 下一篇

猜你喜欢

热点阅读