forked from mooncake-track/Mooncake
88 lines
2.9 KiB
Bash
Executable File
88 lines
2.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Copyright 2024 KVCache.AI
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
# One-shot driver for the memory-fabric demo: runs the conformance suite, the
|
|
# routing / fault-fallback demo, the CXL/NUMA tier benchmark, and the GPU
|
|
# NVLink benchmark, collects their CSV/JSON artifacts, and renders figures.
|
|
#
|
|
# Usage: run_demo.sh [BUILD_DIR]
|
|
# BUILD_DIR defaults to the repository's ./build.
|
|
# Artifacts and figures land in $MC_FABRIC_RESULTS (default: ./fabric-results).
|
|
|
|
set -u
|
|
|
|
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
REPO_ROOT="$(cd "$HERE/../../.." && pwd)"
|
|
BUILD_DIR="${1:-$REPO_ROOT/build}"
|
|
RESULTS="${MC_FABRIC_RESULTS:-$REPO_ROOT/fabric-results}"
|
|
export MC_FABRIC_RESULTS="$RESULTS"
|
|
mkdir -p "$RESULTS"
|
|
|
|
TE_TESTS="$BUILD_DIR/mooncake-transfer-engine/tests"
|
|
STORE_BENCH="$BUILD_DIR/mooncake-store/benchmarks"
|
|
|
|
section() { printf '\n========== %s ==========\n' "$1"; }
|
|
have() { [ -x "$1" ]; }
|
|
|
|
section "1. Cross-backend conformance"
|
|
if have "$TE_TESTS/conformance_runner"; then
|
|
"$TE_TESTS/conformance_runner" --json "$RESULTS/conformance.json" \
|
|
2>/dev/null | tee "$RESULTS/conformance.txt"
|
|
else
|
|
echo "conformance_runner not built (configure with -DBUILD_UNIT_TESTS=ON)"
|
|
fi
|
|
|
|
section "2. Probed capabilities + routing / fault fallback"
|
|
if have "$TE_TESTS/fabric_cli"; then
|
|
{
|
|
"$TE_TESTS/fabric_cli" probe
|
|
echo
|
|
"$TE_TESTS/fabric_cli" select
|
|
echo
|
|
"$TE_TESTS/fabric_cli" cost
|
|
if [ -d "$BUILD_DIR/plugins" ]; then
|
|
echo
|
|
"$TE_TESTS/fabric_cli" plugins "$BUILD_DIR/plugins"
|
|
fi
|
|
} 2>/dev/null | tee "$RESULTS/fabric_cli.txt"
|
|
else
|
|
echo "fabric_cli not built"
|
|
fi
|
|
|
|
section "3. Host fabric topology"
|
|
python3 "$HERE/topology.py" 2>&1 | tee "$RESULTS/topology.txt"
|
|
|
|
section "4. CXL/NUMA memory tier benchmark"
|
|
if have "$STORE_BENCH/tier_bench"; then
|
|
"$STORE_BENCH/tier_bench" --csv "$RESULTS/tier_bench.csv" \
|
|
--nvme_path "$RESULTS/.tier_nvme.bin" --trace 16000 \
|
|
2>/dev/null | tee "$RESULTS/tier_bench.txt"
|
|
rm -f "$RESULTS/.tier_nvme.bin"
|
|
else
|
|
echo "tier_bench not built (configure with -DWITH_STORE=ON)"
|
|
fi
|
|
|
|
section "5. Real GPU NVLink vs host-staging"
|
|
MC_GPU_BENCH_CSV="$RESULTS/gpu_bench.csv" \
|
|
python3 "$HERE/gpu_bench.py" 2>&1 | tee "$RESULTS/gpu_bench.txt"
|
|
|
|
section "6. Rendering figures"
|
|
python3 "$HERE/plot.py"
|
|
|
|
section "7. Assembling summary.html"
|
|
python3 "$HERE/summary.py"
|
|
|
|
printf '\nArtifacts and figures in %s\n' "$RESULTS"
|