Skip to content

Commit 83d8d43

Browse files
authored
Merge pull request #7 from supercontainers/add-lammps-artifact-generation
add lammps artifact generation example
2 parents 8fa5950 + a1f80ce commit 83d8d43

File tree

4 files changed

+157
-0
lines changed

4 files changed

+157
-0
lines changed

examples/check-lammps/README.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Check LAMMPS
2+
3+
This will be a small experiment to:
4+
5+
1. Generate compatiility artifacts for a few containers
6+
2. Push them to an OCI registry
7+
3. Create (design) a manifest.yaml that lists them side by side
8+
4. Test (and develop) the check tool to choose the best one (and test different modes for doing this)
9+
10+
## 1. Generate Compatibility Artifacts
11+
12+
Let's first choose a subset of amd64 containers. We are doing this primarily because that is my development host and I can't run anything
13+
for a different arch. These are a subset from [lammps-matrix](https://github.com/rse-ops/lammps-matrix/pkgs/container/lammps-matrix).
14+
Note that we have added a simple release workflow that generates [binaries](https://github.com/supercontainers/compspec-go/releases/tag/1-26-2024-2)
15+
that we can easily grab.
16+
17+
```bash
18+
docker pull ghcr.io/rse-ops/lammps-matrix:intel-mpi-rocky-9-amd64
19+
```
20+
21+
Let's use the [generate-artifact.sh](generate-artifact.sh) script, and inside the container, to do exactly that. Note that we have to
22+
source the /etc/profile to emulate what would happen on an entry to the container. Let's walk through how we'd do this with one container
23+
first, generating the artifact and [pushing to oras](https://oras.land/docs/how_to_guides/pushing_and_pulling/).
24+
25+
```bash
26+
# create directory for output specs
27+
mkdir -p ./specs
28+
29+
# arguments are the hasGpu command and the path for the artifact (relative to PWD)
30+
cmd=". /etc/profile && /tmp/data/generate-artifact.sh no /tmp/data/specs/compspec-intel-mpi-rocky-9-amd64.json"
31+
docker run -v $PWD:/tmp/data -it ghcr.io/rse-ops/lammps-matrix:intel-mpi-rocky-9-amd64 /bin/bash -c "$cmd"
32+
33+
# This generates ./specs/compspec-intel-mpi-rocky-9-amd64.json, let's push to a registry with oras
34+
oras push ghcr.io/rse-ops/lammps-matrix:intel-mpi-rocky-9-amd64-compspec --artifact-type application/org.supercontainers.compspec ./specs/compspec-intel-mpi-rocky-9-amd64.json
35+
```
36+
37+
Here is how we might see it:
38+
39+
```bash
40+
oras blob fetch --output - ghcr.io/rse-ops/lammps-matrix:intel-mpi-rocky-9-amd64-compspec@sha256:b68136afad3e4340f0dd4e09c5fea7faf12306cb4b0c1de616703b00d6ffef78
41+
```
42+
```console
43+
{
44+
"version": "0.0.0",
45+
"kind": "CompatibilitySpec",
46+
"metadata": {
47+
"name": "lammps-prototype",
48+
"jsonSchema": "https://raw.githubusercontent.com/supercontainers/compspec/main/supercontainers/compspec.json"
49+
},
50+
"compatibilities": [
51+
{
52+
"name": "org.supercontainers.mpi",
53+
"version": "0.0.0",
54+
"annotations": {
55+
"implementation": "intel-mpi",
56+
"version": "2021.8"
57+
}
58+
},
59+
{
60+
"name": "org.supercontainers.os",
61+
"version": "0.0.0",
62+
"annotations": {
63+
"name": "Rocky Linux 9.3 (Blue Onyx)",
64+
"release": "9.3",
65+
"vendor": "rocky",
66+
"version": "9.3"
67+
}
68+
},
69+
{
70+
"name": "org.supercontainers.hardware.gpu",
71+
"version": "0.0.0",
72+
"annotations": {
73+
"available": "no"
74+
}
75+
},
76+
{
77+
"name": "io.archspec.cpu",
78+
"version": "0.0.0",
79+
"annotations": {
80+
"model": "13th Gen Intel(R) Core(TM) i5-1335U",
81+
"target": "amd64",
82+
"vendor": "GenuineIntel"
83+
}
84+
}
85+
]
86+
}
87+
```
88+
89+
This is great! Next we will capture the URIs of these together in a manifest and put into our compspec tool. TBA!
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
# This assumes binding the entire directory with this script and lammps-experiment.yaml
4+
hasGpu="${1:-no}"
5+
path="${2:-./compatibility-spec.json}"
6+
7+
# Note that this is hard coded for amd64, for arm you would wantt o add -arm or ppc64le -ppc
8+
wget --quiet https://github.com/supercontainers/compspec-go/releases/download/1-26-2024-2/compspec
9+
chmod +x compspec
10+
11+
# Download the spec for our compatibility artifact
12+
wget --quiet https://gist.githubusercontent.com/vsoch/fcd0f7d633860674cb085a8540ce4bb2/raw/880f3764b9394ccaa21fd768b235c7a89609aa65/lammps-experiment.yaml
13+
14+
# Generate!
15+
./compspec create --in ./lammps-experiment.yaml -a custom.gpu.available=$hasGpu -o ${path}
16+
cat ${path}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"version": "0.0.0",
3+
"kind": "CompatibilitySpec",
4+
"metadata": {
5+
"name": "lammps-prototype",
6+
"jsonSchema": "https://raw.githubusercontent.com/supercontainers/compspec/main/supercontainers/compspec.json"
7+
},
8+
"compatibilities": [
9+
{
10+
"name": "org.supercontainers.mpi",
11+
"version": "0.0.0",
12+
"annotations": {
13+
"implementation": "intel-mpi",
14+
"version": "2021.8"
15+
}
16+
},
17+
{
18+
"name": "org.supercontainers.os",
19+
"version": "0.0.0",
20+
"annotations": {
21+
"name": "Rocky Linux 9.3 (Blue Onyx)",
22+
"release": "9.3",
23+
"vendor": "rocky",
24+
"version": "9.3"
25+
}
26+
},
27+
{
28+
"name": "org.supercontainers.hardware.gpu",
29+
"version": "0.0.0",
30+
"annotations": {
31+
"available": "no"
32+
}
33+
},
34+
{
35+
"name": "io.archspec.cpu",
36+
"version": "0.0.0",
37+
"annotations": {
38+
"model": "13th Gen Intel(R) Core(TM) i5-1335U",
39+
"target": "amd64",
40+
"vendor": "GenuineIntel"
41+
}
42+
}
43+
]
44+
}

examples/lammps-experiment.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ compatibilities:
1818
implementation: library.mpi.variant
1919
version: library.mpi.version
2020

21+
- name: "org.supercontainers.os"
22+
version: "0.0.0"
23+
annotations:
24+
name: system.os.name
25+
release: system.os.release
26+
vendor: system.os.vendor
27+
version: system.os.version
28+
2129
# This is an example of a custom metadata attribute provided by the user (commandline)
2230
# It can override an actual attribute, or just be random / new, -o custom.gpu.available=yes
2331
- name: "org.supercontainers.hardware.gpu"

0 commit comments

Comments
 (0)