fwi: refactor ss and granularity experiments

A common.nix file contains the shared stages
This commit is contained in:
2021-04-12 14:41:26 +02:00
parent e0a68c077c
commit 9aa07993b2
3 changed files with 84 additions and 113 deletions

View File

@@ -6,9 +6,12 @@
, bsc
, targetMachine
, stages
, garlicTools
, callPackage
}:
with stdenv.lib;
with garlicTools;
let
@@ -27,38 +30,24 @@ let
# "garlic/seq"
];
blocksize = [ 1 2 4 8 16 32 64 128 256 ];
blocksize = range2 1 256;
n = [
{nx=100; nz=100; ny=8000; ntpn=2; nn=1;}
];
n = [ {nx=100; nz=100; ny=8000; ntpn=2; nodes=1;} ];
};
# The c value contains something like:
# {
# n = { nx=500; ny=500; nz=500; }
# blocksize = 1;
# gitBranch = "garlic/tampi+send+oss+task";
# }
machineConfig = targetMachine.config;
# Generate the complete configuration for each unit
genConf = with bsc; c: targetMachine.config // rec {
expName = "fwi";
unitName = "${expName}-test";
genConf = c: targetMachine.config // rec {
expName = "fwi-granularity";
unitName = "${expName}"
+ "-bs${toString blocksize}"
+ "-${toString gitBranch}";
inherit (machineConfig) hw;
cc = icc;
inherit (c) gitBranch blocksize;
#nx = c.n.nx;
#ny = c.n.ny;
#nz = c.n.nz;
# Same but shorter:
inherit (c.n) nx ny nz ntpn nn;
inherit (c.n) nx ny nz ntpn nodes;
fwiInput = bsc.apps.fwi.input.override {
inherit (c.n) nx ny nz;
@@ -69,20 +58,19 @@ let
# Repeat the execution of each unit several times
loops = 10;
#loops = 1;
# Resources
cpusPerTask = hw.cpusPerSocket;
ntasksPerNode = ntpn;
nodes = nn;
qos = "debug";
time = "02:00:00";
jobName = unitName;
tracing = "no";
enableCTF = false;
# Enable permissions to write in the local storage
extraMounts = [ fs.local.temp ];
tempDir = fs.local.temp;
};
@@ -91,42 +79,9 @@ let
inherit varConf genConf;
};
exec = {nextStage, conf, ...}: stages.exec {
inherit nextStage;
pre = ''
CDIR=$PWD
if [[ "${conf.tracing}" == "yes" ]]; then
export NANOS6_CONFIG_OVERRIDE="version.instrument=ctf"
fi
EXECDIR="${fs.local.temp}/out/$GARLIC_USER/$GARLIC_UNIT/$GARLIC_RUN"
mkdir -p $EXECDIR
cd $EXECDIR
ln -fs ${conf.fwiInput}/InputModels InputModels || true
'';
argv = [
"${conf.fwiInput}/fwi_params.txt"
"${conf.fwiInput}/fwi_frequencies.txt"
conf.blocksize
"-1" # Fordward steps
"-1" # Backward steps
conf.ioFreq # Write/read frequency
];
post = ''
rm -rf Results || true
if [[ "${conf.tracing}" == "yes" ]]; then
mv trace_* $CDIR
fi
'';
};
common = callPackage ./common.nix {};
apps = bsc.garlic.apps;
# FWI program
program = {nextStage, conf, ...}: apps.fwi.solver.override {
inherit (conf) cc gitBranch fwiInput;
};
pipeline = stdexp.stdPipeline ++ [ exec program ];
inherit (common) fixBlocksize pipeline;
in