Elastic Container Instances (ECIs) with Graphic Processing Unit (GPU) capabilities are pre-installed with Docker images. Therefore, when you use ECIs with GPU capabilities, you do not need to install software such as TensorFlow and CUDA Toolkit. This topic describes how to use an ECI with GPU capabilities.

Background information

Currently, ECIs with GPU capabilities support GPU driver versions of NVIDIA 410.79 and CUDA Toolkit 10.0.

You can specify Eastic Compute Service (ECS) instance types with GPU capabilities to create ECIs with GPU capabilities. Supported ECS instance types with GPU capabilities include:

  • gn6v, compute optimized instance family with GPU (NVIDIA V100) capabilities, for example, ecs.gn6v-c8g1.2xlarge.
  • gn6i, compute optimized instance family with GPU (NVIDIA T4) capabilities, for example, ecs.gn6i-c4g1.xlarge.
  • gn5, compute optimized instance family with GPU (NVIDIA P100) capabilities, for example, ecs.gn5-c4g1.xlarge.
  • gn5i, compute optimized instance family with GPU (NVIDIA P4) capabilities, for example, ecs.gn5i-c2g1.large.

For more information about ECS instance types with GPU capabilities, see Instance families.

Procedure

Add annotations: k8s.aliyun.com/eci-use-specs to the definition of a pod.

  • Add annotations of the specified instance type to the metadata field of the pod configuration.
  • Specify GPU resources in the resources field of the container configuration.
apiVersion: apps/v1beta2
kind: Deployment
metadata:
  name: nginx-gpu-demo
  labels:
    app: nginx
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
      annotations:
        k8s.aliyun.com/eci-use-specs: ecs.gn5i-c4g1.xlarge
    spec:
      containers:
      - name: nginx
        image: registry-vpc.cn-beijing.aliyuncs.com/eci_open/nginx:1.15.10
        resources:
            limits:
              nvidia.com/gpu: '1'
        ports:
        - containerPort: 80