comparison dictation/launcher.sh @ 277:1d99147f520c

Merge Qwen services and infinite canvas heads
author MrJuneJune <me@mrjunejune.com>
date Mon, 17 Aug 2026 17:01:40 -0700
parents 78699f810817
children 6bd4a3990696
comparison
equal deleted inserted replaced
276:b55c22cff335 277:1d99147f520c
1 #!/usr/bin/env bash
2 set -euo pipefail
3
4 binary="$1"
5 command="$2"
6 shift 2
7
8 if [[ -z "${RUNFILES_DIR:-}" && -d "$0.runfiles" ]]; then
9 RUNFILES_DIR="$0.runfiles"
10 fi
11 if [[ -z "${RUNFILES_DIR:-}" ]]; then
12 echo "Bazel runfiles are unavailable." >&2
13 exit 1
14 fi
15
16 find_library_dir() {
17 local name="$1"
18 local path
19 path="$(find -L "$RUNFILES_DIR" -name "$name" -print -quit)"
20 if [[ -z "$path" ]]; then
21 echo "Unable to find $name in Bazel runfiles." >&2
22 exit 1
23 fi
24 dirname "$path"
25 }
26
27 cublas_dir="$(find_library_dir libcublas.so.12)"
28 cudnn_dir="$(find_library_dir libcudnn.so.9)"
29 export LD_LIBRARY_PATH="$cublas_dir:$cudnn_dir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
30
31 if [[ "$binary" != /* ]]; then
32 binary="$RUNFILES_DIR/_main/$binary"
33 fi
34
35 exec "$binary" "$command" "$@"