Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/CUDApp/blob/main/tools/runtime/fresh-checkout-hello.sh # CUDApp CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `CUDApp / tools / runtime / fresh-checkout-hello.sh` 38 lines · 2274 bytes Raw Blame History 1 #!/usr/bin/env bash 2 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 3 # fresh-checkout-hello.sh [log-file] 4 # Proves the README's "Run your first kernel" works from nothing: clones from GitHub into an 5 # empty temporary folder, takes the commands from that section of the README (the first bash block), runs 6 # only those, and records the output with the commit it ran. Exit code is that of the first README command 7 # that fails (0 when all pass). This is a correctness check, not a timing run. It runs as the current user 8 # with the current environment; tools/runtime/clean-user-hello.sh is the stricter run as a brand-new user. 9 # It uses the GPU, so run it under the shared lock: flock -w 900 /tmp/aien-gb10.lock 10 set -uo pipefail 11 branch=${1:?usage: fresh-checkout-hello.sh [log-file]} 12 log=${2:-/dev/stdout} 13 url=${CUDAPP_URL:-https://github.com/aien-dev/CUDApp} 14 work=$(mktemp -d "${TMPDIR:-/tmp}/cudapp-fresh.XXXXXX") 15 cleanup() { rm -rf "$work"; } 16 trap cleanup EXIT 17 { 18 echo "# fresh-checkout-hello: branch=$branch url=$url" 19 echo "# date: $(date -u +%FT%TZ) host: $(uname -srm) work: $work" 20 # the README commands come from the pushed branch itself 21 git clone -q --branch "$branch" "$url" "$work/src.readme" 2>&1 || { echo "FAIL: cannot clone $branch"; exit 3; } 22 cmds=$(awk '/^## Run your first kernel/{s=1;next} s&&/^```bash/{b=1;next} s&&b&&/^```/{exit} s&&b{print}' "$work/src.readme/README.md") 23 [ -n "$cmds" ] || { echo "FAIL: no bash block under 'Run your first kernel' in README.md"; exit 3; } 24 echo "# README commands:"; echo "$cmds" | sed 's/^/# /' 25 rm -rf "$work/src.readme" 26 # run them in a clean folder; the clone line is pointed at the branch under test 27 mkdir "$work/run" && cd "$work/run" || exit 3 28 cmds=$(echo "$cmds" | sed -E "s#^git clone #git clone --branch $branch #; s#https://github.com/aien-dev/CUDApp([^A-Za-z0-9_.-]|\$)#$url\\1#") 29 rc=0 30 while IFS= read -r line; do 31 [ -n "$line" ] || continue 32 echo "\$ $line" 33 bash -c "$line" 2>&1 || { rc=$?; echo "# command exited $rc"; break; } 34 case $line in "cd "*) cd "${line#cd }" || exit 3; echo "# commit: $(git rev-parse HEAD)";; esac 35 done <<<"$cmds" 36 echo "# fresh-checkout-hello exit code: $rc" 37 exit $rc 38 } > >(tee "$log") 2>&1