Make SMP configurable in benchmark CI

This commit is contained in:
Zejun Zhao
2024-12-13 14:39:16 +08:00
committed by Tate, Hongliang Tian
parent 104c8dfdde
commit e4beb6e0a7
2 changed files with 15 additions and 4 deletions

View File

@ -253,7 +253,8 @@ The `bench_result.json` file configures how benchmark results are processed and
}, },
// Optional runtime configurations for the benchmark. // Optional runtime configurations for the benchmark.
"runtime_config": { "runtime_config": {
"aster_scheme": "null" // Corresponds to Makefile parameters, IOMMU is enabled by default (SCHEME=iommu). "aster_scheme": "null", // Corresponds to Makefile parameters, IOMMU is enabled by default (SCHEME=iommu).
"smp": 1 // Number of SMP CPUs (default to 1).
} }
} }
``` ```

View File

@ -74,6 +74,7 @@ run_benchmark() {
local benchmark="$1" local benchmark="$1"
local run_mode="$2" local run_mode="$2"
local aster_scheme="$3" local aster_scheme="$3"
local smp="$4"
echo "Preparing libraries..." echo "Preparing libraries..."
prepare_libs prepare_libs
@ -89,10 +90,10 @@ run_benchmark() {
fi fi
# Prepare commands for Asterinas and Linux # Prepare commands for Asterinas and Linux
local asterinas_cmd="make run BENCHMARK=${benchmark} ${aster_scheme_cmd} ENABLE_KVM=1 RELEASE_LTO=1 NETDEV=tap VHOST=on 2>&1" local asterinas_cmd="make run BENCHMARK=${benchmark} ${aster_scheme_cmd} SMP=${smp} ENABLE_KVM=1 RELEASE_LTO=1 NETDEV=tap VHOST=on 2>&1"
local linux_cmd="/usr/local/qemu/bin/qemu-system-x86_64 \ local linux_cmd="/usr/local/qemu/bin/qemu-system-x86_64 \
--no-reboot \ --no-reboot \
-smp 1 \ -smp ${smp} \
-m 8G \ -m 8G \
-machine q35,kernel-irqchip=split \ -machine q35,kernel-irqchip=split \
-cpu Icelake-Server,-pcid,+x2apic \ -cpu Icelake-Server,-pcid,+x2apic \
@ -174,8 +175,17 @@ main() {
done done
fi fi
local smp
if [[ -f "$bench_result" ]]; then
smp=$(jq -r '.runtime_config.smp // 1' "$bench_result")
else
for job in "${BENCHMARK_ROOT}/${benchmark}"/bench_results/*; do
[[ -f "$job" ]] && smp=$(jq -r '.runtime_config.smp // 1' "$job") && break
done
fi
# Run the benchmark # Run the benchmark
run_benchmark "$benchmark" "$run_mode" "$aster_scheme" run_benchmark "$benchmark" "$run_mode" "$aster_scheme" "$smp"
# Parse results if benchmark configuration exists # Parse results if benchmark configuration exists
if [[ -f "$bench_result" ]]; then if [[ -f "$bench_result" ]]; then