Track simulator fidelity experiment artifacts
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import json
|
||||
import os
|
||||
import statistics
|
||||
|
||||
import torch
|
||||
import torch.distributed as dist
|
||||
|
||||
|
||||
def main() -> None:
|
||||
local_rank = int(os.environ["LOCAL_RANK"])
|
||||
torch.cuda.set_device(local_rank)
|
||||
dist.init_process_group(backend="nccl")
|
||||
|
||||
# 16 tokens x 4096 hidden values in BF16: 128 KiB per rank.
|
||||
tensor = torch.ones((16, 4096), dtype=torch.bfloat16, device="cuda")
|
||||
for _ in range(10):
|
||||
dist.all_reduce(tensor)
|
||||
torch.cuda.synchronize()
|
||||
|
||||
samples_ms = []
|
||||
for _ in range(50):
|
||||
start = torch.cuda.Event(enable_timing=True)
|
||||
end = torch.cuda.Event(enable_timing=True)
|
||||
start.record()
|
||||
dist.all_reduce(tensor)
|
||||
end.record()
|
||||
end.synchronize()
|
||||
samples_ms.append(float(start.elapsed_time(end)))
|
||||
|
||||
if dist.get_rank() == 0:
|
||||
ordered = sorted(samples_ms)
|
||||
result = {
|
||||
"backend": "nccl",
|
||||
"collective": "all_reduce",
|
||||
"dtype": "bfloat16",
|
||||
"elements_per_rank": tensor.numel(),
|
||||
"bytes_per_rank": tensor.numel() * tensor.element_size(),
|
||||
"world_size": dist.get_world_size(),
|
||||
"warmup_iterations": 10,
|
||||
"measured_iterations": len(samples_ms),
|
||||
"mean_ms": statistics.fmean(samples_ms),
|
||||
"p50_ms": statistics.median(samples_ms),
|
||||
"p95_ms": ordered[int(0.95 * (len(ordered) - 1))],
|
||||
"min_ms": min(samples_ms),
|
||||
"max_ms": max(samples_ms),
|
||||
}
|
||||
print(json.dumps(result, sort_keys=True))
|
||||
|
||||
dist.destroy_process_group()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,6 @@
|
||||
diff --git a/frontier/profiling/moe/moe_vllm_kernel.py b/frontier/profiling/moe/moe_vllm_kernel.py
|
||||
--- a/frontier/profiling/moe/moe_vllm_kernel.py
|
||||
+++ b/frontier/profiling/moe/moe_vllm_kernel.py
|
||||
@@ -232 +232 @@ def _invoke_kernel(
|
||||
- compute_type = tl.float16 # FP8 accumulates in FP16
|
||||
+ compute_type = tl.bfloat16
|
||||
@@ -0,0 +1,9 @@
|
||||
diff --git a/frontier/profiling/moe/moe_vllm_kernel.py b/frontier/profiling/moe/moe_vllm_kernel.py
|
||||
--- a/frontier/profiling/moe/moe_vllm_kernel.py
|
||||
+++ b/frontier/profiling/moe/moe_vllm_kernel.py
|
||||
@@ -510 +510,4 @@ def profile_vllm_fused_moe(
|
||||
- config_dtype = get_config_dtype_str(base_dtype)
|
||||
+ config_dtype = get_config_dtype_str(
|
||||
+ base_dtype,
|
||||
+ use_fp8_w8a8=use_fp8,
|
||||
+ )
|
||||
@@ -0,0 +1,12 @@
|
||||
diff --git a/frontier/profiling/moe/moe_vllm_kernel.py b/frontier/profiling/moe/moe_vllm_kernel.py
|
||||
--- a/frontier/profiling/moe/moe_vllm_kernel.py
|
||||
+++ b/frontier/profiling/moe/moe_vllm_kernel.py
|
||||
@@ -232 +232 @@ def _invoke_kernel(
|
||||
- compute_type = tl.float16 # FP8 accumulates in FP16
|
||||
+ compute_type = tl.bfloat16
|
||||
@@ -510 +510,4 @@ def profile_vllm_fused_moe(
|
||||
- config_dtype = get_config_dtype_str(base_dtype)
|
||||
+ config_dtype = get_config_dtype_str(
|
||||
+ base_dtype,
|
||||
+ use_fp8_w8a8=use_fp8,
|
||||
+ )
|
||||
189
runs/frontier-multicase-sufficiency-v0/smoke/run_gpu_smoke.sh
Normal file
189
runs/frontier-multicase-sufficiency-v0/smoke/run_gpu_smoke.sh
Normal file
@@ -0,0 +1,189 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
OUTPUT_ROOT="${OUTPUT_ROOT:-/home/admin/cpfs/wjh/frontier-community-qwen235-smoke-20260715}"
|
||||
FRONTIER_ROOT="${FRONTIER_ROOT:-${OUTPUT_ROOT}/Frontier-d9cfeb6}"
|
||||
VENV_ROOT="${VENV_ROOT:-/tmp/wjh-frontier-vllm0102-smoke/.venv}"
|
||||
MODEL_ROOT="${MODEL_ROOT:-/home/admin/cpfs/wjh/models/Qwen/Qwen3-235B-A22B-FP8}"
|
||||
PROFILE_ROOT="${OUTPUT_ROOT}/profiles"
|
||||
LOG_DIR="${OUTPUT_ROOT}/logs"
|
||||
RESULT_DIR="${OUTPUT_ROOT}/results"
|
||||
SERVER_PORT="${SERVER_PORT:-18900}"
|
||||
SKIP_LINEAR="${SKIP_LINEAR:-0}"
|
||||
SERVING_ONLY="${SERVING_ONLY:-0}"
|
||||
SERVED_MODEL="qwen3-235b-community-smoke"
|
||||
SERVER_PID=""
|
||||
|
||||
mkdir -p "${PROFILE_ROOT}" "${LOG_DIR}" "${RESULT_DIR}"
|
||||
exec > >(tee -a "${LOG_DIR}/gpu_smoke.log") 2>&1
|
||||
|
||||
cleanup() {
|
||||
if [[ -n "${SERVER_PID}" ]] && kill -0 "${SERVER_PID}" 2>/dev/null; then
|
||||
kill -TERM -- "-${SERVER_PID}" 2>/dev/null || true
|
||||
for _ in $(seq 1 30); do
|
||||
if ! kill -0 "${SERVER_PID}" 2>/dev/null; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
kill -KILL -- "-${SERVER_PID}" 2>/dev/null || true
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT INT TERM
|
||||
|
||||
if [[ -z "${CUDA_VISIBLE_DEVICES:-}" ]]; then
|
||||
echo "ERROR: CUDA_VISIBLE_DEVICES must name exactly four allocated GPUs" >&2
|
||||
exit 1
|
||||
fi
|
||||
IFS=',' read -r -a GPU_IDS <<< "${CUDA_VISIBLE_DEVICES}"
|
||||
if [[ "${#GPU_IDS[@]}" -ne 4 ]]; then
|
||||
echo "ERROR: expected four allocated GPUs, got CUDA_VISIBLE_DEVICES=${CUDA_VISIBLE_DEVICES}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "LAUNCH_ECHO host=$(hostname) gpus=${CUDA_VISIBLE_DEVICES} model=${MODEL_ROOT} frontier=d9cfeb6 vllm=community-0.10.2 transformers=4.55.2 backend=FLASHINFER execution=eager kv=BF16 spec=off tasks=representative-FP8-linear/attention/MoE+TP4-allreduce+TP4-model-load+one-request skip_linear=${SKIP_LINEAR} serving_only=${SERVING_ONLY} hard_wall_cap=1800s hard_gpu_cap=2_H20h"
|
||||
date -u +"START_UTC=%Y-%m-%dT%H:%M:%SZ"
|
||||
nvidia-smi --query-gpu=index,name,memory.used,utilization.gpu --format=csv,noheader
|
||||
|
||||
test -x "${VENV_ROOT}/bin/python"
|
||||
test -f "${FRONTIER_ROOT}/pyproject.toml"
|
||||
test -f "${MODEL_ROOT}/config.json"
|
||||
|
||||
export PYTHONPATH="${FRONTIER_ROOT}${PYTHONPATH:+:${PYTHONPATH}}"
|
||||
export TOKENIZERS_PARALLELISM=false
|
||||
export VLLM_USE_V1=1
|
||||
export VLLM_ATTENTION_BACKEND=FLASHINFER
|
||||
export TORCH_CUDA_ARCH_LIST=9.0
|
||||
|
||||
cd "${FRONTIER_ROOT}"
|
||||
|
||||
if [[ "${SERVING_ONLY}" -eq 0 && "${SKIP_LINEAR}" -eq 0 ]]; then
|
||||
echo "STAGE linear_op"
|
||||
timeout 300 "${VENV_ROOT}/bin/python" -m frontier.profiling.linear_op.main \
|
||||
--disable_ray \
|
||||
--models Qwen3-235B-A22B-FP8 \
|
||||
--num_gpus 1 \
|
||||
--max_tokens 16 \
|
||||
--num_tokens_list 16 \
|
||||
--num_tensor_parallel_workers 4 \
|
||||
--profile_method cuda_event \
|
||||
--device h20 \
|
||||
--output_dir "${PROFILE_ROOT}" \
|
||||
--is_moe \
|
||||
--yes
|
||||
elif [[ "${SERVING_ONLY}" -eq 0 ]]; then
|
||||
echo "STAGE linear_op SKIPPED (existing artifact retained)"
|
||||
fi
|
||||
|
||||
if [[ "${SERVING_ONLY}" -eq 0 ]]; then
|
||||
echo "STAGE attention"
|
||||
timeout 300 "${VENV_ROOT}/bin/python" -m frontier.profiling.attention.main \
|
||||
--disable_ray \
|
||||
--models Qwen3-235B-A22B-FP8 \
|
||||
--num_gpus 1 \
|
||||
--max_model_len 40960 \
|
||||
--max_seq_len 128 \
|
||||
--min_batch_size 1 \
|
||||
--max_batch_size 1 \
|
||||
--batch_size_list 1 \
|
||||
--num_tensor_parallel_workers 4 \
|
||||
--max_pipeline_parallel_size 1 \
|
||||
--attention_backend FLASHINFER \
|
||||
--block_size 16 \
|
||||
--profile_only_prefill \
|
||||
--fixed_chunked_prefill_size 128 \
|
||||
--device h20 \
|
||||
--profile_method cuda_event \
|
||||
--output_dir "${PROFILE_ROOT}" \
|
||||
--yes
|
||||
|
||||
echo "STAGE moe"
|
||||
timeout 300 "${VENV_ROOT}/bin/python" -m frontier.profiling.moe.main \
|
||||
--disable_ray \
|
||||
--models Qwen3-235B-A22B-FP8 \
|
||||
--device h20 \
|
||||
--num_gpus 1 \
|
||||
--max_tokens 16 \
|
||||
--num_tokens_list 16 \
|
||||
--num_tensor_parallel_workers 4 \
|
||||
--expert_parallel_sizes 1 \
|
||||
--load_distributions uniform \
|
||||
--num_samples_per_distribution 1 \
|
||||
--routing_runtime_path standard_fused_topk \
|
||||
--gating_runtime_context prefill_hot \
|
||||
--profile_method cuda_event \
|
||||
--output_dir "${PROFILE_ROOT}" \
|
||||
--yes
|
||||
|
||||
echo "STAGE allreduce"
|
||||
timeout 180 "${VENV_ROOT}/bin/torchrun" \
|
||||
--standalone \
|
||||
--nnodes=1 \
|
||||
--nproc-per-node=4 \
|
||||
"${OUTPUT_ROOT}/scripts/allreduce_smoke.py" \
|
||||
| tee "${RESULT_DIR}/allreduce_tp4.jsonl"
|
||||
else
|
||||
echo "STAGES Frontier profiles and allreduce SKIPPED (existing artifacts retained)"
|
||||
fi
|
||||
|
||||
echo "STAGE serving"
|
||||
setsid "${VENV_ROOT}/bin/vllm" serve "${MODEL_ROOT}" \
|
||||
--host 127.0.0.1 \
|
||||
--port "${SERVER_PORT}" \
|
||||
--served-model-name "${SERVED_MODEL}" \
|
||||
--tensor-parallel-size 4 \
|
||||
--disable-custom-all-reduce \
|
||||
--quantization fp8 \
|
||||
--gpu-memory-utilization 0.80 \
|
||||
--kv-cache-dtype auto \
|
||||
--max-model-len 40960 \
|
||||
--max-num-batched-tokens 8192 \
|
||||
--max-num-seqs 64 \
|
||||
--no-enable-prefix-caching \
|
||||
--enable-chunked-prefill \
|
||||
--enforce-eager \
|
||||
--disable-log-requests \
|
||||
> "${LOG_DIR}/server.log" 2>&1 &
|
||||
SERVER_PID=$!
|
||||
|
||||
READY=0
|
||||
for _ in $(seq 1 180); do
|
||||
if curl -fsS --max-time 2 "http://127.0.0.1:${SERVER_PORT}/v1/models" \
|
||||
> "${RESULT_DIR}/models.json" 2>/dev/null; then
|
||||
READY=1
|
||||
break
|
||||
fi
|
||||
if ! kill -0 "${SERVER_PID}" 2>/dev/null; then
|
||||
echo "ERROR: vLLM server exited before readiness" >&2
|
||||
tail -200 "${LOG_DIR}/server.log" >&2 || true
|
||||
exit 1
|
||||
fi
|
||||
sleep 5
|
||||
done
|
||||
if [[ "${READY}" -ne 1 ]]; then
|
||||
echo "ERROR: vLLM server did not become ready within 900 seconds" >&2
|
||||
tail -200 "${LOG_DIR}/server.log" >&2 || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
curl -fsS --max-time 120 \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{"model":"qwen3-235b-community-smoke","prompt":"Hello","max_tokens":1,"temperature":0}' \
|
||||
"http://127.0.0.1:${SERVER_PORT}/v1/completions" \
|
||||
| tee "${RESULT_DIR}/one_request.json"
|
||||
echo
|
||||
jq -e '.choices | length == 1' "${RESULT_DIR}/one_request.json" >/dev/null
|
||||
|
||||
cleanup
|
||||
SERVER_PID=""
|
||||
|
||||
find "${PROFILE_ROOT}" -type f -maxdepth 5 -print -exec sha256sum {} \;
|
||||
sha256sum \
|
||||
"${RESULT_DIR}/allreduce_tp4.jsonl" \
|
||||
"${RESULT_DIR}/models.json" \
|
||||
"${RESULT_DIR}/one_request.json" \
|
||||
> "${RESULT_DIR}/results.sha256"
|
||||
nvidia-smi --query-gpu=index,name,memory.used,utilization.gpu --format=csv,noheader
|
||||
date -u +"END_UTC=%Y-%m-%dT%H:%M:%SZ"
|
||||
echo "GPU_SMOKE_COMPLETE"
|
||||
66
runs/frontier-multicase-sufficiency-v0/smoke/setup_env.sh
Executable file
66
runs/frontier-multicase-sufficiency-v0/smoke/setup_env.sh
Executable file
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
OUTPUT_ROOT="${OUTPUT_ROOT:-/home/admin/cpfs/wjh/frontier-community-qwen235-smoke-20260715}"
|
||||
FRONTIER_ROOT="${FRONTIER_ROOT:-${OUTPUT_ROOT}/Frontier-d9cfeb6}"
|
||||
VENV_ROOT="${VENV_ROOT:-/tmp/wjh-frontier-vllm0102-smoke/.venv}"
|
||||
LOG_DIR="${OUTPUT_ROOT}/logs"
|
||||
|
||||
export UV_HTTP_TIMEOUT="${UV_HTTP_TIMEOUT:-300}"
|
||||
|
||||
mkdir -p "${LOG_DIR}" "${OUTPUT_ROOT}/provenance"
|
||||
exec > >(tee -a "${LOG_DIR}/setup_env.log") 2>&1
|
||||
|
||||
echo "SETUP_ENV output=${OUTPUT_ROOT} frontier=${FRONTIER_ROOT} venv=${VENV_ROOT} python=/usr/local/bin/python3.12 vllm=0.10.2 transformers=4.55.2"
|
||||
|
||||
if [[ ! -f "${FRONTIER_ROOT}/pyproject.toml" ]]; then
|
||||
echo "ERROR: Frontier source is missing at ${FRONTIER_ROOT}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
uv venv --clear --python /usr/local/bin/python3.12 "${VENV_ROOT}"
|
||||
uv pip install \
|
||||
--python "${VENV_ROOT}/bin/python" \
|
||||
"vllm==0.10.2" \
|
||||
"transformers==4.55.2" \
|
||||
"flashinfer-python>=0.3,<0.4" \
|
||||
-e "${FRONTIER_ROOT}[test]"
|
||||
|
||||
"${VENV_ROOT}/bin/python" - <<'PY' | tee "${OUTPUT_ROOT}/provenance/environment.json"
|
||||
import importlib.metadata as metadata
|
||||
import json
|
||||
import platform
|
||||
|
||||
import flashinfer
|
||||
import frontier
|
||||
import torch
|
||||
import vllm
|
||||
|
||||
record = {
|
||||
"python": platform.python_version(),
|
||||
"torch": torch.__version__,
|
||||
"torch_cuda": torch.version.cuda,
|
||||
"vllm_import_version": vllm.__version__,
|
||||
"vllm_metadata_version": metadata.version("vllm"),
|
||||
"vllm_path": vllm.__file__,
|
||||
"transformers_metadata_version": metadata.version("transformers"),
|
||||
"tokenizers_metadata_version": metadata.version("tokenizers"),
|
||||
"flashinfer_metadata_version": metadata.version("flashinfer-python"),
|
||||
"flashinfer_path": flashinfer.__file__,
|
||||
"frontier_metadata_version": metadata.version("frontier-simulator"),
|
||||
"frontier_path": frontier.__path__[0],
|
||||
}
|
||||
print(json.dumps(record, indent=2, sort_keys=True))
|
||||
assert record["vllm_import_version"] == "0.10.2", record
|
||||
assert record["vllm_metadata_version"] == "0.10.2", record
|
||||
assert record["transformers_metadata_version"] == "4.55.2", record
|
||||
PY
|
||||
|
||||
uv pip freeze --python "${VENV_ROOT}/bin/python" > "${OUTPUT_ROOT}/provenance/requirements.freeze.txt"
|
||||
sha256sum \
|
||||
"${OUTPUT_ROOT}/provenance/environment.json" \
|
||||
"${OUTPUT_ROOT}/provenance/requirements.freeze.txt" \
|
||||
> "${OUTPUT_ROOT}/provenance/environment.sha256"
|
||||
|
||||
echo "SETUP_ENV_COMPLETE"
|
||||
Reference in New Issue
Block a user