运行 MPIJob
使用 Kueue 调度 MPIJob
本页面展示了在运行 MPI Operator MPIJob 时,如何利用 Kueue 的调度和资源管理能力。
本指南适用于对 Kueue 有基本了解的批处理用户。 更多信息,请参阅 Kueue 概述。
开始之前
查阅管理集群配额, 以获取初始集群设置的详细信息。
你可以修改已安装版本的 Kueue 配置, 以将 MPIJob 添加到允许的工作负载中。
Note
要在 v0.8.1 版本之前使用 Trainer,你需要在安装后重启 Kueue。 你可以通过运行以下命令来实现:kubectl delete pods -l control-plane=controller-manager -n kueue-system
。Note
在同时使用 MPI Operator 和 Trainer 时,需要禁用 Trainer 的 MPIJob 选项。 需要修改 Trainer 部署,以启用除 MPIJob 之外的所有 Kubeflow 作业, 如此处所述。MPI Operator 定义
a. 队列选择
目标本地队列应在 MPIJob 配置的
metadata.labels
部分中指定。
metadata:
labels:
kueue.x-k8s.io/queue-name: user-queue
b. 可选择在 MPIJobs 中设置 Suspend 字段
spec:
runPolicy:
suspend: true
默认情况下,Kueue 将通过 Webhook 将 suspend
设置为 true,并在
MPIJob 被接受时取消挂起。
MPIJob 示例
apiVersion: kubeflow.org/v2beta1
kind: MPIJob
metadata:
name: pi
labels:
kueue.x-k8s.io/queue-name: user-queue
spec:
slotsPerWorker: 1
runPolicy:
cleanPodPolicy: Running
ttlSecondsAfterFinished: 60
sshAuthMountPath: /home/mpiuser/.ssh
mpiReplicaSpecs:
Launcher:
replicas: 1
template:
spec:
containers:
- image: mpioperator/mpi-pi:openmpi
name: mpi-launcher
securityContext:
runAsUser: 1000
command:
- mpirun
args:
- -n
- "2"
- /home/mpiuser/pi
resources:
limits:
cpu: 1
memory: 1Gi
Worker:
replicas: 2
template:
spec:
containers:
- image: mpioperator/mpi-pi:openmpi
name: mpi-worker
securityContext:
runAsUser: 1000
command:
- /usr/sbin/sshd
args:
- -De
- -f
- /home/mpiuser/.sshd_config
resources:
limits:
cpu: 1
memory: 1Gi
有关在 Python 中执行此操作的等效说明,请参阅运行 Python 作业。
反馈
这个页面有帮助吗?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.