-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add GPU Numbers Predicates #1692
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
# GPU Number User guide | ||
|
||
## Environment setup | ||
|
||
### Install volcano | ||
|
||
|
||
#### 1. Install from source | ||
|
||
Refer to [Install Guide](../../installer/README.md) to install volcano. | ||
|
||
After installed, update the scheduler configuration: | ||
|
||
```shell script | ||
kubectl edit cm -n volcano-system volcano-scheduler-configmap | ||
``` | ||
|
||
```yaml | ||
kind: ConfigMap | ||
apiVersion: v1 | ||
metadata: | ||
name: volcano-scheduler-configmap | ||
namespace: volcano-system | ||
data: | ||
volcano-scheduler.conf: | | ||
actions: "enqueue, allocate, backfill" | ||
tiers: | ||
- plugins: | ||
- name: priority | ||
- name: gang | ||
- name: conformance | ||
- plugins: | ||
- name: drf | ||
- name: predicates | ||
arguments: | ||
predicate.GPUNumberEnable: true # enable gpu number | ||
- name: proportion | ||
- name: nodeorder | ||
- name: binpack | ||
``` | ||
#### 2. Install from release package. | ||
Same as above, after installed, update the scheduler configuration in `volcano-scheduler-configmap` configmap. | ||
|
||
### Install Volcano device plugin | ||
|
||
Please refer to [volcano device plugin](https://github.com/volcano-sh/devices/blob/master/README.md#quick-start) | ||
|
||
* Remember to config volcano device plugin to support gpu-number, users need to config volcano device plugin --gpu-strategy=number. For more information [volcano device plugin configuration](https://github.com/volcano-sh/devices/blob/master/doc/config.md) | ||
|
||
### Verify environment is ready | ||
|
||
Check the node status, it is ok `volcano.sh/gpu-number` is included in the allocatable resources. | ||
|
||
```shell script | ||
$ kubectl get node {node name} -oyaml | ||
... | ||
Capacity: | ||
attachable-volumes-gce-pd: 127 | ||
cpu: 2 | ||
ephemeral-storage: 98868448Ki | ||
hugepages-1Gi: 0 | ||
hugepages-2Mi: 0 | ||
memory: 7632596Ki | ||
pods: 110 | ||
volcano.sh/gpu-memory: 0 | ||
volcano.sh/gpu-number: 1 | ||
Allocatable: | ||
attachable-volumes-gce-pd: 127 | ||
cpu: 1930m | ||
ephemeral-storage: 47093746742 | ||
hugepages-1Gi: 0 | ||
hugepages-2Mi: 0 | ||
memory: 5752532Ki | ||
pods: 110 | ||
volcano.sh/gpu-memory: 0 | ||
volcano.sh/gpu-number: 1 | ||
``` | ||
|
||
### Running Jobs With Multiple GPU Cards | ||
|
||
Jobs can have multiple exclusive NVIDIA GPUs cards via defining container level resource requirements `volcano.sh/gpu-number`: | ||
```shell script | ||
$ cat <<EOF | kubectl apply -f - | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: gpu-pod1 | ||
spec: | ||
containers: | ||
- name: cuda-container | ||
image: nvidia/cuda:9.0-devel | ||
command: ["sleep"] | ||
args: ["100000"] | ||
resources: | ||
limits: | ||
volcano.sh/gpu-number: 1 # requesting 1 gpu cards | ||
EOF | ||
``` | ||
|
||
If the above pods claim multiple gpu cards, you can see each of them has exclusive gpu cards: | ||
|
||
```shell script | ||
$ kubectl exec -ti gpu-pod1 env | ||
... | ||
NVIDIA_VISIBLE_DEVICES=0 | ||
VOLCANO_GPU_ALLOCATED=1 | ||
... | ||
``` | ||
### Understanding How Multiple GPU Cards Requirement Works | ||
|
||
The main architecture is similar as the previous, but the gpu-index results of each pod will be a list of gpu cards index. | ||
|
||
 | ||
|
||
1. create a pod with `volcano.sh/gpu-number` resource request, | ||
|
||
2. volcano scheduler predicates and allocate gpu cards to the pod. Add the below annotation | ||
|
||
```yaml | ||
annotations: | ||
volcano.sh/gpu-index: “0” | ||
volcano.sh/predicate-time: “1593764466550835304” | ||
peiniliu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
``` | ||
|
||
3. kubelet watches the pod bound to itself, and calls allocate API to set env before running the container. | ||
|
||
```yaml | ||
env: | ||
NVIDIA_VISIBLE_DEVICES: “0” # GPU card index | ||
VOLCANO_GPU_ALLOCATED: “1” # GPU number allocated | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,8 @@ Same as above, after installed, update the scheduler configuration in `volcano-s | |
|
||
Please refer to [volcano device plugin](https://github.com/volcano-sh/devices/blob/master/README.md#quick-start) | ||
|
||
* By default volcano device plugin supports shared GPUs, users do not need to config volcano device plugin. Default setting is the same as setting --gpu-strategy=number. For more information [volcano device plugin configuration](https://github.com/volcano-sh/devices/blob/master/doc/config.md) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the link is 404 |
||
### Verify environment is ready | ||
|
||
Check the node status, it is ok if `volcano.sh/gpu-memory` and `volcano.sh/gpu-number` are included in the allocatable resources. | ||
|
@@ -124,14 +126,14 @@ If only the above pods are claiming gpu resource in a cluster, you can see the p | |
```shell script | ||
$ kubectl exec -ti gpu-pod1 env | ||
... | ||
VOLCANO_GPU_TOTAL=11178 | ||
VOLCANO_GPU_MEMORY_TOTAL=11178 | ||
VOLCANO_GPU_ALLOCATED=1024 | ||
NVIDIA_VISIBLE_DEVICES=0 | ||
... | ||
|
||
$ kubectl exec -ti gpu-pod1 env | ||
... | ||
VOLCANO_GPU_TOTAL=11178 | ||
VOLCANO_GPU_MEMORY_TOTAL=11178 | ||
VOLCANO_GPU_ALLOCATED=1024 | ||
NVIDIA_VISIBLE_DEVICES=0 | ||
... | ||
|
@@ -159,5 +161,5 @@ annotations: | |
env: | ||
NVIDIA_VISIBLE_DEVICES: "0" # GPU card index | ||
VOLCANO_GPU_ALLOCATED: "1024" # GPU allocated | ||
VOLCANO_GPU_TOTAL: "11178" # GPU memory of the card | ||
VOLCANO_GPU_MEMORY_TOTAL: "11178" # GPU memory of the card | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kebe-API-Server => Kube-API-Server