Skip to content

Commit f4bed32

Browse files
authored
Resolve generic benchmark dependencies before eval changes cwd (#113)
1 parent 5d6aaa2 commit f4bed32

11 files changed

Lines changed: 134 additions & 30 deletions

‎Magpie/scripts/benchmark/atom_mi300x.sh‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@
2020
# instead of localhost:$PORT, and forces PHASE=client (no local server
2121
# launch, no server-side cleanup, no SERVER_PID monitoring).
2222

23-
source "$(dirname "$0")/benchmark_lib.sh"
24-
source "$(dirname "$0")/server_cleanup.sh"
23+
SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)" || exit $?
24+
source "$SCRIPT_DIR/benchmark_lib.sh"
25+
source "$SCRIPT_DIR/server_cleanup.sh"
2526
# shellcheck source=magpie_bench_remote_compat.sh
26-
source "$(dirname "$0")/magpie_bench_remote_compat.sh"
27+
source "$SCRIPT_DIR/magpie_bench_remote_compat.sh"
2728

2829
PHASE="${MAGPIE_RUN_PHASE:-all}"
2930
case "$PHASE" in

‎Magpie/scripts/benchmark/atom_mi355x.sh‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616
# with vLLM, so the bench client uses --backend vllm unchanged. See
1717
# atom_mi300x.sh for the full contract.
1818

19-
source "$(dirname "$0")/benchmark_lib.sh"
20-
source "$(dirname "$0")/server_cleanup.sh"
19+
SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)" || exit $?
20+
source "$SCRIPT_DIR/benchmark_lib.sh"
21+
source "$SCRIPT_DIR/server_cleanup.sh"
2122
# shellcheck source=magpie_bench_remote_compat.sh
22-
source "$(dirname "$0")/magpie_bench_remote_compat.sh"
23+
source "$SCRIPT_DIR/magpie_bench_remote_compat.sh"
2324

2425
PHASE="${MAGPIE_RUN_PHASE:-all}"
2526
case "$PHASE" in

‎Magpie/scripts/benchmark/sglang_mi300x.sh‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@
1515
# cluster, externally managed). Leave the env unset to keep the
1616
# default behaviour of launching a local server.
1717

18-
source "$(dirname "$0")/benchmark_lib.sh"
19-
source "$(dirname "$0")/server_cleanup.sh"
18+
SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)" || exit $?
19+
source "$SCRIPT_DIR/benchmark_lib.sh"
20+
source "$SCRIPT_DIR/server_cleanup.sh"
2021
# shellcheck source=magpie_bench_remote_compat.sh
21-
source "$(dirname "$0")/magpie_bench_remote_compat.sh"
22+
source "$SCRIPT_DIR/magpie_bench_remote_compat.sh"
2223

2324
PHASE="${MAGPIE_RUN_PHASE:-all}"
2425
case "$PHASE" in

‎Magpie/scripts/benchmark/sglang_mi355x.sh‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616
# instead of localhost:$PORT, and forces PHASE=client (no local server
1717
# launch). See sglang_mi300x.sh for the full contract.
1818

19-
source "$(dirname "$0")/benchmark_lib.sh"
20-
source "$(dirname "$0")/server_cleanup.sh"
19+
SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)" || exit $?
20+
source "$SCRIPT_DIR/benchmark_lib.sh"
21+
source "$SCRIPT_DIR/server_cleanup.sh"
2122
# shellcheck source=magpie_bench_remote_compat.sh
22-
source "$(dirname "$0")/magpie_bench_remote_compat.sh"
23+
source "$SCRIPT_DIR/magpie_bench_remote_compat.sh"
2324

2425
PHASE="${MAGPIE_RUN_PHASE:-all}"
2526
case "$PHASE" in

‎Magpie/scripts/benchmark/sglang_radeon8060s.sh‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616
# instead of localhost:$PORT, and forces PHASE=client (no local server
1717
# launch). See sglang_mi300x.sh for the full contract.
1818

19-
source "$(dirname "$0")/benchmark_lib.sh"
20-
source "$(dirname "$0")/server_cleanup.sh"
19+
SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)" || exit $?
20+
source "$SCRIPT_DIR/benchmark_lib.sh"
21+
source "$SCRIPT_DIR/server_cleanup.sh"
2122
# shellcheck source=magpie_bench_remote_compat.sh
22-
source "$(dirname "$0")/magpie_bench_remote_compat.sh"
23+
source "$SCRIPT_DIR/magpie_bench_remote_compat.sh"
2324

2425
PHASE="${MAGPIE_RUN_PHASE:-all}"
2526
case "$PHASE" in

‎Magpie/scripts/benchmark/vllm_mi300x.sh‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@
1919
# cluster, externally managed). Leave the env unset to keep the
2020
# default behaviour of launching a local server.
2121

22-
source "$(dirname "$0")/benchmark_lib.sh"
23-
source "$(dirname "$0")/server_cleanup.sh"
22+
SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)" || exit $?
23+
source "$SCRIPT_DIR/benchmark_lib.sh"
24+
source "$SCRIPT_DIR/server_cleanup.sh"
2425
# shellcheck source=magpie_bench_remote_compat.sh
25-
source "$(dirname "$0")/magpie_bench_remote_compat.sh"
26+
source "$SCRIPT_DIR/magpie_bench_remote_compat.sh"
2627

2728
PHASE="${MAGPIE_RUN_PHASE:-all}"
2829
case "$PHASE" in

‎Magpie/scripts/benchmark/vllm_mi300x_mm.sh‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@
2626
# Phases (via MAGPIE_RUN_PHASE): all | server | client (default all).
2727
# Server-only writes PID to MAGPIE_SERVER_PID_FILE then disowns and exits.
2828

29-
source "$(dirname "$0")/benchmark_lib.sh"
30-
source "$(dirname "$0")/server_cleanup.sh"
29+
SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)" || exit $?
30+
source "$SCRIPT_DIR/benchmark_lib.sh"
31+
source "$SCRIPT_DIR/server_cleanup.sh"
3132
# shellcheck source=magpie_bench_remote_compat.sh
32-
[[ -f "$(dirname "$0")/magpie_bench_remote_compat.sh" ]] && source "$(dirname "$0")/magpie_bench_remote_compat.sh"
33+
[[ -f "$SCRIPT_DIR/magpie_bench_remote_compat.sh" ]] && source "$SCRIPT_DIR/magpie_bench_remote_compat.sh"
3334

3435
# Fallback: some server_cleanup.sh variants (e.g. InferenceX's) do not define
3536
# magpie_stop_benchmark_server_stack. Provide a safe inline version so the

‎Magpie/scripts/benchmark/vllm_mi355x.sh‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616
# instead of localhost:$PORT, and forces PHASE=client (no local server
1717
# launch). See vllm_mi300x.sh for the full contract.
1818

19-
source "$(dirname "$0")/benchmark_lib.sh"
20-
source "$(dirname "$0")/server_cleanup.sh"
19+
SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)" || exit $?
20+
source "$SCRIPT_DIR/benchmark_lib.sh"
21+
source "$SCRIPT_DIR/server_cleanup.sh"
2122
# shellcheck source=magpie_bench_remote_compat.sh
22-
source "$(dirname "$0")/magpie_bench_remote_compat.sh"
23+
source "$SCRIPT_DIR/magpie_bench_remote_compat.sh"
2324

2425
PHASE="${MAGPIE_RUN_PHASE:-all}"
2526
case "$PHASE" in

‎Magpie/scripts/benchmark/vllm_mi355x_mm.sh‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@
2626
# Phases (via MAGPIE_RUN_PHASE): all | server | client (default all).
2727
# Server-only writes PID to MAGPIE_SERVER_PID_FILE then disowns and exits.
2828

29-
source "$(dirname "$0")/benchmark_lib.sh"
30-
source "$(dirname "$0")/server_cleanup.sh"
29+
SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)" || exit $?
30+
source "$SCRIPT_DIR/benchmark_lib.sh"
31+
source "$SCRIPT_DIR/server_cleanup.sh"
3132
# shellcheck source=magpie_bench_remote_compat.sh
32-
[[ -f "$(dirname "$0")/magpie_bench_remote_compat.sh" ]] && source "$(dirname "$0")/magpie_bench_remote_compat.sh"
33+
[[ -f "$SCRIPT_DIR/magpie_bench_remote_compat.sh" ]] && source "$SCRIPT_DIR/magpie_bench_remote_compat.sh"
3334

3435
# Fallback: some server_cleanup.sh variants (e.g. InferenceX's) do not define
3536
# magpie_stop_benchmark_server_stack. Provide a safe inline version so the

‎Magpie/scripts/benchmark/vllm_radeon8060s.sh‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616
# instead of localhost:$PORT, and forces PHASE=client (no local server
1717
# launch). See vllm_mi300x.sh for the full contract.
1818

19-
source "$(dirname "$0")/benchmark_lib.sh"
20-
source "$(dirname "$0")/server_cleanup.sh"
19+
SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)" || exit $?
20+
source "$SCRIPT_DIR/benchmark_lib.sh"
21+
source "$SCRIPT_DIR/server_cleanup.sh"
2122
# shellcheck source=magpie_bench_remote_compat.sh
22-
source "$(dirname "$0")/magpie_bench_remote_compat.sh"
23+
source "$SCRIPT_DIR/magpie_bench_remote_compat.sh"
2324

2425
PHASE="${MAGPIE_RUN_PHASE:-all}"
2526
case "$PHASE" in

0 commit comments

Comments
 (0)