Skip to content

Commit bf01512

Browse files
Add input provenance item helper
Signed-off-by: yoshifuminakamura <nakamura@riken.jp>
1 parent 1c36538 commit bf01512

7 files changed

Lines changed: 418 additions & 91 deletions

File tree

‎docs/guides/add-app.md‎

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -130,20 +130,12 @@ portal の `/results/usage` では、この source provenance が各 app / syste
130130
Portal や review で dataset 名を見せたい場合だけ、任意の入力metadataで repo-relative path を補足できます。
131131

132132
```bash
133-
bk_record_input_info <<'EOF'
134-
{
135-
"schema_version": 1,
136-
"inputs": [
137-
{
138-
"dataset_id": "myapp-case0",
139-
"kind": "repo-local-input",
140-
"source": "source_info",
141-
"repo_relative_path": "benchmarks/case0/input.dat",
142-
"verification_status": "covered_by_source_commit"
143-
}
144-
]
145-
}
146-
EOF
133+
bk_record_input_item \
134+
--dataset-id myapp-case0 \
135+
--kind repo-local-input \
136+
--source source_info \
137+
--repo-relative-path benchmarks/case0/input.dat \
138+
--verification-status covered_by_source_commit
147139
```
148140

149141
### pre-staged input と site-local 情報の扱い
@@ -163,29 +155,23 @@ site-local path や allocation / project ID は、それ自体を一律に secre
163155

164156
pre-staged input を使う app では、「正しい場所にファイルがある」だけでは再現性の説明として不足します。
165157
可能であれば input directory と同じ場所に manifest を置き、run 前に manifest / digest を検証して、Result metadata へ dataset identity を残してください。
166-
app から実行時の入力metadataを渡す場合は、`scripts/bk_functions.sh` を source して `bk_record_input_info` を使ってください。
167-
app 側は共通層の受け渡し file path を意識せず、入力metadataの中身だけを定義します。
158+
app から実行時の入力metadataを渡す場合は、`scripts/bk_functions.sh` を source して `bk_record_input_item` などの共通helperを使ってください。
159+
app 側は `schema_version` や `inputs` 配列の形を組み立てず、入力metadataの中身だけを引数として渡します。
168160

169161
最小例:
170162

171163
```bash
172-
bk_record_input_info <<'EOF'
173-
{
174-
"schema_version": 1,
175-
"inputs": [
176-
{
177-
"dataset_id": "myapp-case0",
178-
"dataset_version": "2026-09",
179-
"kind": "benchmark-input",
180-
"manifest_digest": "sha256:<manifest-sha256>",
181-
"verification_status": "verified"
182-
}
183-
]
184-
}
185-
EOF
164+
bk_record_input_item \
165+
--dataset-id myapp-case0 \
166+
--dataset-version 2026-09 \
167+
--kind pre-staged-file \
168+
--source site-local \
169+
--verification-status declared \
170+
--recipe "how the benchmark input was prepared"
186171
```
187172

188-
ここで `manifest_digest` は manifest file だけの hash ではなく、manifest の中で dataset ID、version/revision、生成 recipe、期待 file list、size/hash などを説明できるようにしておくと後から追跡しやすくなります。
173+
`Verified` へ進める場合は、manifest file だけの hash ではなく、manifest の中で dataset ID、version/revision、生成 recipe、期待 file list、size/hash などを説明できるようにしておくと後から追跡しやすくなります。
174+
digest や公開URLなどの field を追加する場合も、app 側で Result JSON schema を直書きせず、共通helperまたは共通の受け渡し形式を拡張してください。
189175
公開 surface では detailed local path を出さず、dataset identity と検証状態を優先して見せる前提で設計してください。
190176

191177
Portal の `/results/usage` では、通常の benchmark result に対する入力出自の状態を `Input Status` として表示します。

‎programs/genesis/run.sh‎

Lines changed: 14 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -28,50 +28,16 @@ input=${header}.inp
2828
resultsdir=${SCRIPT_DIR}/results
2929
artifactsdir=${SCRIPT_DIR}/artifacts
3030
mkdir -p ${resultsdir}
31+
export BK_INPUT_INFO_FILE="${resultsdir}/input_info.json"
32+
export BK_INPUT_INFO_ITEMS_FILE="${resultsdir}/.input_info_items.jsonl"
33+
bk_reset_input_info
3134
#tmpdir="/vol0003/share/rccs-sdt/TMP_FugakuNEXT_CICD_LOG/${system}"
3235
#mkdir -p ${tmpdir}
3336
output="${resultsdir}/log_${header}.txt"
3437
stderr="${resultsdir}/log_${header}_err.txt"
3538
binary="spdyn"
3639
inputdir="../../../inputs/apoa1/"
3740

38-
record_public_input_info() {
39-
local input_source_commit="$1"
40-
{
41-
printf '{\n'
42-
printf ' "schema_version": 1,\n'
43-
printf ' "inputs": [\n'
44-
printf ' {\n'
45-
printf ' "dataset_id": '
46-
bk_json_string "apoa1-p8"
47-
printf ',\n'
48-
printf ' "dataset_version": '
49-
bk_json_string "$BRANCH"
50-
printf ',\n'
51-
printf ' "kind": "public-git",\n'
52-
printf ' "source": "public_url",\n'
53-
printf ' "public_url": '
54-
bk_json_string "$REPO_URL"
55-
printf ',\n'
56-
printf ' "source_ref": '
57-
bk_json_string "$BRANCH"
58-
printf ',\n'
59-
printf ' "resolved_commit": '
60-
bk_json_string "$input_source_commit"
61-
printf ',\n'
62-
printf ' "repo_relative_path": '
63-
bk_json_string "$dir_path"
64-
printf ',\n'
65-
printf ' "recipe": '
66-
bk_json_string "${input}.sub generated from ${input}"
67-
printf ',\n'
68-
printf ' "verification_status": "public_source_commit"\n'
69-
printf ' }\n'
70-
printf ' ]\n'
71-
printf '}\n'
72-
} | bk_record_input_info
73-
}
74-
7541
echo "[${REPO_DIR}] Running on system: $system"
7642

7743
if [[ -d "${REPO_DIR}" ]]; then
@@ -96,7 +62,17 @@ else
9662
fi
9763

9864
input_source_commit=$(git -C "${REPO_DIR}" rev-parse HEAD)
99-
record_public_input_info "$input_source_commit"
65+
bk_record_input_item \
66+
--dataset-id apoa1-p8 \
67+
--dataset-version "$BRANCH" \
68+
--kind public-git \
69+
--source public_url \
70+
--public-url "$REPO_URL" \
71+
--source-ref "$BRANCH" \
72+
--resolved-commit "$input_source_commit" \
73+
--repo-relative-path "$dir_path" \
74+
--recipe "${input}.sub generated from ${input}" \
75+
--verification-status public_source_commit
10076

10177
if [[ ! -f "${artifactsdir}/spdyn" ]]; then
10278
echo "Error: spdyn does not exist."

‎programs/petsc-gmres/run.sh‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ ARTIFACT="${PWD}/artifacts/GMRES-PETSc"
1818
RESULTS_DIR="${PWD}/results"
1919
mkdir -p "${RESULTS_DIR}"
2020
: > "${RESULTS_DIR}/result"
21+
bk_reset_input_info
2122

2223
if [[ ! -x "${ARTIFACT}" ]]; then
2324
echo "Required artifact not found or not executable: ${ARTIFACT}" >&2
@@ -115,6 +116,17 @@ if [[ ! -f "${DATA}" ]]; then
115116
exit 1
116117
fi
117118

119+
matrix_name="$(basename "${DATA}" .dat)"
120+
bk_record_input_item \
121+
--dataset-id "petsc-gmres-${matrix_name}" \
122+
--dataset-version "${matrix_name}" \
123+
--kind pre-staged-file \
124+
--source site-local \
125+
--result-exp "${matrix_name}" \
126+
--parameter ksp_gmres_restart "${KSP_RESTART}" \
127+
--verification-status declared \
128+
--recipe "Stokes flow saddle-point matrix generated with Gmsh/FreeFEM and stored in PETSc binary format."
129+
118130
if ! grep -q "^FOM: ranks=" "${logfile}" 2>/dev/null; then
119131
echo "petsc-gmres success marker not found" >&2
120132
echo "---- ${logfile} tail ----" >&2
@@ -132,7 +144,7 @@ bk_emit_result \
132144
--fom "${ksp_iter_time}" \
133145
--fom-unit s \
134146
--fom-version ksp_iter_time \
135-
--exp "$(basename "${DATA}" .dat)" \
147+
--exp "${matrix_name}" \
136148
--nodes "${nodes}" \
137149
--numproc-node "${numproc_node}" \
138150
--nthreads "${nthreads}" >> "${RESULTS_DIR}/result"

‎programs/salmon/run.sh‎

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ FUGAKU_RESTART_NML="Si-3-3-3-tddft.nml"
4242

4343
mkdir -p "${RESULTS_DIR}"
4444
: > "${RESULTS_DIR}/result"
45+
bk_reset_input_info
4546

4647
if [[ ! -x artifacts/salmon ]]; then
4748
echo "Required artifact not found or not executable: artifacts/salmon" >&2
@@ -103,6 +104,28 @@ if uses_prestaged_restart "${system}"; then
103104
# I/O instead of the benchmark itself.
104105
ln -s "${restart_dir}/restart" "${WORK_DIR}/restart"
105106
grep -Ein '^[[:space:]]*theory[[:space:]]*=' "${WORK_DIR}/${tddft_nml}" >&2 || true
107+
case "${tddft_nml}" in
108+
Si-3-3-3-tddft.nml)
109+
salmon_dataset_id="salmon-si-3x3x3-folded-restart"
110+
salmon_dataset_version="Si-3-3-3-tddft"
111+
;;
112+
Si-2-2-2-tddft.nml)
113+
salmon_dataset_id="salmon-si-2x2x2-folded-restart"
114+
salmon_dataset_version="Si-2-2-2-tddft"
115+
;;
116+
*)
117+
salmon_dataset_id="salmon-folded-restart"
118+
salmon_dataset_version="${tddft_nml%.nml}"
119+
;;
120+
esac
121+
bk_record_input_item \
122+
--dataset-id "${salmon_dataset_id}" \
123+
--dataset-version "${salmon_dataset_version}" \
124+
--kind pre-staged-restart \
125+
--source site-local \
126+
--parameter input_set "${tddft_nml}" \
127+
--verification-status declared \
128+
--recipe "Offline ground-state data folded to a complex Gamma-point TDDFT restart; the run consumes the restart, pseudopotentials, and TDDFT input."
106129
else
107130
case "${system}" in
108131
RC_GH200|RC_GENOA)
@@ -137,6 +160,14 @@ else
137160
chmod +x "${WORK_DIR}/salmon"
138161
cp "${input_dir}"/* "${WORK_DIR}/"
139162
grep -Ein '^[[:space:]]*theory[[:space:]]*=' "${WORK_DIR}/Si-1-1-1.nml" "${WORK_DIR}/Si-1-1-1-tddft.nml" >&2 || true
163+
bk_record_input_item \
164+
--dataset-id salmon-si-1x1x1-archive \
165+
--dataset-version Si-1-1-1 \
166+
--kind pre-staged-archive \
167+
--source site-local \
168+
--parameter input_set "Si-1-1-1 GS/RT inputs" \
169+
--verification-status declared \
170+
--recipe "Archive containing SALMON ground-state and TDDFT input files; the run generates the restart consumed by TDDFT."
140171
fi
141172
cd "${WORK_DIR}"
142173

@@ -311,8 +342,6 @@ if uses_prestaged_restart "${system}"; then
311342
run_rt_once () {
312343
local label="$1" logfile="rt_$1.log"
313344
touch .rt_start_marker
314-
local t0 t1
315-
t0=$(date +%s.%N)
316345
if uses_stdin_input "${system}"; then
317346
run_salmon_or_diagnose RT .rt_start_marker "${logfile}" ./salmon < "${tddft_nml}"
318347
else
@@ -321,7 +350,6 @@ if uses_prestaged_restart "${system}"; then
321350
# under pjsub's mpiexec, not all ranks.
322351
run_salmon_or_diagnose RT .rt_start_marker "${logfile}" -stdin "${tddft_nml}" ./salmon
323352
fi
324-
t1=$(date +%s.%N)
325353
cp "${logfile}" "${RESULTS_DIR}/"
326354
if ! salmon_output_has_marker_since "${logfile}" .rt_start_marker; then
327355
echo "SALMON RT run failed (${label})" >&2

‎programs/scale-letkf/run.sh‎

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
#!/bin/bash
2+
# shellcheck disable=SC2155
23
set -e
34
system="$1"
45
nodes="$2"
5-
mkdir -p results && > results/result
6+
TOPDIR="${PWD}"
7+
mkdir -p results && : > results/result
68

79
source "${PWD}/scripts/bk_functions.sh"
10+
export BK_INPUT_INFO_FILE="${TOPDIR}/results/input_info.json"
11+
export BK_INPUT_INFO_ITEMS_FILE="${TOPDIR}/results/.input_info_items.jsonl"
12+
bk_reset_input_info
813

914
case "$system" in
1015
Fugaku|FugakuCN)
@@ -60,6 +65,29 @@ case "$system" in
6065
elapse_letkf=$elapse
6166

6267
FOM=$(echo "$elapse_scale $elapse_letkf" | awk '{printf "%.3f\n", $1 + $2}')
68+
bk_record_input_item \
69+
--dataset-id scale-letkf-sc23-128x128-fugaku-config \
70+
--kind repo-local-input \
71+
--source source_info \
72+
--result-exp SC23_128x128 \
73+
--repo-relative-path test/benchmark.Fugaku_128x128 \
74+
--verification-status covered_by_source_commit \
75+
--recipe "Benchmark configuration copied from the source repository artifacts."
76+
bk_record_input_item \
77+
--dataset-id scale-letkf-scale-database \
78+
--kind pre-staged-archive \
79+
--source site-local \
80+
--result-exp SC23_128x128 \
81+
--verification-status declared \
82+
--recipe "SCALE database archive expanded before the benchmark run."
83+
bk_record_input_item \
84+
--dataset-id scale-letkf-sc23-part1-20240410 \
85+
--dataset-version 20240410 \
86+
--kind pre-staged-archive \
87+
--source site-local \
88+
--result-exp SC23_128x128 \
89+
--verification-status declared \
90+
--recipe "SC23 SCALE-LETKF benchmark dataset archive expanded before the benchmark run."
6391
bk_emit_result --fom "$FOM" --fom-unit s --fom-version SCALE-LETKF --exp SC23_128x128 --nodes "$nodes" --numproc-node 4 --nthreads 12 >> ../results/result
6492
;;
6593
75)
@@ -102,6 +130,29 @@ case "$system" in
102130
elapse_letkf=$elapse
103131

104132
FOM=$(echo "$elapse_scale $elapse_letkf" | awk '{printf "%.3f\n", $1 + $2}')
133+
bk_record_input_item \
134+
--dataset-id scale-letkf-sc23-1280x1280-fugaku-config \
135+
--kind repo-local-input \
136+
--source source_info \
137+
--result-exp SC23_1280x1280 \
138+
--repo-relative-path test/benchmark.Fugaku_1280x1280 \
139+
--verification-status covered_by_source_commit \
140+
--recipe "Benchmark configuration copied from the source repository artifacts."
141+
bk_record_input_item \
142+
--dataset-id scale-letkf-scale-database \
143+
--kind pre-staged-archive \
144+
--source site-local \
145+
--result-exp SC23_1280x1280 \
146+
--verification-status declared \
147+
--recipe "SCALE database archive expanded before the benchmark run."
148+
bk_record_input_item \
149+
--dataset-id scale-letkf-sc23-part1-20240410 \
150+
--dataset-version 20240410 \
151+
--kind pre-staged-archive \
152+
--source site-local \
153+
--result-exp SC23_1280x1280 \
154+
--verification-status declared \
155+
--recipe "SC23 SCALE-LETKF benchmark dataset archive expanded before the benchmark run."
105156
bk_emit_result --fom "$FOM" --fom-unit s --fom-version SCALE-LETKF --exp SC23_1280x1280 --nodes "$nodes" --numproc-node 4 --nthreads 12 >> ../results/result
106157
;;
107158
esac
@@ -160,6 +211,29 @@ case "$system" in
160211
elapse_letkf=$elapse
161212

162213
FOM=$(echo "$elapse_scale $elapse_letkf" | awk '{printf "%.3f\n", $1 + $2}')
214+
bk_record_input_item \
215+
--dataset-id scale-letkf-sc23-128x128-rc-gh200-config \
216+
--kind repo-local-input \
217+
--source source_info \
218+
--result-exp SC23_128x128 \
219+
--repo-relative-path test/benchmark.RC_GH200_128x128 \
220+
--verification-status covered_by_source_commit \
221+
--recipe "Benchmark configuration copied from the source repository artifacts."
222+
bk_record_input_item \
223+
--dataset-id scale-letkf-scale-database \
224+
--kind pre-staged-archive \
225+
--source site-local \
226+
--result-exp SC23_128x128 \
227+
--verification-status declared \
228+
--recipe "SCALE database archive expanded before the benchmark run."
229+
bk_record_input_item \
230+
--dataset-id scale-letkf-sc23-part1-20240410 \
231+
--dataset-version 20240410 \
232+
--kind pre-staged-archive \
233+
--source site-local \
234+
--result-exp SC23_128x128 \
235+
--verification-status declared \
236+
--recipe "SC23 SCALE-LETKF benchmark dataset archive expanded before the benchmark run."
163237
bk_emit_result --fom "$FOM" --fom-unit s --fom-version SCALE-LETKF --exp SC23_128x128 --nodes "$nodes" --numproc-node 12 --nthreads 1 >> ../results/result
164238
;;
165239
esac

0 commit comments

Comments
 (0)