-
Notifications
You must be signed in to change notification settings - Fork 109
Expand file tree
/
Copy pathrun_compose.sh
More file actions
executable file
·63 lines (52 loc) · 1.68 KB
/
run_compose.sh
File metadata and controls
executable file
·63 lines (52 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [[ ! -f "${ROOT_DIR}/configs/device.env" ]]; then
echo "configs/device.env not found; running without NPU override" >&2
exec docker compose -f "${ROOT_DIR}/docker-compose.yaml" up "$@"
fi
source "${ROOT_DIR}/configs/device.env"
TMP_OVERRIDE="$(mktemp)"
trap 'rm -f "${TMP_OVERRIDE}"' EXIT
echo "services:" > "${TMP_OVERRIDE}"
HAS_NPU=false
if [[ "${ECG_DEVICE:-}" == "NPU" ]]; then
HAS_NPU=true
cat >> "${TMP_OVERRIDE}" <<EOF
ai-ecg:
environment:
- ZE_ENABLE_ALT_DRIVERS=libze_intel_npu.so
devices:
- "/dev/dri:/dev/dri"
- "/dev/accel/accel0:/dev/accel/accel0"
EOF
fi
if [[ "${POSE_3D_DEVICE:-}" == "NPU" ]]; then
HAS_NPU=true
cat >> "${TMP_OVERRIDE}" <<EOF
3dpose-estimation:
environment:
- ZE_ENABLE_ALT_DRIVERS=libze_intel_npu.so
devices:
- "/dev/dri:/dev/dri"
- "/dev/accel/accel0:/dev/accel/accel0"
EOF
fi
if [[ "${RPPG_DEVICE:-}" == "NPU" ]]; then
HAS_NPU=true
cat >> "${TMP_OVERRIDE}" <<EOF
rppg:
environment:
- ZE_ENABLE_ALT_DRIVERS=libze_intel_npu.so
devices:
- "/dev/dri:/dev/dri"
- "/dev/accel/accel0:/dev/accel/accel0"
EOF
fi
if [[ "${HAS_NPU}" == true ]]; then
echo "Detected NPU devices in configs/device.env; using runtime override ${TMP_OVERRIDE}" >&2
exec docker compose --env-file "${ROOT_DIR}/configs/device.env" -f "${ROOT_DIR}/docker-compose.yaml" -f "${TMP_OVERRIDE}" up "$@"
else
echo "No NPU devices configured in configs/device.env; running without NPU override" >&2
exec docker compose --env-file "${ROOT_DIR}/configs/device.env" -f "${ROOT_DIR}/docker-compose.yaml" up "$@"
fi