Repository navigation
tutorials: Lab 20, init and sidecar container GPU resource accounting #915
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
Draft
GiGiKoneti
wants to merge
1
commit into
Project-HAMi:master
Choose a base branch
from
GiGiKoneti:lab19-init-sidecar-accounting
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+768
−0
Draft
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
This file contains hidden or 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
30 changes: 30 additions & 0 deletions
30
tutorials/labs/examples/20-init-sidecar-accounting/01-regular-init-container.yaml
This file contains hidden or 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,30 @@ | ||
| apiVersion: v1 | ||
|
Member
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. please see this file also before contributing this is template for lab files .https://github.com/Project-HAMi/website/blob/master/tutorials/_template.md |
||
| kind: Pod | ||
| metadata: | ||
| name: regular-init-pod | ||
| labels: | ||
| app: regular-init-demo | ||
| spec: | ||
| restartPolicy: Never | ||
| initContainers: | ||
| - name: model-prep | ||
| image: busybox:1.36 | ||
| command: ["sh", "-c", "echo 'Preparing model weights on GPU...' && sleep 15 && echo 'Done'"] | ||
| env: | ||
| - name: CUDA_DISABLE_CONTROL | ||
| value: "true" # Enables lightweight simulation in fake GPU / nvml-mock environments | ||
| resources: | ||
| limits: | ||
| nvidia.com/gpu: 1 | ||
| nvidia.com/gpumem: 5000 # 5000 MiB allocated during init (peak allocation) | ||
| containers: | ||
| - name: inference-app | ||
| image: busybox:1.36 | ||
| command: ["sh", "-c", "echo 'Inference app running...' && sleep infinity"] | ||
| env: | ||
| - name: CUDA_DISABLE_CONTROL | ||
| value: "true" | ||
| resources: | ||
| limits: | ||
| nvidia.com/gpu: 1 | ||
| nvidia.com/gpumem: 2000 # 2000 MiB allocated to the main application (steady state) | ||
31 changes: 31 additions & 0 deletions
31
tutorials/labs/examples/20-init-sidecar-accounting/02-native-sidecar-container.yaml
This file contains hidden or 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,31 @@ | ||
| apiVersion: v1 | ||
| kind: Pod | ||
| metadata: | ||
| name: native-sidecar-pod | ||
| labels: | ||
| app: native-sidecar-demo | ||
| spec: | ||
| restartPolicy: Never | ||
| initContainers: | ||
| - name: proxy-sidecar | ||
| image: busybox:1.36 | ||
| restartPolicy: Always # KEP-753 Native Sidecar Container: runs for the full Pod lifetime | ||
| command: ["sh", "-c", "echo 'Inference proxy sidecar running...' && sleep infinity"] | ||
| env: | ||
| - name: CUDA_DISABLE_CONTROL | ||
| value: "true" | ||
| resources: | ||
| limits: | ||
| nvidia.com/gpu: 1 | ||
| nvidia.com/gpumem: 2000 # 2000 MiB permanently reserved for the sidecar | ||
| containers: | ||
| - name: inference-app | ||
| image: busybox:1.36 | ||
| command: ["sh", "-c", "echo 'Main inference app running...' && sleep infinity"] | ||
| env: | ||
| - name: CUDA_DISABLE_CONTROL | ||
| value: "true" | ||
| resources: | ||
| limits: | ||
| nvidia.com/gpu: 1 | ||
| nvidia.com/gpumem: 4000 # 4000 MiB reserved for the app (Total demand: 6000 MiB) |
43 changes: 43 additions & 0 deletions
43
tutorials/labs/examples/20-init-sidecar-accounting/03-mixed-workload-ordering.yaml
This file contains hidden or 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,43 @@ | ||
| apiVersion: v1 | ||
| kind: Pod | ||
| metadata: | ||
| name: mixed-workload-pod | ||
| labels: | ||
| app: mixed-workload-demo | ||
| spec: | ||
| restartPolicy: Never | ||
| initContainers: | ||
| # Sidecar declared before the regular init container | ||
| - name: cache-sidecar | ||
| image: busybox:1.36 | ||
| restartPolicy: Always # Native sidecar: stays running | ||
| command: ["sh", "-c", "echo 'Cache sidecar active...' && sleep infinity"] | ||
| env: | ||
| - name: CUDA_DISABLE_CONTROL | ||
| value: "true" | ||
| resources: | ||
| limits: | ||
| nvidia.com/gpu: 1 | ||
| nvidia.com/gpumem: 2000 # 2000 MiB | ||
| # Regular init container: runs to completion | ||
| - name: weights-loader | ||
| image: busybox:1.36 | ||
| command: ["sh", "-c", "echo 'Loading model weights...' && sleep 15 && echo 'Done'"] | ||
| env: | ||
| - name: CUDA_DISABLE_CONTROL | ||
| value: "true" | ||
| resources: | ||
| limits: | ||
| nvidia.com/gpu: 1 | ||
| nvidia.com/gpumem: 5000 # 5000 MiB (Peak with preceding sidecar: 7000 MiB) | ||
| containers: | ||
| - name: serving-engine | ||
| image: busybox:1.36 | ||
| command: ["sh", "-c", "echo 'Serving engine active...' && sleep infinity"] | ||
| env: | ||
| - name: CUDA_DISABLE_CONTROL | ||
| value: "true" | ||
| resources: | ||
| limits: | ||
| nvidia.com/gpu: 1 | ||
| nvidia.com/gpumem: 4000 # 4000 MiB (Steady-state with sidecar: 6000 MiB) |
23 changes: 23 additions & 0 deletions
23
tutorials/labs/examples/20-init-sidecar-accounting/04-oversubscription-prevention.yaml
This file contains hidden or 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,23 @@ | ||
| apiVersion: v1 | ||
| kind: Pod | ||
| metadata: | ||
| name: competing-workload-pod | ||
| labels: | ||
| app: competing-workload | ||
| annotations: | ||
| # Pin this workload to the same GPU card hosting native-sidecar-pod | ||
| # Replace TARGET_GPU_UUID with the allocated GPU UUID from Step 3 | ||
| nvidia.com/use-gpuuuid: "TARGET_GPU_UUID" | ||
| spec: | ||
| restartPolicy: Never | ||
| containers: | ||
| - name: worker | ||
| image: busybox:1.36 | ||
| command: ["sh", "-c", "echo 'Competing workload running...' && sleep infinity"] | ||
| env: | ||
| - name: CUDA_DISABLE_CONTROL | ||
| value: "true" | ||
| resources: | ||
| limits: | ||
| nvidia.com/gpu: 1 | ||
| nvidia.com/gpumem: 36000 # Requests 36000 MiB: exceeds the 34960 MiB remaining on a 40960 MiB A100 GPU |
Oops, something went wrong.
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.
Please read the contribution.md before contributing to the project.