20 lines
1 KiB
Bash
Executable file
20 lines
1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Writes the PC 2 family-probe playbook: pc2-family-probe.ps1 with proto-cuda/family-probe.cu inlined at
|
|
# CU_PLACEHOLDER, into $1 (default: $TMPDIR/pc2-family-probe.ps1). Prints the sha256 of the .cu so the job's
|
|
# "RESULT source ... sha256" line can be checked against it. The shape follows tools/prover-floor/make-measure-playbook.sh.
|
|
set -euo pipefail
|
|
HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
ROOT="$(cd "$HERE/../.." && pwd)"
|
|
OUT="${1:-${TMPDIR:-/tmp}/pc2-family-probe.ps1}"
|
|
CU="$ROOT/proto-cuda/family-probe.cu"
|
|
grep -q "^'@" "$CU" && { echo "the .cu has a line starting with '@ (would end the here-string)" >&2; exit 1; }
|
|
python3 - "$HERE/pc2-family-probe.ps1" "$CU" "$OUT" <<'PY'
|
|
import sys
|
|
tpl, cu, out = sys.argv[1], sys.argv[2], sys.argv[3]
|
|
s = open(tpl).read()
|
|
c = open(cu).read().rstrip('\n')
|
|
assert 'CU_PLACEHOLDER' in s
|
|
open(out, 'w').write(s.replace('CU_PLACEHOLDER', c))
|
|
print("wrote", out)
|
|
PY
|
|
echo "family-probe.cu sha256 $(shasum -a 256 "$CU" | cut -c1-64) bytes $(wc -c < "$CU" | tr -d ' ')"
|