2020-11-05 19:56:26 +01:00
|
|
|
{
|
|
|
|
stdenv
|
2022-09-01 16:27:29 +02:00
|
|
|
, lib
|
2020-11-05 19:56:26 +01:00
|
|
|
, stdexp
|
|
|
|
, bsc
|
|
|
|
, targetMachine
|
|
|
|
, stages
|
2021-03-05 16:18:51 +01:00
|
|
|
, garlicTools
|
2021-04-06 18:38:15 +02:00
|
|
|
, writeText
|
2021-03-09 18:45:33 +01:00
|
|
|
, enablePerf ? false
|
2021-03-12 12:13:10 +01:00
|
|
|
, enableCTF ? false
|
2021-04-06 18:38:15 +02:00
|
|
|
, enableHWC ? false
|
|
|
|
, enableExtended ? false
|
2020-11-05 19:56:26 +01:00
|
|
|
}:
|
|
|
|
|
2021-04-06 18:38:15 +02:00
|
|
|
# TODO: Finish HWC first
|
|
|
|
assert (enableHWC == false);
|
|
|
|
|
2022-09-01 16:27:29 +02:00
|
|
|
with lib;
|
2021-03-05 16:18:51 +01:00
|
|
|
with garlicTools;
|
2020-11-05 19:56:26 +01:00
|
|
|
|
|
|
|
let
|
|
|
|
# Initial variable configuration
|
|
|
|
varConf = with bsc; {
|
2021-03-17 20:13:49 +01:00
|
|
|
cbs = range2 32 4096;
|
|
|
|
rbs = range2 32 4096;
|
2020-11-05 19:56:26 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
machineConfig = targetMachine.config;
|
|
|
|
|
|
|
|
# Generate the complete configuration for each unit
|
|
|
|
genConf = with bsc; c: targetMachine.config // rec {
|
|
|
|
expName = "heat";
|
2021-03-05 16:18:51 +01:00
|
|
|
unitName = expName +
|
|
|
|
".cbs-${toString cbs}" +
|
|
|
|
".rbs-${toString rbs}";
|
|
|
|
|
2020-11-05 19:56:26 +01:00
|
|
|
inherit (machineConfig) hw;
|
|
|
|
|
|
|
|
# heat options
|
|
|
|
timesteps = 10;
|
2021-03-05 16:18:51 +01:00
|
|
|
cols = 1024 * 16; # Columns
|
|
|
|
rows = 1024 * 16; # Rows
|
2021-04-06 18:38:15 +02:00
|
|
|
inherit (c) cbs rbs;
|
2021-03-05 16:18:51 +01:00
|
|
|
gitBranch = "garlic/tampi+isend+oss+task";
|
2020-11-05 19:56:26 +01:00
|
|
|
|
|
|
|
# Repeat the execution of each unit 30 times
|
2021-04-06 18:38:15 +02:00
|
|
|
loops = 10;
|
2020-11-05 19:56:26 +01:00
|
|
|
|
|
|
|
# Resources
|
|
|
|
qos = "debug";
|
|
|
|
ntasksPerNode = 1;
|
|
|
|
nodes = 1;
|
|
|
|
time = "02:00:00";
|
|
|
|
# Assign one socket to each task (only one process)
|
2020-11-17 11:17:57 +01:00
|
|
|
cpusPerTask = hw.cpusPerSocket;
|
2020-11-05 19:56:26 +01:00
|
|
|
jobName = unitName;
|
|
|
|
};
|
|
|
|
|
2021-04-06 18:38:15 +02:00
|
|
|
filterConfigs = c: let
|
|
|
|
# Too small sizes lead to huge overheads
|
|
|
|
goodSize = (c.cbs * c.rbs >= 1024);
|
|
|
|
# When the extended units are not enabled, we only select those in
|
|
|
|
# the diagonal.
|
|
|
|
extended = if (enableExtended) then true
|
|
|
|
else c.cbs == c.rbs;
|
|
|
|
in
|
|
|
|
goodSize && extended;
|
|
|
|
|
2020-11-05 19:56:26 +01:00
|
|
|
# Compute the array of configurations
|
2021-04-06 18:38:15 +02:00
|
|
|
configs = filter (filterConfigs) (stdexp.buildConfigs {
|
2020-11-05 19:56:26 +01:00
|
|
|
inherit varConf genConf;
|
2021-04-06 18:38:15 +02:00
|
|
|
});
|
2020-11-05 19:56:26 +01:00
|
|
|
|
2021-03-09 18:45:33 +01:00
|
|
|
perf = {nextStage, conf, ...}: stages.perf {
|
|
|
|
inherit nextStage;
|
|
|
|
perfOptions = "stat -o .garlic/perf.csv -x , " +
|
|
|
|
"-e cycles,instructions,cache-references,cache-misses";
|
|
|
|
};
|
|
|
|
|
2021-04-06 18:38:15 +02:00
|
|
|
ctf = {nextStage, conf, ...}: let
|
|
|
|
# Create the nanos6 configuration file
|
|
|
|
nanos6ConfigFile = writeText "nanos6.toml" ''
|
|
|
|
version.instrument = "ctf"
|
|
|
|
turbo.enabled = false
|
|
|
|
instrument.ctf.converter.enabled = false
|
|
|
|
'' + optionalString (enableHWC) ''
|
|
|
|
hardware_counters.papi.enabled = true
|
|
|
|
hardware_counters.papi.counters = [
|
|
|
|
"PAPI_TOT_INS", "PAPI_TOT_CYC",
|
|
|
|
"PAPI_L1_TCM", "PAPI_L2_TCM", "PAPI_L3_TCM"
|
|
|
|
]
|
|
|
|
'';
|
|
|
|
|
|
|
|
in stages.exec {
|
2021-03-12 12:13:10 +01:00
|
|
|
inherit nextStage;
|
2021-04-06 18:38:15 +02:00
|
|
|
|
|
|
|
# And use it
|
2021-03-12 12:13:10 +01:00
|
|
|
env = ''
|
2021-04-06 18:38:15 +02:00
|
|
|
export NANOS6_CONFIG=${nanos6ConfigFile}
|
2021-03-12 12:13:10 +01:00
|
|
|
'';
|
|
|
|
|
2021-04-06 18:38:15 +02:00
|
|
|
# FIXME: We should run a hook *after* srun has ended, so we can
|
|
|
|
# execute it in one process only (not in N ranks). This hack works
|
|
|
|
# with one process only. Or be able to compute the name of the trace
|
|
|
|
# directory so we can begin the conversion in parallel
|
|
|
|
post = assert (conf.nodes * conf.ntasksPerNode == 1); ''
|
|
|
|
tracedir=$(ls -d trace_* | head -1)
|
|
|
|
echo "using tracedir=$tracedir"
|
2021-03-12 12:13:10 +01:00
|
|
|
|
2021-04-06 18:38:15 +02:00
|
|
|
offset=$(grep 'offset =' $tracedir/ctf/ust/uid/1000/64-bit/metadata | \
|
|
|
|
grep -o '[0-9]*')
|
|
|
|
echo "offset = $offset"
|
2021-03-12 12:13:10 +01:00
|
|
|
|
2021-04-06 18:38:15 +02:00
|
|
|
start_time=$(awk '/^start_time / {print $2}' stdout.log)
|
|
|
|
end_time=$(awk '/^end_time / {print $2}' stdout.log)
|
2021-03-12 12:13:10 +01:00
|
|
|
|
2021-04-06 18:38:15 +02:00
|
|
|
begin=$(awk "BEGIN{print $start_time*1e9 - $offset}")
|
|
|
|
end=$(awk "BEGIN{print $end_time*1e9 - $offset}")
|
2021-03-12 12:13:10 +01:00
|
|
|
|
2021-04-06 18:38:15 +02:00
|
|
|
echo "only events between $begin and $end"
|
2021-03-17 20:13:49 +01:00
|
|
|
|
2021-04-06 18:38:15 +02:00
|
|
|
${bsc.cn6}/bin/cn6 -s $tracedir
|
2021-03-12 12:13:10 +01:00
|
|
|
|
2021-04-06 18:38:15 +02:00
|
|
|
${bsc.cn6}/bin/cut $begin $end < $tracedir/prv/trace.prv |\
|
|
|
|
${bsc.cn6}/bin/hcut 1 ${toString conf.cpusPerTask} \
|
|
|
|
> $tracedir/prv/trace-cut.prv
|
2021-03-12 12:13:10 +01:00
|
|
|
|
2021-04-06 18:38:15 +02:00
|
|
|
${bsc.cn6}/bin/dur 6400025 0 < $tracedir/prv/trace-cut.prv |\
|
|
|
|
awk '{s+=$1} END {print s}' >> .garlic/time_mode_dead.csv &
|
2021-03-12 12:13:10 +01:00
|
|
|
|
2021-04-06 18:38:15 +02:00
|
|
|
${bsc.cn6}/bin/dur 6400025 1 < $tracedir/prv/trace-cut.prv |\
|
|
|
|
awk '{s+=$1} END {print s}' >> .garlic/time_mode_runtime.csv &
|
2021-03-12 12:13:10 +01:00
|
|
|
|
2021-04-06 18:38:15 +02:00
|
|
|
${bsc.cn6}/bin/dur 6400025 3 < $tracedir/prv/trace-cut.prv |\
|
|
|
|
awk '{s+=$1} END {print s}' >> .garlic/time_mode_task.csv &
|
|
|
|
|
|
|
|
wait
|
|
|
|
|
|
|
|
# Remove the traces at the end, as they are huge
|
|
|
|
rm -rf $tracedir
|
|
|
|
'';
|
|
|
|
# TODO: To enable HWC we need to first add a taskwait before the
|
|
|
|
# first get_time() measurement, otherwise we get the HWC of the
|
|
|
|
# main task, which will be huge.
|
2021-03-12 12:13:10 +01:00
|
|
|
};
|
|
|
|
|
2021-03-05 16:18:51 +01:00
|
|
|
exec = {nextStage, conf, ...}: stages.exec {
|
2020-11-05 19:56:26 +01:00
|
|
|
inherit nextStage;
|
2021-03-05 16:18:51 +01:00
|
|
|
argv = [
|
|
|
|
"--rows" conf.rows
|
|
|
|
"--cols" conf.cols
|
|
|
|
"--rbs" conf.rbs
|
|
|
|
"--cbs" conf.cbs
|
|
|
|
"--timesteps" conf.timesteps
|
|
|
|
];
|
|
|
|
|
|
|
|
# The next stage is the program
|
2020-11-05 19:56:26 +01:00
|
|
|
env = ''
|
2021-03-05 16:18:51 +01:00
|
|
|
ln -sf ${nextStage}/etc/heat.conf heat.conf || true
|
2020-11-05 19:56:26 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2021-03-05 16:18:51 +01:00
|
|
|
program = {nextStage, conf, ...}: bsc.garlic.apps.heat.override {
|
|
|
|
inherit (conf) gitBranch;
|
|
|
|
};
|
2020-11-05 19:56:26 +01:00
|
|
|
|
2021-03-09 18:45:33 +01:00
|
|
|
pipeline = stdexp.stdPipeline ++
|
|
|
|
(optional enablePerf perf) ++
|
2021-03-12 12:13:10 +01:00
|
|
|
(optional enableCTF ctf) ++
|
2021-03-09 18:45:33 +01:00
|
|
|
[ exec program ];
|
2020-11-05 19:56:26 +01:00
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
stdexp.genExperiment { inherit configs pipeline; }
|