|
| 1 | +<!-- SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. --> |
| 2 | +<!-- SPDX-License-Identifier: Apache-2.0 --> |
| 3 | + |
| 4 | +# GPU workload images |
| 5 | + |
| 6 | +This directory defines workload test images for OpenShell GPU validation. |
| 7 | + |
| 8 | +## Contract |
| 9 | + |
| 10 | +Each workload image must: |
| 11 | + |
| 12 | +- Use the standard OpenShell sandbox base image as its final-stage base or |
| 13 | + ensure that the requirements for a sandbox image are met. |
| 14 | +- Provide a manifest command that runs the workload inside the sandbox image. |
| 15 | +- Run the same workload as the image default entrypoint for direct |
| 16 | + container-engine validation. |
| 17 | +- Require no network access after the image is pulled. |
| 18 | +- Print `OPENSHELL_GPU_WORKLOAD_SUCCESS` only when validation succeeds. |
| 19 | +- Print `OPENSHELL_GPU_WORKLOAD_FAILURE` and exit non-zero when validation |
| 20 | + fails. |
| 21 | +- Be usable as an OpenShell sandbox image when OpenShell invokes the manifest |
| 22 | + command explicitly. |
| 23 | + |
| 24 | +OpenShell sandbox creation replaces the image entrypoint with the supervisor and |
| 25 | +does not run the OCI image `CMD`. When these images are used through OpenShell, |
| 26 | +the workload command from each manifest entry must be passed explicitly. |
| 27 | + |
| 28 | +The image build task writes a local workload manifest. Each workload entry |
| 29 | +carries: |
| 30 | + |
| 31 | +- `name` |
| 32 | +- `image` |
| 33 | +- `command` |
| 34 | +- `expect` |
| 35 | +- `requirements` |
| 36 | + |
| 37 | +## Images |
| 38 | + |
| 39 | +| Source directory | Image name | Purpose | |
| 40 | +| --- | --- | --- | |
| 41 | +| `smoke-pass` | `gpu-workload-smoke-pass` | Always succeeds and prints the success marker. | |
| 42 | +| `smoke-fail` | `gpu-workload-smoke-fail` | Always fails and prints the failure marker. | |
| 43 | +| `cuda-basic` | `gpu-workload-cuda-basic` | Runs CUDA `deviceQuery` and `vectorAdd` validation. | |
| 44 | + |
| 45 | +## Build |
| 46 | + |
| 47 | +Build all workload images: |
| 48 | + |
| 49 | +```shell |
| 50 | +mise run e2e:workloads:build |
| 51 | +``` |
| 52 | + |
| 53 | +Build a subset by source directory name: |
| 54 | + |
| 55 | +```shell |
| 56 | +OPENSHELL_GPU_WORKLOAD_IMAGES=smoke-pass,smoke-fail \ |
| 57 | +mise run e2e:workloads:build |
| 58 | +``` |
| 59 | + |
| 60 | +The build task uses `tasks/scripts/container-engine.sh`. Set |
| 61 | +`CONTAINER_ENGINE=docker` or `CONTAINER_ENGINE=podman` to choose an engine |
| 62 | +explicitly. When unset, the helper uses its existing auto-detection behavior. |
| 63 | + |
| 64 | +Local tags use the current commit short SHA plus a short fingerprint of the |
| 65 | +external build inputs. Dirty local trees append `-dirty`. Set |
| 66 | +`OPENSHELL_GPU_WORKLOAD_IMAGE_TAG=<tag>` to override the tag. |
| 67 | + |
| 68 | +The task writes the latest build refs to: |
| 69 | + |
| 70 | +```text |
| 71 | +e2e/gpu/images/.build/latest.env |
| 72 | +``` |
| 73 | + |
| 74 | +The task also writes a local workload manifest for downstream tooling and |
| 75 | +future workload-runner integration: |
| 76 | + |
| 77 | +```text |
| 78 | +e2e/gpu/images/.build/workloads.yaml |
| 79 | +``` |
| 80 | + |
| 81 | +That local manifest is created by `mise run e2e:workloads:build`. It contains |
| 82 | +the full image reference, command, expected outcome, and requirements for each |
| 83 | +selected workload. It also records the external build inputs used to produce |
| 84 | +the workload images. |
| 85 | + |
| 86 | +Use the env file in later commands: |
| 87 | + |
| 88 | +```shell |
| 89 | +source e2e/gpu/images/.build/latest.env |
| 90 | +``` |
| 91 | + |
| 92 | +That env file exports `OPENSHELL_E2E_WORKLOAD_MANIFEST` pointing at the local |
| 93 | +manifest. The current checked-in Rust GPU e2e target does not consume this |
| 94 | +manifest yet. The per-image refs remain available as a convenience for direct |
| 95 | +container-engine validation. |
| 96 | + |
| 97 | +## Direct Validation |
| 98 | + |
| 99 | +Validate smoke pass: |
| 100 | + |
| 101 | +```shell |
| 102 | +docker run --rm "${OPENSHELL_E2E_GPU_SMOKE_PASS_IMAGE}" |
| 103 | +``` |
| 104 | + |
| 105 | +Validate smoke fail: |
| 106 | + |
| 107 | +```shell |
| 108 | +docker run --rm "${OPENSHELL_E2E_GPU_SMOKE_FAIL_IMAGE}" |
| 109 | +``` |
| 110 | + |
| 111 | +The smoke fail command should exit non-zero and print |
| 112 | +`OPENSHELL_GPU_WORKLOAD_FAILURE`. |
| 113 | + |
| 114 | +Validate CUDA with Docker CDI: |
| 115 | + |
| 116 | +```shell |
| 117 | +docker run --rm --device nvidia.com/gpu=all \ |
| 118 | + "${OPENSHELL_E2E_GPU_CUDA_WORKLOAD_IMAGE}" |
| 119 | +``` |
| 120 | + |
| 121 | +Use `podman run` with the same `--device nvidia.com/gpu=all` option on hosts |
| 122 | +where Podman CDI is configured. |
| 123 | + |
| 124 | +Direct container-engine validation catches image, CDI, CUDA, and host GPU setup |
| 125 | +issues before OpenShell sandbox behavior is involved. |
| 126 | + |
| 127 | +## OpenShell GPU E2E |
| 128 | + |
| 129 | +The current Rust GPU validation target is: |
| 130 | + |
| 131 | +```shell |
| 132 | +mise run e2e:gpu |
| 133 | +``` |
| 134 | + |
| 135 | +That target runs `gpu_device_selection`. It validates GPU request and device |
| 136 | +selection behavior against a Docker-backed gateway. It does not run the |
| 137 | +workload manifest generated by `mise run e2e:workloads:build`. |
0 commit comments