Skip to content

Curt-Park/k8s-gpu-sharing-pods

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GPU Sharing Pods on Kubernetes

By default, Kubernetes doesn't allow GPU sharing cases as follows:

  • A pod with multiple containers that share a single GPU.
  • Multiple pods that share a single GPU.

In this repository, I introduce some tricks for GPU sharing pods on Kubernetes with only use of NVIDIA device plugin.

Prerequisites

K8s Cluster Creation

make cluster
kubectl get pods --all-namespaces
# Check `nvidia-device-plugin-daemonset` is running.

Argo Workflow Installation

kubectl create namespace argo
helm install argo-workflows charts/argo-workflows -n argo
# Wait for argo-workflows ready...
make port-forward

Open http://localhost:2746/

Login with the token:

kubectl apply -f secret.yaml
kubectl get secret  # Check `argo-workflows-admin.service-account-token` created.
make token
# Paste all strings including Bearer.

Execute a simple workflow for testing:

argo submit --watch workflows/hello-world.yaml

Examples

Create a workflow template that have parallel jobs sharing GPU(s).

kubectl apply -f workflows/templates/gpu-sharing-workflowtemplate.yaml

Trigger the gpu allocation and gpu-sharing workflow execution.

# time slicing with 1 GPU
argo submit --watch workflows/submit-gpu-sharing-workflow.yaml
# time slicing with 2 GPUs
argo submit --watch workflows/submit-gpu-sharing-workflow.yaml -p gpus=2  # 2 gpus
# MPS with 1 GPU
argo submit --watch workflows/submit-gpu-sharing-workflow.yaml -p mps=enabled

References

About

Tricks for GPU sharing pods on Kubernetes without any use of middleware like HAMi or DRA

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors