Add SPEC launcher
This commit is contained in:
parent
7e68d432f9
commit
3bcc4255db
24
JOURNAL.md
24
JOURNAL.md
@ -5149,3 +5149,27 @@ and "integer" variants and removing a couple of large benchmarks.
|
||||
|
||||
Still, the closure is gigantic, as they are collecting the environment during
|
||||
the build phase and that makes the result depend on the build packages.
|
||||
|
||||
## 2024-10-09
|
||||
|
||||
One of the problems with the `speccmds.cmd` file is that is assumes that it can
|
||||
write the output of the benchmarks in the same place that the binaries are
|
||||
located.
|
||||
|
||||
hut% cat benchspec/CPU/602.gcc_s/run/run_base_test_nix-m64.0000/speccmds.cmd
|
||||
-r
|
||||
-N C
|
||||
-C /build/out/benchspec/CPU/602.gcc_s/run/run_base_test_nix-m64.0000
|
||||
-o t1.opts-O3_-finline-limit_50000.out -e t1.opts-O3_-finline-limit_50000.err ../run_base_test_nix-m64.0000/sgcc_base.nix-m64 t1.c -O3 -finline-limit=50000 -o t1.opts-O3_-finline-limit_50000.s > t1.opts-O3_-finline-limit_50000.out 2>> t1.opts-O3_-finline-limit_50000.err
|
||||
|
||||
We can address this problem by modifying the `-C ...` command and just use `-C
|
||||
602.gcc_s` (not sure if it creates it directly). Then we need to modify the
|
||||
../run... part to use the full path of the binary.
|
||||
|
||||
hut% cat speccmds.cmd | sed '/^-C/d'
|
||||
-r
|
||||
-N C
|
||||
-o t1.opts-O3_-finline-limit_50000.out -e t1.opts-O3_-finline-limit_50000.err ../run_base_test_nix-m64.0000/sgcc_base.nix-m64 t1.c -O3 -finline-limit=50000 -o t1.opts-O3_-finline-limit_50000.s > t1.opts-O3_-finline-limit_50000.out 2>> t1.opts-O3_-finline-limit_50000.err
|
||||
|
||||
I can create a symlink to the benchmark directory, so it finds it at
|
||||
`../run_base_test_nix-m64.0000`.
|
||||
|
@ -15,6 +15,7 @@ final: prev:
|
||||
spec-cpu = final.callPackage ./pkgs/spec-cpu/default.nix { };
|
||||
spec-cpu-mini = final.callPackage ./pkgs/spec-cpu/mini.nix { };
|
||||
specinvoke = final.callPackage ./pkgs/spec-cpu/specinvoke.nix { };
|
||||
speclaunch = final.callPackage ./pkgs/spec-cpu/speclaunch.nix { };
|
||||
spec-cpu-clang = final.callPackage ./pkgs/spec-cpu/default.nix { stdenv = final.stdenvClangEpi; };
|
||||
|
||||
blis = ((prev.blis.override {
|
||||
|
65
pkgs/spec-cpu/launcher.sh
Normal file
65
pkgs/spec-cpu/launcher.sh
Normal file
@ -0,0 +1,65 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
if [ -z "$SPEC" ]; then
|
||||
SPEC=$(spec-cpu-mini)
|
||||
fi
|
||||
|
||||
if [ -z "$SPEC" ]; then
|
||||
echo "cannot find spec, set SPEC variable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
where=$TMPDIR
|
||||
if [ -z "$where" ]; then
|
||||
if [ -d /tmp ]; then
|
||||
where=/tmp
|
||||
else
|
||||
where=$PWD
|
||||
fi
|
||||
fi
|
||||
|
||||
cwd=$(readlink -f $where)
|
||||
# Place the outcome here
|
||||
wd="$cwd/spec"
|
||||
mkdir -p "$wd"
|
||||
|
||||
benchniter=1
|
||||
benchsize=test
|
||||
benchtune=base
|
||||
|
||||
echo "--- Placing output in $wd ---"
|
||||
|
||||
printf 'benchmark\tsize\ttune\titer\ttime_s\n' > "$wd/time.csv"
|
||||
|
||||
for srcbench in $SPEC/benchspec/CPU/*; do
|
||||
name=$(basename $srcbench)
|
||||
bench="$wd/$name"
|
||||
rm -rf "$bench"
|
||||
cp -r "$srcbench" "$bench"
|
||||
chmod +w -R "$bench"
|
||||
|
||||
rundir="$bench/run/run_${benchtune}_${benchsize}_nix-m64.0000"
|
||||
sed -i '/^-C/d' "$rundir/speccmds.cmd"
|
||||
echo "--- Running $name for $benchniter iterations ---"
|
||||
(
|
||||
#set -x
|
||||
cd $rundir
|
||||
specinvoke -i $benchniter -E speccmds.cmd > /dev/null
|
||||
#set +x
|
||||
)
|
||||
# Print time
|
||||
awk '/^run [0-9]* elapsed time/{printf \
|
||||
"%s\t%s\t%s\t%s\t%s\n", \
|
||||
"'$name'","'$benchsize'","'$benchtune'",$2,$7}' \
|
||||
"$rundir/speccmds.out" > "$rundir/time.csv"
|
||||
|
||||
cat "$rundir/time.csv"
|
||||
|
||||
# Accumulate in main CSV
|
||||
cat "$rundir/time.csv" >> "$wd/time.csv"
|
||||
done
|
||||
|
||||
echo "--- RESULTS in $wd/time.csv ---"
|
||||
cat "$wd/time.csv"
|
21
pkgs/spec-cpu/speclaunch.nix
Normal file
21
pkgs/spec-cpu/speclaunch.nix
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
stdenv
|
||||
, bash
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "speclaunch";
|
||||
src = ./launcher.sh;
|
||||
dontUnpack = true;
|
||||
dontConfigure = true;
|
||||
dontBuild = true;
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp $src $out/bin/speclaunch
|
||||
chmod +x $out/bin/speclaunch
|
||||
'';
|
||||
buildInputs = [ bash ];
|
||||
enableParallelBuilding = false;
|
||||
hardeningDisable = [ "all" ];
|
||||
dontStrip = true;
|
||||
}
|
Loading…
Reference in New Issue
Block a user