From db419e17b855914d835361850df8a339461f5070 Mon Sep 17 00:00:00 2001 From: Root User Date: Thu, 9 Jul 2026 15:36:03 +0000 Subject: [PATCH] dsv4_h200_sglang_tp_dp_matrix: sample only low/high concurrency, use RUNTIME_BASE for self-contained runtime files --- .../dsv4_h200_sglang_tp_dp_matrix/config.env | 4 ++++ .../generate_scenarios.py | 21 +++++++------------ .../run_bench.sh | 2 +- .../start_sglang_docker.sh | 10 ++++----- .../start_sglang_dp.sh | 10 ++++----- 5 files changed, 22 insertions(+), 25 deletions(-) diff --git a/experiments/dsv4_h200_sglang_tp_dp_matrix/config.env b/experiments/dsv4_h200_sglang_tp_dp_matrix/config.env index 3f2bf08..600b4cd 100644 --- a/experiments/dsv4_h200_sglang_tp_dp_matrix/config.env +++ b/experiments/dsv4_h200_sglang_tp_dp_matrix/config.env @@ -23,6 +23,10 @@ USE_DOCKER_CLIENT="${USE_DOCKER_CLIENT:-1}" export CUDA_VISIBLE_DEVICES="${CUDA_VISIBLE_DEVICES:-0,1,2,3,4,5,6,7}" +# Runtime working directory for logs, pid files, and tmp. Defaults to a local +# directory under this experiment so the benchmark is self-contained. +RUNTIME_BASE="${RUNTIME_BASE:-${SCRIPT_DIR}/runtime}" + # Parallel configurations to test. Format: "TP DP" declare -a PARALLEL_CONFIGS=( "2 4" diff --git a/experiments/dsv4_h200_sglang_tp_dp_matrix/generate_scenarios.py b/experiments/dsv4_h200_sglang_tp_dp_matrix/generate_scenarios.py index ef46e01..f722479 100755 --- a/experiments/dsv4_h200_sglang_tp_dp_matrix/generate_scenarios.py +++ b/experiments/dsv4_h200_sglang_tp_dp_matrix/generate_scenarios.py @@ -15,23 +15,16 @@ from pathlib import Path def sample_concurrency(low: int, high: int, target: int) -> list[int]: - """Return a sorted list of concurrency values in [low, high]. + """Return only the low and high concurrency values in [low, high]. - If the range is small, return every integer. Otherwise sample roughly - `target` points linearly between low and high (inclusive). + For the TP×DP matrix we only need the two endpoints of the concurrency + range (e.g. 1 and 128 for ISL=1024). The `target` argument is kept for + API compatibility but is ignored. """ assert 1 <= low <= high, f"invalid concurrency range: {low}-{high}" - if high - low + 1 <= target: - return list(range(low, high + 1)) - - points = set() - points.add(low) - points.add(high) - step = (high - low) / (target - 1) - for i in range(1, target - 1): - v = low + round(step * i) - points.add(max(low, min(high, v))) - return sorted(points) + if low == high: + return [low] + return [low, high] def generate_scenarios(matrix_path: Path, mode: str, target_samples: int) -> list[dict]: diff --git a/experiments/dsv4_h200_sglang_tp_dp_matrix/run_bench.sh b/experiments/dsv4_h200_sglang_tp_dp_matrix/run_bench.sh index 13cf241..75713d0 100755 --- a/experiments/dsv4_h200_sglang_tp_dp_matrix/run_bench.sh +++ b/experiments/dsv4_h200_sglang_tp_dp_matrix/run_bench.sh @@ -48,7 +48,7 @@ stop_server() { local tp="$1" local dp="$2" - local pid_file="/data/user1/yy/${EXPERIMENT}_sglang_tp${tp}_dp${dp}.pid" + local pid_file="${RUNTIME_BASE}/${EXPERIMENT}_sglang_tp${tp}_dp${dp}.pid" if [[ -f "$pid_file" ]]; then local pid pid="$(cat "$pid_file")" diff --git a/experiments/dsv4_h200_sglang_tp_dp_matrix/start_sglang_docker.sh b/experiments/dsv4_h200_sglang_tp_dp_matrix/start_sglang_docker.sh index 4e1ca53..4ddd72f 100755 --- a/experiments/dsv4_h200_sglang_tp_dp_matrix/start_sglang_docker.sh +++ b/experiments/dsv4_h200_sglang_tp_dp_matrix/start_sglang_docker.sh @@ -13,15 +13,15 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # shellcheck source=/dev/null source "${SCRIPT_DIR}/config.env" -cd /data/user1/yy -mkdir -p logs +RUNTIME_BASE="${RUNTIME_BASE:-${SCRIPT_DIR}/runtime}" +mkdir -p "${RUNTIME_BASE}/logs" "${RUNTIME_BASE}/tmp" IMAGE="${DOCKER_IMAGE:-lmsysorg/sglang:latest}" PORT="${SGLANG_PORT:-30031}" NAME="${EXPERIMENT}_sglang_tp${TP}_dp${DP}" -PID_FILE="/data/user1/yy/${EXPERIMENT}_sglang_tp${TP}_dp${DP}.pid" +PID_FILE="${RUNTIME_BASE}/${EXPERIMENT}_sglang_tp${TP}_dp${DP}.pid" -LOG="/data/user1/yy/logs/${EXPERIMENT}_sglang_docker_tp${TP}_dp${DP}_$(date +%Y%m%d_%H%M%S).log" +LOG="${RUNTIME_BASE}/logs/${EXPERIMENT}_sglang_docker_tp${TP}_dp${DP}_$(date +%Y%m%d_%H%M%S).log" rm -f "$PID_FILE" # Clean up any stale container with the same name. @@ -64,7 +64,7 @@ nohup docker run --rm \ --entrypoint sglang \ -p "${PORT}:${PORT}" \ -v "${MODEL_PATH}:${MODEL_PATH}:ro" \ - -v /data/user1/yy/tmp:/tmp \ + -v "${RUNTIME_BASE}/tmp:/tmp" \ -e CUDA_VISIBLE_DEVICES="${CUDA_VISIBLE_DEVICES}" \ -e PYTHONUNBUFFERED=1 \ "$IMAGE" \ diff --git a/experiments/dsv4_h200_sglang_tp_dp_matrix/start_sglang_dp.sh b/experiments/dsv4_h200_sglang_tp_dp_matrix/start_sglang_dp.sh index 9a47e07..35d52fe 100755 --- a/experiments/dsv4_h200_sglang_tp_dp_matrix/start_sglang_dp.sh +++ b/experiments/dsv4_h200_sglang_tp_dp_matrix/start_sglang_dp.sh @@ -18,17 +18,17 @@ if [[ "${USE_DOCKER:-1}" == "1" ]]; then exec "${SCRIPT_DIR}/start_sglang_docker.sh" "$@" fi -cd /data/user1/yy -mkdir -p logs +RUNTIME_BASE="${RUNTIME_BASE:-${SCRIPT_DIR}/runtime}" +mkdir -p "${RUNTIME_BASE}/logs" "${RUNTIME_BASE}/tmp" VENV="${VENV_CLIENT}" export PATH="$VENV/bin:$PATH" export PYTHONUNBUFFERED=1 -export TMPDIR=/data/user1/yy/tmp +export TMPDIR="${RUNTIME_BASE}/tmp" export CUDA_VISIBLE_DEVICES="${CUDA_VISIBLE_DEVICES}" -LOG="/data/user1/yy/logs/${EXPERIMENT}_sglang_tp${TP}_dp${DP}_$(date +%Y%m%d_%H%M%S).log" -PID_FILE="/data/user1/yy/${EXPERIMENT}_sglang_tp${TP}_dp${DP}.pid" +LOG="${RUNTIME_BASE}/logs/${EXPERIMENT}_sglang_tp${TP}_dp${DP}_$(date +%Y%m%d_%H%M%S).log" +PID_FILE="${RUNTIME_BASE}/${EXPERIMENT}_sglang_tp${TP}_dp${DP}.pid" rm -f "$PID_FILE"