diff --git a/garlic/exp/fwi/common.nix b/garlic/exp/fwi/common.nix index 5ac38ea..ebaf371 100644 --- a/garlic/exp/fwi/common.nix +++ b/garlic/exp/fwi/common.nix @@ -7,17 +7,29 @@ with stdenv.lib; +# Common definitions used by fwi experiments rec { - # We split these into a separate group so we can remove the blocksize - # later. - forkJoinBranches = [ "garlic/mpi+send+omp+fork" ]; + branchesWithoutBlocksize = [ + "garlic/mpi+send+omp+fork" + "garlic/mpi+send+seq" + ]; # Returns true if the given config is in the forkJoinBranches list - isForkJoin = c: any (e: c.gitBranch == e) forkJoinBranches; + needsBlocksize = c: ! any (e: c.gitBranch == e) branchesWithoutBlocksize; # Set the blocksize to null for the fork join branch - fixBlocksize = c: if (isForkJoin c) then (c // { blocksize = null; }) else c; + fixBlocksize = c: if (needsBlocksize c) then c + else (c // { blocksize = null; }); + + # Generate the configs by filtering the unneded blocksizes + getConfigs = {varConf, genConf}: + let + allConfigs = stdexp.buildConfigs { inherit varConf genConf; }; + in + # The unique function ensures that we only run one config for the fork + # join branch, even if we have multiple blocksizes. + unique (map fixBlocksize allConfigs); exec = {nextStage, conf, ...}: stages.exec { inherit nextStage; @@ -35,7 +47,7 @@ rec { argv = [ "${conf.fwiInput}/fwi_params.txt" "${conf.fwiInput}/fwi_frequencies.txt" - ] ++ optional (! isForkJoin conf) conf.blocksize ++ [ + ] ++ optional (needsBlocksize conf) conf.blocksize ++ [ "-1" # Fordward steps "-1" # Backward steps conf.ioFreq # Write/read frequency diff --git a/garlic/exp/fwi/granularity.nix b/garlic/exp/fwi/granularity.nix index df3ceb2..5b09e5a 100644 --- a/garlic/exp/fwi/granularity.nix +++ b/garlic/exp/fwi/granularity.nix @@ -19,21 +19,9 @@ let # Initial variable configuration varConf = { - gitBranch = [ -# "garlic/tampi+send+oss+task" - "garlic/tampi+isend+oss+task" -# "garlic/mpi+send+omp+task" -# "garlic/mpi+send+oss+task" -# "garlic/mpi+send+seq" -# "garlic/oss+task" -# "garlic/omp+task" -# "garlic/seq" - ]; - + gitBranch = [ "garlic/tampi+isend+oss+task" ]; blocksize = range2 1 256; - n = [ {nx=100; nz=100; ny=8000; ntpn=2; nodes=1;} ]; - }; machineConfig = targetMachine.config; @@ -74,14 +62,13 @@ let }; - # Compute the array of configurations - configs = stdexp.buildConfigs { - inherit varConf genConf; - }; - common = callPackage ./common.nix {}; - inherit (common) fixBlocksize pipeline; + inherit (common) getConfigs pipeline; + + configs = getConfigs { + inherit varConf genConf; + }; in diff --git a/garlic/exp/fwi/ss.nix b/garlic/exp/fwi/ss.nix index ff8c4ec..25ff81d 100644 --- a/garlic/exp/fwi/ss.nix +++ b/garlic/exp/fwi/ss.nix @@ -18,8 +18,6 @@ with garlicTools; let - common = callPackage ./common.nix {}; - inherit (targetMachine) fs; # Initial variable configuration @@ -81,17 +79,14 @@ let tempDir = fs.local.temp; }; - # Compute the array of configurations - allConfigs = stdexp.buildConfigs { + common = callPackage ./common.nix {}; + + inherit (common) getConfigs pipeline; + + configs = getConfigs { inherit varConf genConf; }; - # The unique function ensures that we only run one config for the fork - # join branch, even if we have multiple blocksizes. - configs = unique (map fixBlocksize allConfigs); - - inherit (common) fixBlocksize pipeline; - in stdexp.genExperiment { inherit configs pipeline; }