Tanzu 学习系列|一文了解 TKG 如何使用 GPU 资源池

来源:城信科技

随着科技进步和产业变革的加速演进,人工智能(AI)已经成为兵家必争之地。在政府、学术机构、企业等各个层面,AI 都受到高度重视,其在学术研究、技术创新、人才教育等方面的发展都呈现全新发展态势。作为 AI 市场中的重要组成,以 GPU 技术为主的 AI 加速市场也得到了快速的发展,与此同时,由于 GPU 硬件价格昂贵,传统使用 GPU 算力的独占式使用方式缺乏灵活性和经济性,同时随着云原生技术的发展,细粒度,快速交付切分 GPU 算力需求,急需经济高效 GPU 算力池化方案。

VMware 作为虚拟化与云原生技术的领导者,在 GPU 算力资源池化领域也是一直处于领先地位,针对不同使用场景有对应的 GPU 资源池化方案。

前两种方案当前客户采用比较多,读者都比较熟悉,本文重点介绍 VMware vSphere Bitfusion GPU 池化方案。

VMware vSphere Bitfusion 是什么?

​VMware vSphere Bitfusion 是 vSphere 7 的一个强大功能,通过网络提供远程 GPU 池。Bitfusion 可虚拟化硬件加速器(例如图形处理单元 (GPU)),以提供可通过网络访问的共享资源池,从而支持人工智能 (AI) 和机器学习 (ML) 工作负载。Bitfusion 使得 GPU 可以像计算资源一样被抽象、分区、自动化和共享。帮助客户构建数据中心级 AI 算力资源池,使用户应用无需修改就能透明地共享和使用数据中心内任何服务器之上的 AI 加速器。

可以在裸机、虚拟机或容器中部署 vSphere Bitfusion 客户端,以便在数据中心环境中使用。通过 vcenter vSphere Bitfusion 可以监控网络中所有 GPU 服务器的运行状况、利用率、效率和可用性。此外,还可以监控客户端对 GPU 的使用情况并分配配额和时间限制。

vSphere Bitfusion 需要利用到 NVIDIA 的 CUDA 框架,CUDA 是 AI/ML 程序的开发运行框架,Bitfusion 主要是实现 CUDA 的远程调用。可与 TensorFlow 和 PyTorch 、TensorRT,PaddlePaddle 等人工智能框架配合使用。

VMware vSphere Bitfusion 架构图

Bitfusion Server 需要部署带有 GPU 卡的 vSphere ESXi 主机上,GPU 卡通过直通模式分配给 Bitfusion server ;

需要消费 GPU 资源的 AI/ML 应用和 TensorFlow 等框架等可以部署在 VM,物理机器,容器环境,同时安装 Bitfusion 客户端,Bitfusion 客户端通过低延迟网络实现 GPU 的远程切分调用;

Bitfusion server 和 Bitfusion 客户端之间的低延迟网络,建议与管理网络分开,可以支持 TCP/IP,RoCE 或 Infiniband。

VMware vSphere Bitfusion 与 kubernetes

在资源管理调度平台上,Kubernetes 已成为事实标准。所以很多客户选择在 Kubernetes 中使用 GPU 运行 AI 计算任务。Kubernetes 提供 device plugin 机制,可以让节点发现和上报设备资源,供 Pod 使用。GPU 资源也是通过该方式提供。使用kubernetes 调度 GPU 代理以下好处:加速部署:通过容器构想避免重复部署机器学习复杂环境;提升集群资源使用率:统一调度和分配集群资源;保障资源独享:利用容器隔离异构设备,避免互相影响。

结合 Kubernetes 灵活的资源调度与 Bitfusion 的的 GPU 算力切分与远程调用功能,能充分发挥二者的优势,首先是加速部署,避免把时间浪费在环境准备的环节中。通过容器镜像技术,将整个部署过程进行固化和复用,许许多多的框架都提供了容器镜像。我们可以借此提升 GPU 的使用效率。通过 Bitfusion 分时复用、动态切分、远程调用,结合 Kubernetes 的统一调度能力,使得资源使用方能够做到用即申请、完即释放,从而盘活整个 GPU 的资源池。

VMware 中国研发云原生实验室推出了 Bitfusion 的 device plugin 插件,并且开源了相关代码。该项目通过在 Kubernetes 使用 Bitfusion 的方式来实现 GPU 共享能力。

项目地址:

https://github.com/vmware/bitfusion-with-kubernetes-integration

通过两个组件来实现允许 Kubernetes 使用 Bitfusion 的目的。

  1. bitfusion-device-plugin;
  2. bitfusion-webhook;

组件 1 和组件 2 分别内置在独立的容器镜像中。

bitfusion-device-plugin 作为 DaemonSet 运行在 kubelet 所在的每个工作节点上。

bitfusion-webhook 作为 Deployment 运行在 Kubernetes 主节点上。

VMware vSphere Bitfusion 与 TKG

Tanzu Kubernetes Grid (TKG) 是 Tanzu 产品家族中的一个产品,是 VMware 的 Kubernetes 企业发行版本,可以在私有云和公有云多种云环境中部署,为用户提供一致的 Kubernetes 使用体验,与社区的 Kubernetes 完全兼容。

TKG 通过 Bitfusion device plugin 插件,实现对 Bitfusion GPU 资源池的远程调用,实现 GPU 的算力资源的灵活使用。

TKG 与 vSphere Bitfusion 架构示意图

下面我们将要测试 TKG 与 Bitfusion 方案测试。

vSphere Bitfusion 与 TKG 方案测试

测试拓扑

测试步骤

1

vSphere ESXi 打开 GPU 直通模式

ESXi 主机的 BIOS 设置中为 GPU 启用直通:

  1. 在 ESXi 主机上为 GPU 启用直通码,启动 GPU 直通之后,重启 ESXi 主机。
2. 在 ESXi 主机上为 GPU 启动 GPU 直通模式之后,需要重启 ESXi 主机。

2

部署配置 BitFusion Server

  1. https://customerconnect.vmware.com 下载最新版本的 BitFusion Server。
  2. 登陆 vsphere vcenter 导入 bitfusion OVA 文件。

3.设 置 bf VM 显示名称。

4.设 置 BF 网络。

5.自 定义设置 BF 模版,输入名称,VC 地址,用户名,密码,在 credentials 部分指定 Bitfusion server 的 customer 用户密码。

6.设 置是否自动下载 NVIDIA 包 (自动下载需要链接互联网,离线模式不需要勾选),设置 BF server 管理网络信息,IP 地址,掩码,网关、DNS、NTP。

7.建 议管理网和 BF 传输数据网络分开,所以需要设置数据网卡信息,注意 MTU 建议 9000 (需要匹配交换机设置)。

8.汇 总自定义模版信息,完成设置。


9.OVF 导入完成后,不要开机,编辑虚机添加网卡(默认只有 1 块网卡),添加所有直通 GPU 卡,设置内存预留。

10.配 置完成后打开 BitFusion 电源,等待 10 分钟左右。

11.下 载 vSphere Bitfusion 配合使用的 NVIDIA 驱动程序,,当前 BF4.5.2 版本要求470.129.06版本,NVIDIA-Linux-x86_64-470.129.06.run ,下载地址为 https://www.nvidia.com/content/DriverDownload-March2009/confirmation.php?url=/XFree86/Linux-x86_64/470.129.06/NVIDIA-Linux-x86_64-470.129.06.run&lang=us&type=TITAN

12.使用 customer 用户(密码在部署过程中设置)复制驱动 NVIDIA-Linux-x86_64-470.129.06.run到 bfserver 的~/nvidia-packages/ 目录。

13.使用 customer 用户(密码在部署过程中设置)登陆到 bfserver,安装 NVIDIA-Linux-x86_64-470.129.06.run  驱动包。安装成功之后重启 bf server。

14.重启 10 分钟左右 BitFusion 会自动注册 vcenter Plugin,刷新浏览器,可以看到 bitfusion 插件已经注册成功。

3

注入的 Bitfusion token 文件到 TKG 集群

配置流程:

  1. 在 bootstrap 主机导出 tkg 集群 kubeconfig 文件:# tanzu cluster kubeconfig  get bftkg01 –admin -n map  –export-file bftkg01config
  2. 切换到 bitfusion 插件管理界面:

3.切 换到 token 的 kubernetes cluster ,点击 ADD,添加集群认证:

4.上 传 kubeconfig 文件,并选择 kube-system 命名空间:

5.创 建的 token 文件,自动注入到 tkg 集群:


6.登 陆 TKG 集群查看 token 文件成功注入:

4

部署 Bitfusion device plugin for Kubernetes

Bitfusion device plugin for Kubernetes 有两种部署的方式:

1) 使用已经构建好的容器镜像部署;

2) 使用代码构建容器镜像,并用生成的镜像部署。

本次测试采用第一种方式,

第二种方式可以参考项目地址 https://github.com/vmware/bitfusion-with-kubernetes-integration

第一种方式可以修改使用腾讯云 image 地址:

ccr.ccs.tencentyun.com/bitfusion/bitfusion-device-plugin:0.4

ccr.ccs.tencentyun.com/bitfusion/bitfusion-webhook:0.4

ccr.ccs.tencentyun.com/bitfusion/bitfusion-client:0.4

  1. 使用以下命令克隆源 github 代码:
# git clone https://github.com/vmware/bitfusion-with-kubernetes-integration.gitCloning into 'bitfusion-with-kubernetes-integration'...remote: Enumerating objects: 417, done.remote: Counting objects: 100% (184/184), done.remote: Compressing objects: 100% (128/128), done.remote: Total 417 (delta 138), reused 56 (delta 56), pack-reused 233Receiving objects: 100% (417/417), 3.32 MiB | 2.55 MiB/s, done.Resolving deltas: 100% (205/205), done.
  1. 使用以下命令部署 Bitfusion device plugin 和其他相关组件,需要确保 Kubernetes 集群可以连接到 Internet:

备注 1: 可以修改 /bitfusion-with-kubernetes-integration/bitfusion_device_plugin/Makefile 为腾讯云镜像地址 IMAGE_REPO ?= ccr.ccs.tencentyun.com/bitfusion。

备注 2:如果需要启用配额功能或者使用 gpu-memory 参数指定 Bitfusion 资源分配,需要更新  bitfusion-injector.yaml 文件,设置 TOTAL_GPU_MEMORY。

例如:

 # vim bitfusion-with-kubernetes-integration/bitfusion_device_plugin/webhook/deployment/bitfusion-injector.yaml apiVersion: apps/v1...         env:           - name: TOTAL_GPU_MEMORY             value: 16000...

使用 make deploy 命令部署:

cd bitfusion-with-kubernetes-integration-main/bitfusion_device_plugin# make deployCreate file device-plugin/deployment/deploy_device_plugin.yml by device-plugin/deployment/device_plugin.yml: rewrite phaedobf/device-plugin:v0.1 to docker.io/bitfusiondeviceplugin/bitfusion-device-plugin:0.4 ...Create file webhook/deployment/deploy-bitfusion-injector-webhook-configmap.yaml by webhook/deployment/bitfusion-injector-webhook-configmap.yaml: rewrite phaedobf/bitfusion-client-ubuntu1804_2.5.0-10_amd64:v0.1 to docker.io/bitfusiondeviceplugin/bitfusion-client:0.4 ...Create file webhook/deployment/deploy-bitfusion-injector.yaml by webhook/deployment/bitfusion-injector.yaml: rewrite phaedobf/sidecar-injector:v0.1 to docker.io/bitfusiondeviceplugin/bitfusion-webhook:0.4 ...Create device-plugin ...kubectl delete -f device-plugin/deployment/deploy_device_plugin.ymlError from server (NotFound): error when deleting "device-plugin/deployment/deploy_device_plugin.yml": daemonsets.apps "bitfusion-cli-device-plugin" not foundmake: [create] Error 1 (ignored)daemonset.apps/bitfusion-cli-device-plugin createdCreate webhook ...namespace/bwki created/root/bf/bitfusion-with-kubernetes-integration/bitfusion_device_plugin/root/bf/bitfusion-with-kubernetes-integration/bitfusion_device_plugin/webhookK8S_PLATFORM == communitycreating certs in tmpdir /tmp/tmp.kh94bERflWGenerating RSA private key, 2048 bit long modulus......................................+++..........................................+++e is 65537 (0x10001)Warning: certificates.k8s.io/v1beta1 CertificateSigningRequest is deprecated in v1.19+, unavailable in v1.22+; use certificates.k8s.io/v1 CertificateSigningRequestcertificatesigningrequest.certificates.k8s.io/bwki-webhook-svc.bwki createdNAME                    AGE   SIGNERNAME                     REQUESTOR          CONDITIONbwki-webhook-svc.bwki   0s    kubernetes.io/legacy-unknown   kubernetes-admin   Pendingcertificatesigningrequest.certificates.k8s.io/bwki-webhook-svc.bwki approvedW0808 21:46:19.054194   29067 helpers.go:557] --dry-run is deprecated and can be replaced with --dry-run=client.secret/bwki-webhook-certs createddeployment.apps/bitfusion-webhook-deployment createdservice/bwki-webhook-svc createdconfigmap/bwki-webhook-configmap createdserviceaccount/bwki-webhook-deployment createdclusterrolebinding.rbac.authorization.k8s.io/bwki-webhook-deployment createdvalidatingwebhookconfiguration.admissionregistration.k8s.io/validation.bitfusion.io-cfg createdWarning: admissionregistration.k8s.io/v1beta1 MutatingWebhookConfiguration is deprecated in v1.16+, unavailable in v1.22+; use admissionregistration.k8s.io/v1 MutatingWebhookConfigurationmutatingwebhookconfiguration.admissionregistration.k8s.io/bwki-webhook-cfg createdconfigmap/bwki-bitfusion-client-configmap createdNAME                                            READY   STATUS              RESTARTS   AGEbitfusion-webhook-deployment-6cbc6cb554-ssxbg   0/1     ContainerCreating   0          2s
  1. 验证 Bitfusion device plugin 以及相关组件部署成功:

检查 device plugin 是否正在运行:

# kubectl get pod -n kube-system |grep bitbitfusion-cli-device-plugin-9flht                     1/1     Running   0               57sbitfusion-cli-device-plugin-kz66p                     1/1     Running   0               57sbitfusion-cli-device-plugin-pbwzw                     1/1     Running   0               57s

检查 webhook 是否正在运行:

# kubectl get pod -n bwkiNAME                                            READY   STATUS    RESTARTS   AGEbitfusion-webhook-deployment-6cbc6cb554-ssxbg   1/1     Running   0          41s  

验证 cm 、sa 等组件:

#  kubectl get configmap -n bwkiNAME                              DATA   AGEbwki-bitfusion-client-configmap   1      2m42sbwki-webhook-configmap            1      2m43skube-root-ca.crt                  1      2m45s#  kubectl get serviceaccount  -n bwkiNAME                      SECRETS   AGEbwki-webhook-deployment   1         2m51sdefault                   1         2m53s# kubectl get ValidatingWebhookConfiguration  -n bwkiNAME                                   WEBHOOKS   AGEcert-manager-webhook                   1          3h27mcrdvalidator.antrea.tanzu.vmware.com   4          3h32mvalidation.bitfusion.io-cfg            1          3m1s#  kubectl get MutatingWebhookConfiguration   -n bwkiNAME                                 WEBHOOKS   AGEcert-manager-webhook                 1          3h27mcrdmutator.antrea.io                 2          3h32mcrdmutator.antrea.tanzu.vmware.com   2          3h32m# kubectl get svc   -n bwkiNAME               TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)   AGEbwki-webhook-svc   ClusterIP   100.68.195.68   <none>        443/TCP   3m24s

5

在 TKG 集群进行 TF 基准测试

完成安装后,用户可以编写 YAML 文件来使用 Bitfusion 资源。在 YAML 文件中有以下几个与 Bitfusion 资源相关的参数:

可以通过设置 gpu 资源百分比或者设置显存大小进行GPU算力分配。

备注:使用 nvcr.io/nvidia/tensorflow:19.07-py3 进行测试;

bitfusion-client/version: “450” 要匹配 bfserver 版本;

测试 yaml 模版位置:bitfusion-with-kubernetes-integration/bitfusion_device_plugin/example

  1. 通过 gpu-percent 参数指定 Bitfusion 资源切分:
apiVersion: v1kind: Podmetadata:annotations: auto-management/bitfusion: "all" bitfusion-client/os: "ubuntu18" bitfusion-client/version: "450"name: bf-pkgs# You can specify any namespacenamespace: tensorflow-benchmarkspec:containers: - image: nvcr.io/nvidia/tensorflow:19.07-py3   imagePullPolicy: IfNotPresent   name: bf-pkgs   command: ["python /benchmark/scripts/tf_cnn_benchmarks/tf_cnn_benchmarks.py --local_parameter_device=gpu --batch_size=32 --model=inception3"]   resources:     limits:       # Request one GPU for this Pod from the Bitfusion cluster       bitfusion.io/gpu-amount: 1       # 50 percent of each GPU to be consumed       bitfusion.io/gpu-percent: 50   volumeMounts:     - name: code       mountPath: /benchmarkvolumes: - name: code       # The Benchmarks used for the test came from: https://github.com/tensorflow/benchmarks/tree/tf_benchmark_stage       # Please make sure you have the corresponding content in /home/benchmarks directory on your node   hostPath:     path: /home/benchmarks
  1. 通过 gpu-memory 参数指定 Bitfusion 资源切分:

备注:安装插件时需要设置 TOTAL_GPU_MEMORY

apiVersion: v1kind: Podmetadata:annotations:  auto-management/bitfusion: "all"  bitfusion-client/os: "ubuntu18"  bitfusion-client/version: "450"name: bf-pkgs# You can specify any namespacenamespace: tensorflow-benchmarkspec:containers:  - image: nvcr.io/nvidia/tensorflow:19.07-py3    imagePullPolicy: IfNotPresent    name: bf-pkgs    command: ["python /benchmark/scripts/tf_cnn_benchmarks/tf_cnn_benchmarks.py --local_parameter_device=gpu --batch_size=32 --model=inception3"]    resources:      limits:        # Request one GPU for this Pod from the Bitfusion cluster        bitfusion.io/gpu-amount: 1        # 50 percent of each GPU to be consumed        bitfusion.io/gpu-memory: 8000M     volumeMounts:      - name: code        mountPath: /benchmarkvolumes:  - name: code        # The Benchmarks used for the test came from: https://github.com/tensorflow/benchmarks/tree/tf_benchmark_stage        # Please make sure you have the corresponding content in /home/benchmarks directory on your node    hostPath:      path: /home/benchmarks
  1. 下载 TensorFlow 基准测试脚本,并拷贝到 tkg 集群的 work 节点。

tensorflow/benchmarks 是 TensorFlow 基准测试项目:

项目地址:

https://github.com/tensorflow/benchmarks/tree/tf_benchmark_stage

拷贝测试脚本到 TKG 集群的 worker 节点 /home/benchmarks 目录下:

例如:

  root@bftkg01-md-0-78ddf5fd45-59xx6:/home/benchmarks# ls   LICENSE  perfzero  README.md  scripts
  1. 运行以下命令创建 ns,并提交基准测试任务:

gpu-percent 方式测试:

# kubectl create namespace tensorflow-benchmark# kubectl create -f pod.yaml

基准测试日志输出如下:

TensorFlow:  1.14Model:       inception3Dataset:     imagenet (synthetic)Mode:        trainingSingleSess:  FalseBatch size:  32 global          32 per deviceNum batches: 100Num epochs:  0.00Devices:     ['/gpu:0']NUMA bind:   FalseData format: NCHWOptimizer:   sgdVariables:   parameter_server==========Generating training modelInitializing graphRunning warm upDone warm upStep    Img/sec total_loss1       images/sec: 74.9 +/- 0.0 (jitter = 0.0) 7.29710      images/sec: 74.3 +/- 0.3 (jitter = 0.4) 7.32620      images/sec: 74.1 +/- 0.2 (jitter = 0.8) 7.33530      images/sec: 74.0 +/- 0.1 (jitter = 1.0) 7.29440      images/sec: 73.6 +/- 0.2 (jitter = 0.9) 7.24450      images/sec: 73.4 +/- 0.1 (jitter = 1.2) 7.28860      images/sec: 73.1 +/- 0.1 (jitter = 1.4) 7.33370      images/sec: 72.9 +/- 0.1 (jitter = 1.4) 7.29680      images/sec: 72.8 +/- 0.1 (jitter = 1.4) 7.30790      images/sec: 72.6 +/- 0.1 (jitter = 1.3) 7.329100     images/sec: 72.6 +/- 0.1 (jitter = 1.2) 7.366 

gpu-memory 方式测试:

# kubectl create namespace tensorflow-benchmark# kubectl create -f podmem.yaml

基准测试结果:

  TensorFlow:  1.14Model:       inception3Dataset:     imagenet (synthetic)Mode:        trainingSingleSess:  FalseBatch size:  32 global           32 per deviceNum batches: 100Num epochs:  0.00Devices:     ['/gpu:0']NUMA bind:   FalseData format: NCHWOptimizer:   sgdVariables:   parameter_server==========Generating training modelInitializing graphRunning warm upDone warm upStep    Img/sec total_loss1       images/sec: 73.9 +/- 0.0 (jitter = 0.0) 7.29710      images/sec: 73.3 +/- 0.2 (jitter = 0.5) 7.33620      images/sec: 73.3 +/- 0.1 (jitter = 0.6) 7.36930      images/sec: 73.3 +/- 0.1 (jitter = 0.6) 7.28440      images/sec: 73.2 +/- 0.1 (jitter = 0.6) 7.27450      images/sec: 73.1 +/- 0.1 (jitter = 0.8) 7.25460      images/sec: 72.9 +/- 0.1 (jitter = 0.9) 7.35170      images/sec: 72.7 +/- 0.1 (jitter = 1.0) 7.27080      images/sec: 72.6 +/- 0.1 (jitter = 1.1) 7.31090      images/sec: 72.5 +/- 0.1 (jitter = 1.1) 7.307100     images/sec: 72.4 +/- 0.1 (jitter = 1.1) 7.376----------------------------------------------------------------total images/sec: 72.37----------------------------------------------------------------[INFO] 2022-08-21T07:03:14Z Releasing GPUs from config file '/tmp/bitfusion929786101'...[INFO] 2022-08-21T07:03:14Z Released GPUs on 1 servers and removed generated config file '/tmp/bitfusion929786101'  

5.Deployment 方式测试多个 pod 同时发起基准测试:

备注:bitfusion-client/version: “450” 要符合 bf server 版本,设置副本数量。

apiVersion: apps/v1kind: Deploymentmetadata:  annotations:  labels:    app: bfdeploy  name: bfdeploy  namespace: tensorflow-benchmarkspec:  replicas: 2  selector:    matchLabels:      app: bfdeploy  strategy: {}  template:    metadata:      annotations:        auto-management/bitfusion: "all"        bitfusion-client/os: "ubuntu18"        bitfusion-client/version: "450"      labels:        app: bfdeploy    spec:      containers:        - image: nvcr.io/nvidia/tensorflow:19.07-py3          name: bfdeploy          command: ["python /benchmark/scripts/tf_cnn_benchmarks/tf_cnn_benchmarks.py --local_parameter_device=gpu --batch_size=32 --model=inception3"]          resources:            limits:              bitfusion.io/gpu-amount: 1              bitfusion.io/gpu-percent: 30          volumeMounts:            - name: code              mountPath: /benchmark      volumes:        - name: code          hostPath:            path: /home/benchmarks    
#kubectl apply -f bfdeploy.yamldeployment.apps/bfdeploy created  

基准测试结果:

TensorFlow:  1.14Model:       inception3Dataset:     imagenet (synthetic)Mode:        trainingSingleSess:  FalseBatch size:  32 global           32 per deviceNum batches: 100Num epochs:  0.00Devices:     ['/gpu:0']NUMA bind:   FalseData format: NCHWOptimizer:   sgdVariables:   parameter_server==========Generating training modelInitializing graphRunning warm upDone warm upStep    Img/sec total_loss1       images/sec: 36.2 +/- 0.0 (jitter = 0.0) 7.30510      images/sec: 37.5 +/- 1.0 (jitter = 0.9) 7.32220      images/sec: 36.1 +/- 0.6 (jitter = 0.5) 7.34330      images/sec: 35.6 +/- 0.4 (jitter = 0.5) 7.27940      images/sec: 35.3 +/- 0.3 (jitter = 0.5) 7.24050      images/sec: 35.1 +/- 0.3 (jitter = 0.4) 7.29360      images/sec: 34.9 +/- 0.2 (jitter = 0.4) 7.32070      images/sec: 34.8 +/- 0.2 (jitter = 0.5) 7.25580      images/sec: 34.7 +/- 0.2 (jitter = 0.5) 7.34890      images/sec: 34.6 +/- 0.2 (jitter = 0.6) 7.348100     images/sec: 34.5 +/- 0.1 (jitter = 0.5) 7.349----------------------------------------------------------------total images/sec: 34.52-------------------------  
TensorFlow:  1.14Model:       inception3Dataset:     imagenet (synthetic)Mode:        trainingSingleSess:  FalseBatch size:  32 global           32 per deviceNum batches: 100Num epochs:  0.00Devices:     ['/gpu:0']NUMA bind:   FalseData format: NCHWOptimizer:   sgdVariables:   parameter_server==========Generating training modelInitializing graphRunning warm upDone warm upStep    Img/sec total_loss1       images/sec: 34.5 +/- 0.0 (jitter = 0.0) 7.32410      images/sec: 34.5 +/- 0.1 (jitter = 0.3) 7.31720      images/sec: 34.6 +/- 0.1 (jitter = 0.2) 7.36030      images/sec: 34.6 +/- 0.0 (jitter = 0.2) 7.32840      images/sec: 34.6 +/- 0.0 (jitter = 0.2) 7.29050      images/sec: 38.0 +/- 2.0 (jitter = 0.2) 7.31960      images/sec: 41.4 +/- 2.3 (jitter = 0.3) 7.32070      images/sec: 44.2 +/- 2.3 (jitter = 0.6) 7.24280      images/sec: 46.5 +/- 2.2 (jitter = 1.4) 7.30690      images/sec: 48.6 +/- 2.1 (jitter = 2.4) 7.320100     images/sec: 50.3 +/- 2.0 (jitter = 1.4) 7.353----------------------------------------------------------------total images/sec: 50.31  

6.auto-management/bitfusion 的设置选项:

auto-management/bitfusion:

[all]   injecting a Bitfusion dependency and BareMetal Token and adding the Bitfusion p           refix to the content of the Container’s command

[injection] only Bitfusion dependencies and BareMetal tokens are injected and

[none] do nothing to POD

      annotations:     auto-management/bitfusion: "all"
  1. GPU 资源配额的设置和使用:

可以给集群的 namespace 设置配额。

device plugin 使用的资源 bitfusion.io/gpu,使用以下命令来创建配额。requests.bitfusion.io/gpu: 100 代表在指定的 namespace下的作业,最多可以使用 Bitfusion 的一张 GPU 卡的 100% 的能力。

apiVersion: v1kind: Listitems:- apiVersion: v1 kind: ResourceQuota metadata:   name: bitfusion-quota   namespace: tensorflow-benchmark spec:   hard:       requests.bitfusion.io/gpu: 100kubectl apply -f quota.yaml
#  kubectl describe quota -n tensorflow-benchmark bitfusion-quotaName:                      bitfusion-quotaNamespace:                 tensorflow-benchmarkResource                   Used  Hard--------                   ----  ----requests.bitfusion.io/gpu  0     100

发起一个任务 gpu-percent=50 参数 pod,显示 used 为50:

# kubectl describe quota -n tensorflow-benchmark bitfusion-quotaName:                      bitfusion-quotaNamespace:                 tensorflow-benchmarkResource                   Used  Hard--------                   ----  ----requests.bitfusion.io/gpu  50    100

Bitfusion GPU 监控

1. 查看 bitfusion 集群 GPU 资源使用情况:

2. 查看 bitfusion server 健康状态、GPU 信息、资源使用情况:

3. 查看 bitfusion 客户端 GPU 资源使用情况: