|
| 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 GPU workload images used by OpenShell GPU e2e tests. |
| 7 | + |
| 8 | +The image definitions live here first so the OpenShell e2e harness can iterate |
| 9 | +against a concrete contract. The long-term image ownership should move to |
| 10 | +`NVIDIA/OpenShell-Community`; OpenShell should then keep the contract, local |
| 11 | +build task, and tests that consume published image refs. |
| 12 | + |
| 13 | +## Contract |
| 14 | + |
| 15 | +Each workload image must: |
| 16 | + |
| 17 | +- Use the OpenShell community base image as its final-stage base. |
| 18 | +- Install the workload at `/usr/local/bin/openshell-gpu-workload`. |
| 19 | +- Run the same workload as the image default entrypoint for direct |
| 20 | + container-engine validation. |
| 21 | +- Require no network access after the image is pulled. |
| 22 | +- Print `OPENSHELL_GPU_WORKLOAD_SUCCESS` only when validation succeeds. |
| 23 | +- Print `OPENSHELL_GPU_WORKLOAD_FAILURE` and exit non-zero when validation |
| 24 | + fails. |
| 25 | +- Be usable as an OpenShell sandbox image with `openshell sandbox create |
| 26 | + --from <image>`. |
| 27 | + |
| 28 | +OpenShell sandbox creation replaces the image entrypoint with the supervisor and |
| 29 | +does not run the OCI image `CMD`. E2e tests that use these images through |
| 30 | +OpenShell should run `/usr/local/bin/openshell-gpu-workload` explicitly. |
| 31 | + |
| 32 | +## Images |
| 33 | + |
| 34 | +| Source directory | Image name | Purpose | |
| 35 | +| --- | --- | --- | |
| 36 | +| `smoke-pass` | `gpu-workload-smoke-pass` | Always succeeds and prints the success marker. | |
| 37 | +| `smoke-fail` | `gpu-workload-smoke-fail` | Always fails and prints the failure marker. | |
| 38 | +| `cuda-basic` | `gpu-workload-cuda-basic` | Runs CUDA `deviceQuery` and `vectorAdd` validation. | |
| 39 | + |
| 40 | +## Build |
| 41 | + |
| 42 | +Build all workload images: |
| 43 | + |
| 44 | +```shell |
| 45 | +mise run e2e:gpu:images:build |
| 46 | +``` |
| 47 | + |
| 48 | +Build a subset by source directory name: |
| 49 | + |
| 50 | +```shell |
| 51 | +OPENSHELL_GPU_WORKLOAD_IMAGES=smoke-pass,smoke-fail \ |
| 52 | +mise run e2e:gpu:images:build |
| 53 | +``` |
| 54 | + |
| 55 | +The build task uses `tasks/scripts/container-engine.sh`. Set |
| 56 | +`CONTAINER_ENGINE=docker` or `CONTAINER_ENGINE=podman` to choose an engine |
| 57 | +explicitly. When unset, the helper uses its existing auto-detection behavior. |
| 58 | + |
| 59 | +Local tags use the current commit short SHA. Dirty local trees append `-dirty`. |
| 60 | +Set `OPENSHELL_GPU_WORKLOAD_IMAGE_TAG=<tag>` to override the tag. |
| 61 | + |
| 62 | +The task writes the latest build refs to: |
| 63 | + |
| 64 | +```text |
| 65 | +e2e/gpu/images/.build/latest.env |
| 66 | +``` |
| 67 | + |
| 68 | +Use it in later commands: |
| 69 | + |
| 70 | +```shell |
| 71 | +source e2e/gpu/images/.build/latest.env |
| 72 | +``` |
| 73 | + |
| 74 | +## Direct Validation |
| 75 | + |
| 76 | +Validate smoke pass: |
| 77 | + |
| 78 | +```shell |
| 79 | +docker run --rm "${OPENSHELL_E2E_GPU_SMOKE_PASS_IMAGE}" |
| 80 | +``` |
| 81 | + |
| 82 | +Validate smoke fail: |
| 83 | + |
| 84 | +```shell |
| 85 | +docker run --rm "${OPENSHELL_E2E_GPU_SMOKE_FAIL_IMAGE}" |
| 86 | +``` |
| 87 | + |
| 88 | +The smoke fail command should exit non-zero and print |
| 89 | +`OPENSHELL_GPU_WORKLOAD_FAILURE`. |
| 90 | + |
| 91 | +Validate CUDA with Docker CDI: |
| 92 | + |
| 93 | +```shell |
| 94 | +docker run --rm --device nvidia.com/gpu=all \ |
| 95 | + "${OPENSHELL_E2E_GPU_CUDA_WORKLOAD_IMAGE}" |
| 96 | +``` |
| 97 | + |
| 98 | +Use `podman run` with the same `--device nvidia.com/gpu=all` option on hosts |
| 99 | +where Podman CDI is configured. |
| 100 | + |
| 101 | +Direct container-engine validation catches image, CDI, CUDA, and host GPU setup |
| 102 | +issues before OpenShell sandbox behavior is involved. |
| 103 | + |
| 104 | +## Publish Guidance |
| 105 | + |
| 106 | +Published tests should reference immutable image refs: |
| 107 | + |
| 108 | +```shell |
| 109 | +OPENSHELL_E2E_GPU_CUDA_WORKLOAD_IMAGE=ghcr.io/nvidia/openshell-community/sandboxes/gpu-workload-cuda-basic@sha256:<digest> |
| 110 | +``` |
| 111 | + |
| 112 | +Mutable tags are acceptable for local iteration. CI should use a digest or an |
| 113 | +immutable release tag once the images are published from OpenShell-Community. |
0 commit comments