From dea523460ad6584cc1c04fa3822092482428ac37 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 13 Nov 2020 19:13:24 +0100 Subject: [PATCH] Add slurm affinity experiment --- garlic/exp/slurm/cpu.nix | 60 ++++++++++++++++++++++++++++++++++++++++ overlay.nix | 4 +++ 2 files changed, 64 insertions(+) create mode 100644 garlic/exp/slurm/cpu.nix diff --git a/garlic/exp/slurm/cpu.nix b/garlic/exp/slurm/cpu.nix new file mode 100644 index 0000000..28e6907 --- /dev/null +++ b/garlic/exp/slurm/cpu.nix @@ -0,0 +1,60 @@ +{ + stdenv +, stdexp +, bsc +, targetMachine +, stages +, garlicTools +}: + +with stdenv.lib; +with garlicTools; + +let + + machineConfig = targetMachine.config; + + inherit (machineConfig) hw; + + # Initial variable configuration + varConf = with bsc; { + # Create a list of cpus per task by dividing cpusPerSocket by 2 + # successively. Example: divList 24 = [ 1 3 6 12 24 ] + cpusPerTask = divList hw.cpusPerSocket; + }; + + # Generate the complete configuration for each unit + genConf = with bsc; c: targetMachine.config // rec { + expName = "cpu"; + unitName = "${expName}.${toString cpusPerTask}"; + + inherit (machineConfig) hw; + + # Repeat the execution of each unit 30 times + loops = 1; + + # Resources + qos = "debug"; + inherit (c) cpusPerTask; + ntasksPerNode = hw.cpusPerNode / cpusPerTask; + nodes = 1; + jobName = unitName; + }; + + # Compute the array of configurations + configs = stdexp.buildConfigs { + inherit varConf genConf; + }; + + exec = {nextStage, conf, ...}: with conf; stages.exec { + inherit nextStage; + env = "date"; + }; + + program = {nextStage, conf, ...}: bsc.dummy; + + pipeline = stdexp.stdPipeline ++ [ program ]; + +in + + stdexp.genExperiment { inherit configs pipeline; } diff --git a/overlay.nix b/overlay.nix index fcf834a..027037c 100644 --- a/overlay.nix +++ b/overlay.nix @@ -346,6 +346,10 @@ let heat = { test = callPackage ./garlic/exp/heat/test.nix { }; }; + + slurm = { + cpu = callPackage ./garlic/exp/slurm/cpu.nix { }; + }; }; # Datasets used in the figures