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

131 lines
3.0 KiB
Nix
Raw Normal View History

2020-08-10 15:27:46 +02:00
{
bsc
2020-09-02 17:07:09 +02:00
, stdenv
2020-08-10 15:27:46 +02:00
, nbody
, genApp
, genConfigs
2020-09-02 17:07:09 +02:00
, runWrappers
2020-08-10 15:27:46 +02:00
}:
2020-09-02 17:07:09 +02:00
with stdenv.lib;
2020-08-10 15:27:46 +02:00
let
2020-09-02 17:07:09 +02:00
# Set variable configuration for the experiment
varConfig = {
2020-08-10 15:27:46 +02:00
cc = [ bsc.icc ];
blocksize = [ 1024 ];
2020-08-12 14:00:04 +02:00
};
2020-09-02 17:07:09 +02:00
# Common configuration
common = {
# Compile time nbody config
gitBranch = "garlic/mpi+send";
mpi = bsc.impi;
2020-09-02 17:07:09 +02:00
# nbody runtime options
particles = 1024*128;
2020-09-02 17:07:09 +02:00
timesteps = 20;
# Resources
ntasksPerNode = "48";
nodes = "1";
2020-09-02 17:07:09 +02:00
# Stage configuration
enableSbatch = true;
enableControl = true;
enableExtrae = false;
enablePerf = false;
# MN4 path
nixPrefix = "/gpfs/projects/bsc15/nix";
2020-08-10 15:27:46 +02:00
};
# Compute the cartesian product of all configurations
2020-09-02 17:07:09 +02:00
configs = map (conf: conf // common) (genConfigs varConfig);
2020-08-12 14:00:04 +02:00
2020-09-02 17:07:09 +02:00
stageProgram = stage:
if stage ? programPath
then "${stage}${stage.programPath}" else "${stage}";
w = runWrappers;
sbatch = {stage, conf, ...}: with conf; w.sbatch {
program = stageProgram stage;
exclusive = true;
2020-09-02 17:07:09 +02:00
time = "02:00:00";
qos = "debug";
jobName = "nbody-bs";
inherit nixPrefix nodes ntasksPerNode;
2020-08-12 14:00:04 +02:00
};
2020-09-02 17:07:09 +02:00
control = {stage, conf, ...}: with conf; w.control {
program = stageProgram stage;
};
srun = {stage, conf, ...}: with conf; w.srun {
program = stageProgram stage;
2020-09-02 10:44:13 +02:00
srunOptions = "--cpu-bind=verbose,rank";
2020-09-02 17:07:09 +02:00
inherit nixPrefix;
2020-08-17 18:50:18 +02:00
};
2020-09-02 17:07:09 +02:00
statspy = {stage, conf, ...}: with conf; w.statspy {
program = stageProgram stage;
};
perf = {stage, conf, ...}: with conf; w.perf {
program = stageProgram stage;
perfArgs = "sched record -a";
};
nixsetup = {stage, conf, ...}: with conf; w.nixsetup {
program = stageProgram stage;
};
extrae = {stage, conf, ...}: w.extrae {
program = stageProgram stage;
traceLib = "mpi"; # mpi -> libtracempi.so
configFile = ./extrae.xml;
};
argv = {stage, conf, ...}: w.argv {
program = stageProgram stage;
env = ''
set -e
export I_MPI_THREAD_SPLIT=1
'';
argv = ''( -t ${toString conf.timesteps}
-p ${toString conf.particles} )'';
};
nbodyFn = {stage, conf, ...}: with conf; nbody.override {
inherit cc blocksize mpi gitBranch;
};
stages = with common; []
# Use sbatch to request resources first
++ optional enableSbatch sbatch
# Repeats the next stages N times
++ optionals enableControl [ nixsetup control ]
# Executes srun to launch the program in the requested nodes, and
# immediately after enters the nix environment again, as slurmstepd launches
# the next stages from outside the namespace.
++ [ srun nixsetup ]
# Intrumentation with extrae
++ optional enableExtrae extrae
# Optionally profile the next stages with perf
++ optional enablePerf perf
# Execute the nbody app with the argv and env vars
++ [ argv nbodyFn ];
# List of actual programs to be executed
jobs = map (conf: w.stagen { inherit conf stages; }) configs;
2020-08-12 14:00:04 +02:00
2020-08-10 15:27:46 +02:00
in
2020-09-02 17:07:09 +02:00
# We simply run each program one after another
w.launch jobs