Remove old stages and update some

This commit is contained in:
Rodrigo Arias 2020-10-09 20:12:52 +02:00
parent 27bc977590
commit 4de20d3aa5
12 changed files with 65 additions and 348 deletions

View File

@ -1,23 +0,0 @@
{
stdenv
}:
{
program
}:
# This stage provides a clean environment to run experiments
stdenv.mkDerivation {
name = "broom";
preferLocalBuild = true;
phases = [ "installPhase" ];
installPhase = ''
cat > $out <<EOF
#!/bin/sh
# Removes all environment variables
/usr/bin/env -i ${program}
EOF
chmod +x $out
'';
}

View File

@ -1,64 +0,0 @@
{
pkgs
, callPackage
, callPackages
}:
let
garlic = {
# Load some helper functions to generate app variants
inherit (import ./gen.nix) genApps genApp genConfigs;
mpptest = callPackage ./mpptest { };
ppong = callPackage ./ppong {
mpi = pkgs.mpi;
};
nbody = callPackage ./nbody {
cc = pkgs.icc;
mpi = pkgs.impi;
tampi = pkgs.tampi;
gitBranch = "garlic/seq";
};
runWrappers = {
sbatch = callPackage ./sbatch.nix { };
srun = callPackage ./srun.nix { };
launch = callPackage ./launcher.nix { };
control = callPackage ./control.nix { };
nixsetup= callPackage ./nix-setup.nix { };
argv = callPackage ./argv.nix { };
statspy = callPackage ./statspy.nix { };
extrae = callPackage ./extrae.nix { };
stagen = callPackage ./stagen.nix { };
};
# Perf is tied to a linux kernel specific version
linuxPackages = pkgs.linuxPackages_4_4;
perfWrapper = callPackage ./perf.nix {
perf = pkgs.linuxPackages.perf;
};
exp = {
noise = callPackage ./exp/noise.nix { };
nbody = {
bs = callPackage ./exp/nbody/bs.nix {
pkgs = pkgs // garlic;
};
mpi = callPackage ./exp/nbody/mpi.nix { };
};
osu = rec {
latency-internode = callPackage ./exp/osu/latency.nix { };
latency-intranode = callPackage ./exp/osu/latency.nix {
interNode = false;
};
latency = latency-internode;
};
};
};
in
garlic

View File

@ -1,25 +0,0 @@
{
stdenv
}:
{
program
}:
stdenv.mkDerivation {
name = "envRecord";
preferLocalBuild = true;
phases = [ "installPhase" ];
installPhase = ''
cat > $out <<EOF
#!/bin/sh
>&2 echo ----- ENV BEGIN -------
>&2 /usr/bin/env
>&2 echo ----- ENV END -------
exec ${program} \''${argv[@]}
EOF
chmod +x $out
'';
}

View File

@ -1,27 +1,25 @@
{ {
stdenv stdenv
, bash , garlicTools
#, writeShellScriptBin
}: }:
{ {
program nextStage
, configFile , configFile
, traceLib , traceLib
, extrae , extrae
}: }:
#writeShellScriptBin "extraeWrapper" '' with garlicTools;
# export EXTRAE_HOME=${extrae}
# export LD_PRELOAD=${extrae}/lib/lib${traceLib}trace.so:$LD_PRELOAD
# export EXTRAE_CONFIG_FILE=${configFile}
# exec ${program}
#''
stdenv.mkDerivation { let
program = stageProgram nextStage;
in
stdenv.mkDerivation {
name = "extrae"; name = "extrae";
preferLocalBuild = true;
phases = [ "installPhase" ]; phases = [ "installPhase" ];
preferLocalBuild = true;
dontPatchShebangs = true;
installPhase = '' installPhase = ''
cat > $out <<EOF cat > $out <<EOF
#!/bin/sh #!/bin/sh
@ -33,4 +31,4 @@ stdenv.mkDerivation {
EOF EOF
chmod +x $out chmod +x $out
''; '';
} }

View File

@ -1,34 +0,0 @@
let
lib = import <nixpkgs/lib>;
gen = rec {
# genAttrSets "a" ["hello" "world"]
# [ { a = "hello"; } { a = "world"; } ]
genAttrSets = (name: arr: (map (x: {${name}=x; })) arr);
# addAttrSets "a" [1 2] {e=4;}
# [ { a = 1; e = 4; } { a = 2; e = 4; } ]
addAttrSets = (name: arr: set: (map (x: set // {${name}=x; })) arr);
# attrToList {a=1;}
# [ { name = "a"; value = 1; } ]
attrToList = (set: map (name: {name=name; value=set.${name};} ) (builtins.attrNames set));
# mergeConfig [{e=1;}] {name="a"; value=[1 2]
# [ { a = 1; e = 1; } { a = 2; e = 1; } ]
mergeConfig = (arr: new: lib.flatten ( map (x: addAttrSets new.name new.value x) arr));
# genConfigs {a=[1 2]; b=[3 4];}
# [ { a = 1; b = 3; } { a = 1; b = 4; } { a = 2; b = 3; } { a = 2; b = 4; } ]
genConfigs = (config: lib.foldl mergeConfig [{}] (attrToList config));
# Generate multiple app versions by override with each config
genApp = (app: configs: map (conf: app.override conf // {conf=conf;}) configs);
# Generate app version from an array of apps
genApps = (apps: configs:
lib.flatten (map (app: genApp app configs) apps));
};
in
gen

View File

@ -1,32 +0,0 @@
{
stdenv
}:
{
program
, nixsetup
}:
stdenv.mkDerivation {
name = "nixsetup";
preferLocalBuild = true;
phases = [ "installPhase" ];
dontPatchShebangs = true;
installPhase = ''
cat > $out <<EOF
#!/bin/sh -ex
>&2 echo Running nixsetup stage
env
# We need to enter the nix namespace first, in order to have /nix
# available, so we use this hack:
if [ ! -e /nix ]; then
exec ${nixsetup} \$0
fi
exec ${program}
EOF
chmod +x $out
'';
}

View File

@ -1,24 +0,0 @@
{
stdenv
, bash
, perf
}:
{
program
, perfArgs ? "record -a"
}:
stdenv.mkDerivation {
name = "perfWrapper";
preferLocalBuild = true;
phases = [ "installPhase" ];
installPhase = ''
cat > $out <<EOF
#!/bin/sh
exec ${perf}/bin/perf ${perfArgs} ${program}
EOF
chmod +x $out
'';
}

View File

@ -1,55 +0,0 @@
{
stdenv
, bash
, extrae
, writeShellScriptBin
, jq
}:
{
stages
, conf
, experimentName ? "run"
}:
with stdenv.lib;
let
dStages = foldr (stageFn: {conf, prevStage, stages}: {
conf = conf;
prevStage = stageFn {stage=prevStage; conf=conf;};
stages = [ (stageFn {stage=prevStage; conf=conf;}) ] ++ stages;
})
{conf=conf; stages=[]; prevStage=null;} stages;
stageProgram = stage:
if stage ? programPath
then "${stage}${stage.programPath}" else "${stage}";
linkStages = imap1 (i: s: {
name = "${toString i}-${baseNameOf s.name}";
path = stageProgram s;
}) dStages.stages;
createLinks = builtins.concatStringsSep "\n"
(map (x: "ln -s ${x.path} $out/bin/${x.name}") linkStages);
firstStageLink = (x: x.name) (elemAt linkStages 0);
in
stdenv.mkDerivation {
name = "stagen";
preferLocalBuild = true;
phases = [ "installPhase" ];
buildInputs = [ jq ];
installPhase = ''
mkdir -p $out/bin
${createLinks}
ln -s ${firstStageLink} $out/bin/${experimentName}
cat > $out/config.raw << EOF
${builtins.toJSON conf}
EOF
jq . $out/config.raw > $out/config.json
rm $out/config.raw
'';
}

View File

@ -1,29 +0,0 @@
{
stdenv
, bash
}:
{
program
, outputDir ? "."
}:
stdenv.mkDerivation {
name = "statspy";
preferLocalBuild = true;
phases = [ "installPhase" ];
programPath = "/bin/${name}";
installPhase = ''
mkdir -p $out/bin
cat > $out/bin/${name} <<EOF
#!/bin/sh
mkdir -p ${outputDir}
cat /proc/[0-9]*/stat | sort -n > ${outputDir}/statspy.\$(date +%s.%3N).begin
${program}
cat /proc/[0-9]*/stat | sort -n > ${outputDir}/statspy.\$(date +%s.%3N).end
EOF
chmod +x $out/bin/${name}
'';
}

View File

@ -1,17 +1,23 @@
{ {
stdenv stdenv
, bash
, strace , strace
, garlicTools
}: }:
{ {
program nextStage
}: }:
stdenv.mkDerivation { with garlicTools;
let
program = stageProgram nextStage;
in
stdenv.mkDerivation {
name = "strace"; name = "strace";
preferLocalBuild = true;
phases = [ "installPhase" ]; phases = [ "installPhase" ];
preferLocalBuild = true;
dontPatchShebangs = true;
installPhase = '' installPhase = ''
cat > $out <<EOF cat > $out <<EOF
#!/bin/sh #!/bin/sh
@ -20,4 +26,4 @@ stdenv.mkDerivation {
EOF EOF
chmod +x $out chmod +x $out
''; '';
} }

View File

@ -1,17 +1,23 @@
{ {
stdenv stdenv
, bash
, valgrind , valgrind
, garlicTools
}: }:
{ {
program nextStage
}: }:
stdenv.mkDerivation { with garlicTools;
let
program = stageProgram nextStage;
in
stdenv.mkDerivation {
name = "valgrind"; name = "valgrind";
preferLocalBuild = true;
phases = [ "installPhase" ]; phases = [ "installPhase" ];
preferLocalBuild = true;
dontPatchShebangs = true;
installPhase = '' installPhase = ''
cat > $out <<EOF cat > $out <<EOF
#!/bin/sh #!/bin/sh
@ -20,4 +26,4 @@ stdenv.mkDerivation {
EOF EOF
chmod +x $out chmod +x $out
''; '';
} }

View File

@ -207,16 +207,9 @@ let
stages = { stages = {
sbatch = callPackage ./garlic/stages/sbatch.nix { }; sbatch = callPackage ./garlic/stages/sbatch.nix { };
srun = callPackage ./garlic/stages/srun.nix { }; srun = callPackage ./garlic/stages/srun.nix { };
launch = callPackage ./garlic/stages/launcher { };
control = callPackage ./garlic/stages/control.nix { }; control = callPackage ./garlic/stages/control.nix { };
nixsetup = callPackage ./garlic/stages/nix-setup.nix { };
exec = callPackage ./garlic/stages/exec.nix { }; exec = callPackage ./garlic/stages/exec.nix { };
statspy = callPackage ./garlic/stages/statspy.nix { };
extrae = callPackage ./garlic/stages/extrae.nix { }; extrae = callPackage ./garlic/stages/extrae.nix { };
stagen = callPackage ./garlic/stages/stagen.nix { };
perf = callPackage ./garlic/stages/perf.nix { };
broom = callPackage ./garlic/stages/broom.nix { };
envRecord = callPackage ./garlic/stages/envRecord.nix { };
valgrind = callPackage ./garlic/stages/valgrind.nix { }; valgrind = callPackage ./garlic/stages/valgrind.nix { };
isolate = callPackage ./garlic/stages/isolate { }; isolate = callPackage ./garlic/stages/isolate { };
trebuchet = callPackage ./garlic/stages/trebuchet.nix { }; trebuchet = callPackage ./garlic/stages/trebuchet.nix { };