From d7ef22936a1f57e4bc91ca69ca0ba773f53664cf Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Mon, 7 Oct 2024 13:33:53 +0200 Subject: [PATCH] Add SPEC CPU mini with a subset of benchmarks --- overlay.nix | 1 + pkgs/spec-cpu/default.nix | 2 ++ pkgs/spec-cpu/mini.nix | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 pkgs/spec-cpu/mini.nix diff --git a/overlay.nix b/overlay.nix index 5164c54..2840409 100644 --- a/overlay.nix +++ b/overlay.nix @@ -13,6 +13,7 @@ final: prev: spec-cpu-tools = final.callPackage ./pkgs/spec-cpu/tools.nix { }; spec-cpu = final.callPackage ./pkgs/spec-cpu/default.nix { }; + spec-cpu-mini = final.callPackage ./pkgs/spec-cpu/mini.nix { }; spec-cpu-clang = final.callPackage ./pkgs/spec-cpu/default.nix { stdenv = final.stdenvClangEpi; }; blis = ((prev.blis.override { diff --git a/pkgs/spec-cpu/default.nix b/pkgs/spec-cpu/default.nix index ef8df43..56cd2eb 100644 --- a/pkgs/spec-cpu/default.nix +++ b/pkgs/spec-cpu/default.nix @@ -10,6 +10,7 @@ , autoPatchelfHook , libxcrypt-legacy , lib +, benchSize ? "test" }: stdenv.mkDerivation rec { @@ -27,6 +28,7 @@ stdenv.mkDerivation rec { runcpu \ --verbose=80 \ --tune=base \ + --size=${benchSize} \ --output_root=$PWD/out \ --config=$PWD/config.cfg \ --define build_ncpus=$NIX_BUILD_CORES \ diff --git a/pkgs/spec-cpu/mini.nix b/pkgs/spec-cpu/mini.nix new file mode 100644 index 0000000..674e682 --- /dev/null +++ b/pkgs/spec-cpu/mini.nix @@ -0,0 +1,39 @@ +{ + stdenv +, spec-cpu +}: + +stdenv.mkDerivation rec { + pname = "spec-cpu-mini"; + version = spec-cpu.version; + src = null; + unpackPhase = "true"; + + # Select only a subset of the benchmarks: + # https://www.spec.org/cpu2017/Docs/#benchdocs + benchList = [ + # -- SPECspeed 2017 Integer -- + "600.perlbench_s" + "602.gcc_s" + "605.mcf_s" + "620.omnetpp_s" + #"623.xalancbmk_s" # Big + #"625.x264_s" # Big + "631.deepsjeng_s" + "641.leela_s" + "648.exchange2_s" + "657.xz_s" + ]; + + dontConfigure = true; + dontBuild = true; + installPhase = '' + mkdir -p $out/benchspec/CPU + for bench in $benchList; do + cp -a ${spec-cpu}/benchspec/CPU/$bench $out/benchspec/CPU/ + done + ''; + enableParallelBuilding = false; + hardeningDisable = [ "all" ]; + dontStrip = true; +}