bscpkgs/garlic/exp/fwi/test.nix

133 lines
2.7 KiB
Nix
Raw Normal View History

2020-10-30 22:58:03 +08:00
{
stdenv
, stdexp
, bsc
, targetMachine
, stages
}:
with stdenv.lib;
let
inherit (targetMachine) fs;
2020-10-30 22:58:03 +08:00
# Initial variable configuration
varConf = {
gitBranch = [
# "garlic/tampi+send+oss+task"
2021-03-05 01:41:24 +08:00
# "garlic/mpi+send+omp+task"
"garlic/mpi+send+oss+task"
2021-03-05 01:41:24 +08:00
# "garlic/mpi+send+seq"
# "garlic/oss+task"
# "garlic/omp+task"
# "garlic/seq"
];
2021-03-05 01:41:24 +08:00
#blocksize = [ 1 2 4 8 16 32 ];
blocksize = [ 1 2 4 8 ];
n = [
#{nx=500; nz=500; ny=1000; ntpn=1; nn=1;}
{nx=500; nz=500; ny=2000; ntpn=2; nn=1;}
];
2020-10-30 22:58:03 +08:00
};
# The c value contains something like:
# {
# n = { nx=500; ny=500; nz=500; }
# blocksize = 1;
# gitBranch = "garlic/tampi+send+oss+task";
# }
machineConfig = targetMachine.config;
2020-10-30 22:58:03 +08:00
# Generate the complete configuration for each unit
genConf = with bsc; c: targetMachine.config // rec {
expName = "fwi";
unitName = "${expName}-test";
inherit (machineConfig) hw;
2020-10-30 22:58:03 +08:00
cc = icc;
2021-03-05 01:41:24 +08:00
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;
fwiInput = bsc.apps.fwi.input.override {
inherit (c.n) nx ny nz;
};
2020-10-30 22:58:03 +08:00
# Other FWI parameters
ioFreq = -1;
# Repeat the execution of each unit several times
loops = 10;
#loops = 1;
2020-10-30 22:58:03 +08:00
# Resources
cpusPerTask = hw.cpusPerSocket;
ntasksPerNode = ntpn;
nodes = nn;
qos = "debug";
2020-10-30 22:58:03 +08:00
time = "02:00:00";
jobName = unitName;
tracing = "no";
# Enable permissions to write in the local storage
extraMounts = [ fs.local.temp ];
2020-10-30 22:58:03 +08:00
};
# Compute the array of configurations
configs = stdexp.buildConfigs {
inherit varConf genConf;
};
exec = {nextStage, conf, ...}: stages.exec {
2021-03-05 01:41:24 +08:00
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
2021-03-05 01:41:24 +08:00
'';
argv = [
"${conf.fwiInput}/fwi_params.txt"
"${conf.fwiInput}/fwi_frequencies.txt"
2021-03-05 01:41:24 +08:00
conf.blocksize
"-1" # Fordward steps
"-1" # Backward steps
conf.ioFreq # Write/read frequency
2021-03-05 01:41:24 +08:00
];
post = ''
rm -rf Results || true
if [[ "${conf.tracing}" == "yes" ]]; then
mv trace_* $CDIR
fi
'';
2021-03-05 01:41:24 +08:00
};
apps = bsc.garlic.apps;
2020-10-30 22:58:03 +08:00
# FWI program
program = {nextStage, conf, ...}: apps.fwi.solver.override {
inherit (conf) cc gitBranch fwiInput;
};
2020-10-30 22:58:03 +08:00
2021-03-05 01:41:24 +08:00
pipeline = stdexp.stdPipeline ++ [ exec program ];
2020-10-30 22:58:03 +08:00
in
stdexp.genExperiment { inherit configs pipeline; }