From 53dca32469c8af1f3267d84703a97c787352a3a6 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 9 Oct 2020 17:19:00 +0200 Subject: [PATCH] Simplify experiment --- garlic/exp/nbody/extrae.xml | 210 ------------------------------------ garlic/exp/nbody/test.nix | 28 ++--- garlic/stdexp.nix | 19 +++- 3 files changed, 25 insertions(+), 232 deletions(-) delete mode 100644 garlic/exp/nbody/extrae.xml diff --git a/garlic/exp/nbody/extrae.xml b/garlic/exp/nbody/extrae.xml deleted file mode 100644 index 45a7574..0000000 --- a/garlic/exp/nbody/extrae.xml +++ /dev/null @@ -1,210 +0,0 @@ - - - - - - - - - - - - - - - - - 1-3 - - 1-5 - - 1-3 - - 1-3 - - 1-3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PAPI_TOT_INS,PAPI_TOT_CYC - - - - - - - - - - - - - - - - - TRACE - - 5 - - /scratch - - /gpfs/scratch/bsc41/bsc41273 - - - - - - 5000000 - - - - - - - - /gpfs/scratch/bsc41/bsc41273/control - - - - - - - 10M - - - - - - - - - - - 500u - - - - - - - - - - - - - - - - - - - - diff --git a/garlic/exp/nbody/test.nix b/garlic/exp/nbody/test.nix index 41768bc..8c0d5a3 100644 --- a/garlic/exp/nbody/test.nix +++ b/garlic/exp/nbody/test.nix @@ -32,41 +32,27 @@ let cpuBind = "sockets,verbose"; }; - confMachine = targetMachine.config; - # Compute the array of configurations configs = stdexp.buildConfigs { var = confUnit; - fixed = confMachine // confExperiment; + fixed = targetMachine.config // confExperiment; }; exec = {nextStage, conf, ...}: with conf; stages.exec { inherit nextStage; argv = [ "-t" timesteps "-p" particles ]; - env = ""; }; - # We may be able to use overlays by invoking the fix function directly, but we - # have to get the definition of the bsc packages and the garlic ones as - # overlays. program = {nextStage, conf, ...}: with conf; let - # We set the mpi implementation to the one specified in the conf, so all - # packages in bsc will use that one. - customPkgs = stdexp.genPkgs (self: super: { - bsc = super.bsc // { mpi = conf.mpi; }; - }); + customPkgs = stdexp.replaceMpi conf.mpi; in - customPkgs.apps.nbody.override { - inherit cc blocksize mpi gitBranch; - }; + customPkgs.apps.nbody.override { + inherit cc blocksize mpi gitBranch; + }; - # Generate the experimental units - units = map (c: stages.unit { - conf = c; - stages = stdexp.stdStages ++ [ exec program ]; - }) configs; + pipeline = stdexp.stdStages ++ [ exec program ]; in - stdexp.buildExperiment units + stdexp.genExperiment { inherit configs pipeline; } diff --git a/garlic/stdexp.nix b/garlic/stdexp.nix index 2209d00..974151e 100644 --- a/garlic/stdexp.nix +++ b/garlic/stdexp.nix @@ -15,7 +15,7 @@ in rec { /* Takes a list of units and builds an experiment, after executing the trebuchet and the isolate stages. Returns the trebuchet stage. */ - buildExperiment = units: stages.trebuchet { + buildTrebuchet = units: stages.trebuchet { inherit (machineConf) nixPrefix; nextStage = stages.isolate { inherit (machineConf) nixPrefix; @@ -81,4 +81,21 @@ rec { newOverlay ]; }; + + replaceMpi = mpi: genPkgs (self: super: { + bsc = super.bsc // { inherit mpi; }; + }); + + # Generate the experimental units + genUnits = {configs, pipeline}: map (c: stages.unit { + conf = c; + stages = pipeline; + }) configs; + + # Generate the complete experiment + genExperiment = {configs, pipeline}: + let + units = genUnits { inherit configs pipeline; }; + in + buildTrebuchet units; }