# Profile experiment for DeepSeek-V4-Flash-INT8 on Kunlun P800 (8 XPUs)
# using SGLang-XPU. Runs a single scenario with PyTorch profiler enabled.
EXPERIMENT="dsv4_p800_sglang_profile"
MODEL_NAME="DeepSeek-V4-Flash-INT8"
MODEL_PATH="${MODEL_PATH:-/data1/models/DeepSeek-V4-Flash-INT8}"
SERVED_MODEL_NAME="deepseek-v4-flash-int8"

SGLANG_PORT="${SGLANG_PORT:-30015}"

# Dedicated container name so this experiment never touches other containers.
CONTAINER_NAME="sglang-dsv4-flash-profile"

# Python interpreter inside the P800 SGLang container.
CONTAINER_PYTHON="${CONTAINER_PYTHON:-/root/miniconda/envs/python310_torch25_cuda/bin/python}"

export XPU_VISIBLE_DEVICES="${XPU_VISIBLE_DEVICES:-0,1,2,3,4,5,6,7}"
export CUDA_VISIBLE_DEVICES="${CUDA_VISIBLE_DEVICES:-0,1,2,3,4,5,6,7}"

# Runtime working directory for logs and temp files.
RUNTIME_BASE="${RUNTIME_BASE:-${SCRIPT_DIR}/runtime}"

# SGLang server settings
CONTEXT_LENGTH="${CONTEXT_LENGTH:-140000}"
MEM_FRACTION_STATIC="${MEM_FRACTION_STATIC:-0.8}"

DOCKER_IMAGE="${DOCKER_IMAGE:-iregistry.baidu-int.com/xpu/sglang-p800-pd-disagg-0510:20260511_4202}"

# Profiler output directory (host path, mounted into container)
PROFILE_OUTPUT_DIR="${PROFILE_OUTPUT_DIR:-${SCRIPT_DIR}/profile_output}"

# ShareGPT seed dataset
DATASET_PATH="${DATASET_PATH:-/data1/yy/sskj/datasets/ShareGPT_V3_unfiltered_cleaned_split.json}"
CONTAINER_DATASET_PATH="${CONTAINER_DATASET_PATH:-/workspace/ShareGPT_V3_unfiltered_cleaned_split.json}"

# Benchmark output dir (host path, mounted into container)
BENCH_OUTPUT_DIR="${BENCH_OUTPUT_DIR:-${SCRIPT_DIR}/bench_output}"

# Dry-run mode
DRY_RUN="${DRY_RUN:-0}"
