bscpkgs/bsc/garlic/exp/nbody/bs.nix

73 lines
1.4 KiB
Nix
Raw Normal View History

2020-08-10 21:27:46 +08:00
{
bsc
, nbody
, genApp
, genConfigs
2020-08-12 20:00:04 +08:00
# Wrappers
2020-08-18 00:50:18 +08:00
, launchWrapper
2020-08-12 20:00:04 +08:00
, sbatchWrapper
2020-08-18 00:50:18 +08:00
, srunWrapper
2020-08-12 20:00:04 +08:00
, argvWrapper
, controlWrapper
, nixsetupWrapper
2020-08-10 21:27:46 +08:00
}:
let
# Set the configuration for the experiment
config = {
cc = [ bsc.icc ];
2020-08-12 20:00:04 +08:00
blocksize = [ 1024 2048 4096 8192 ];
};
extraConfig = {
particles = 16384;
timesteps = 10;
ntasks = 1;
nnodes = 1;
2020-08-10 21:27:46 +08:00
};
# Compute the cartesian product of all configurations
2020-08-12 20:00:04 +08:00
allConfigs = genConfigs config;
2020-08-18 00:50:18 +08:00
filteredConfigs = with builtins; filter (c: c.blocksize <= 4096) allConfigs;
configs = map (conf: conf // extraConfig) filteredConfigs;
2020-08-12 20:00:04 +08:00
sbatch = conf: app: sbatchWrapper {
app = app;
nixPrefix = "/gpfs/projects/bsc15/nix";
exclusive = false;
ntasks = "${toString conf.ntasks}";
};
2020-08-18 00:50:18 +08:00
srun = app: srunWrapper {
app = app;
nixPrefix = "/gpfs/projects/bsc15/nix";
};
2020-08-12 20:00:04 +08:00
argv = conf: app:
with conf;
argvWrapper {
app = app;
argv = ''(-t ${toString timesteps} -p ${toString particles})'';
};
nbodyFn = conf:
with conf;
nbody.override { inherit cc blocksize; };
pipeline = conf:
sbatch conf (
2020-08-18 00:50:18 +08:00
srun (
nixsetupWrapper (
controlWrapper (
argv conf (
nbodyFn conf)))));
2020-08-12 20:00:04 +08:00
# Ideally it should look like this:
#pipeline = sbatch nixsetup control argv nbodyFn;
2020-08-18 00:50:18 +08:00
jobs = map pipeline configs;
2020-08-12 20:00:04 +08:00
2020-08-10 21:27:46 +08:00
in
2020-08-18 00:50:18 +08:00
launchWrapper jobs