New config design

This commit is contained in:
2020-10-09 19:33:06 +02:00
parent 9020f87765
commit 298c7362b3
4 changed files with 158 additions and 352 deletions

View File

@@ -25,52 +25,52 @@ rec {
};
};
/* Given an attrset of lists `var` and an attrset `fixed`, computes the
cartesian product of all combinations of `var` and prepends `fixed`
to each. */
buildConfigs = {fixed, var}:
map (c: fixed // c) (genConfigs var);
/* Given an attrset of lists `varConf` and a function `genConf` that accepts a
attrset, computes the cartesian product of all combinations of `varConf` calls
genConf to produce the final list of configurations. */
buildConfigs = {varConf, genConf}:
map (c: genConf c) (genConfigs varConf);
sbatch = {nextStage, conf, ...}: with conf; stages.sbatch (
# Allow a user to define a custom reservation for the job in MareNostrum4,
# by setting the garlic.sbatch.reservation attribute in the
# ~/.config/nixpkgs/config.nix file. If the attribute is not set, no
# reservation is used. The user reservation may be overwritten by the
# experiment, if the reservation is set like with nodes or ntasksPerNode.
optionalAttrs (config ? garlic.sbatch.reservation) {
inherit (config.garlic.sbatch) reservation;
} // {
exclusive = true;
time = "02:00:00";
qos = "debug";
jobName = "nbody-tampi";
inherit nextStage nixPrefix nodes ntasksPerNode;
}
);
stdStages = {
sbatch = {nextStage, conf, ...}: with conf; stages.sbatch (
# Allow a user to define a custom reservation for the job in MareNostrum4,
# by setting the garlic.sbatch.reservation attribute in the
# ~/.config/nixpkgs/config.nix file. If the attribute is not set, no
# reservation is used. The user reservation may be overwritten by the
# experiment, if the reservation is set like with nodes or ntasksPerNode.
optionalAttrs (config ? garlic.sbatch.reservation) {
inherit (config.garlic.sbatch) reservation;
} // {
exclusive = true;
inherit nextStage nixPrefix nodes ntasksPerNode time qos jobName;
}
);
control = {nextStage, conf, ...}: stages.control {
inherit (conf) loops;
inherit nextStage;
control = {nextStage, conf, ...}: stages.control {
inherit (conf) loops;
inherit nextStage;
};
srun = {nextStage, conf, ...}: stages.srun {
inherit (conf) nixPrefix cpuBind;
inherit nextStage;
};
isolate = {nextStage, conf, ...}: stages.isolate {
clusterName = machineConf.name;
inherit (conf) nixPrefix;
inherit nextStage;
};
};
srun = {nextStage, conf, ...}: stages.srun {
inherit (conf) nixPrefix cpuBind;
inherit nextStage;
};
stdPipelineOverride = {overrides ? {}}:
let
stages = stdStages // overrides;
in
with stages; [ sbatch isolate control srun isolate ];
isolate = {nextStage, conf, ...}: stages.isolate {
clusterName = machineConf.name;
inherit (conf) nixPrefix;
inherit nextStage;
};
stdStages = [
sbatch
isolate
control
srun
isolate
];
stdPipeline = stdPipelineOverride {};
# FIXME: Remove this hack and allow custom nixpkgs
bscOverlay = import ../overlay.nix;