GPU-accelerated elastic container instances come with built-in GPUs and Compute Unified Device Architecture (CUDA) drivers. Therefore, to run a GPU-accelerated elastic container instance, you need only to use a base image that is preinstalled with software such as CUDA Toolkit. You do not need to manually install the GPU driver. This topic describes how to use a GPU-accelerated elastic container instance.
Background information
The GPU driver version supported by GPU-accelerated elastic container instances is NVIDIA 460.73.01. The CUDA Toolkit version supported by GPU-accelerated elastic container instances is 11.2. For more information about CUDA Toolkit, see NVIDIA CUDA.
You can specify GPU-accelerated Elastic Compute Service (ECS) instance types to create GPU-accelerated elastic container instances. The following GPU-accelerated ECS instance types are supported:
gn6v, a GPU-accelerated compute-optimized instance family that uses NVIDIA V100 GPUs. This instance family includes a variety of instance types, such as ecs.gn6v-c8g1.2xlarge.
gn6i, a GPU-accelerated compute-optimized instance family that uses NVIDIA T4 GPUs. This instance family includes a variety of instance types, such as ecs.gn6i-c4g1.xlarge.
gn5, GPU-accelerated compute-optimized instance family that uses NVIDIA P100 GPUs. This instance family includes a variety of instance types, such as ecs.gn5-c4g1.xlarge.
gn5i, GPU-accelerated compute-optimized instance family that uses NVIDIA P4 GPUs. This instance family includes a variety of instance types, such as ecs.gn5i-c2g1.large.
For more information about GPU-accelerated ECS instance types, see Instance families.
Usage notes
Add annotations: k8s.aliyun.com/eci-use-specs
to the pod configuration, as shown in the following example.
Specify the instance type that you want to use in the
annotations
field of the podmetadata
.NoteChoose an ECS instance type based on the actual usage of GPU resources. If the amount of GPU resources specified in the
resources
field is mush lower than that provided by the instance type, resource waste occurs.Specify the amount of GPU resources in the
resources
field of the container configuration.
apiVersion: apps/v1
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
References
For more information about how to use AMD instances, see Use AMD instances.