From e1433fedb8daa7671b1b3c39a0014e4065931637 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Tue, 20 Apr 2021 16:14:44 +0200 Subject: [PATCH] nbody: refactor experiments into common.nix --- garlic/exp/index.nix | 4 +- garlic/exp/nbody/common.nix | 36 ++++++++++++ garlic/exp/nbody/granularity.nix | 44 +++++++------- garlic/exp/nbody/nodes-or-sockets-mpi.nix | 72 ----------------------- garlic/exp/nbody/numa.nix | 63 ++++++++++++++++++++ garlic/exp/nbody/ss.nix | 58 ++++++++++++++++++ garlic/exp/nbody/strong-scaling-mpi.nix | 65 -------------------- 7 files changed, 179 insertions(+), 163 deletions(-) create mode 100644 garlic/exp/nbody/common.nix delete mode 100644 garlic/exp/nbody/nodes-or-sockets-mpi.nix create mode 100644 garlic/exp/nbody/numa.nix create mode 100644 garlic/exp/nbody/ss.nix delete mode 100644 garlic/exp/nbody/strong-scaling-mpi.nix diff --git a/garlic/exp/index.nix b/garlic/exp/index.nix index 7e40ba0..d467881 100644 --- a/garlic/exp/index.nix +++ b/garlic/exp/index.nix @@ -9,8 +9,8 @@ { nbody = rec { granularity = callPackage ./nbody/granularity.nix { }; - nodesorsockets = callPackage ./nbody/nodes-or-sockets-mpi.nix { }; - scaling = callPackage ./nbody/strong-scaling-mpi.nix { }; + ss = callPackage ./nbody/ss.nix { }; + numa = callPackage ./nbody/numa.nix { }; }; saiph = { diff --git a/garlic/exp/nbody/common.nix b/garlic/exp/nbody/common.nix new file mode 100644 index 0000000..434bc58 --- /dev/null +++ b/garlic/exp/nbody/common.nix @@ -0,0 +1,36 @@ +{ + stdenv +, stdexp +, bsc +, stages +, numactl +, garlicTools +}: + +with stdenv.lib; +with garlicTools; + +rec { + getConfigs = {varConf, genConf}: stdexp.buildConfigs { + inherit varConf genConf; + }; + + exec = {nextStage, conf, ...}: stages.exec + ( + { + inherit nextStage; + argv = with conf; [ "-t" timesteps "-p" particles ]; + } + # Use numactl to use the interleave policy if requested (default is + # false) + // optionalAttrs (conf.interleaveMem or false) { + program = "${numactl}/bin/numactl --interleave=all ${stageProgram nextStage}"; + } + ); + + program = {nextStage, conf, ...}: bsc.garlic.apps.nbody.override { + inherit (conf) blocksize gitBranch; + }; + + pipeline = stdexp.stdPipeline ++ [ exec program ]; +} diff --git a/garlic/exp/nbody/granularity.nix b/garlic/exp/nbody/granularity.nix index 59eae23..23baa26 100644 --- a/garlic/exp/nbody/granularity.nix +++ b/garlic/exp/nbody/granularity.nix @@ -5,6 +5,7 @@ , targetMachine , stages , garlicTools +, callPackage }: with stdenv.lib; @@ -12,11 +13,11 @@ with garlicTools; let # Initial variable configuration - varConf = with bsc; { - blocksize = [ 128 256 512 1024 2048 4096 ]; + varConf = { + blocksize = range2 64 2048; gitBranch = [ - "garlic/mpi+send+oss+task" - "garlic/tampi+send+oss+task" +# "garlic/mpi+send+oss+task" +# "garlic/tampi+send+oss+task" "garlic/tampi+isend+oss+task" ]; }; @@ -24,40 +25,35 @@ let # Generate the complete configuration for each unit genConf = c: targetMachine.config // rec { hw = targetMachine.config.hw; - particles = 4096 * hw.cpusPerSocket; + particles = 8 * 1024 * hw.cpusPerSocket; timesteps = 10; blocksize = c.blocksize; gitBranch = c.gitBranch; expName = "nbody-granularity"; - unitName = expName + "-${toString gitBranch}" + "-bs${toString blocksize}"; + unitName = expName + + "-${toString gitBranch}" + + "-bs${toString blocksize}"; - loops = 30; + loops = 10; - qos = "bsc_cs"; - ntasksPerNode = 1; - nodes = 1; - time = "04:00:00"; + qos = "debug"; cpusPerTask = hw.cpusPerSocket; + ntasksPerNode = hw.socketsPerNode; + nodes = 1; + time = "02:00:00"; jobName = unitName; }; - # Compute the array of configurations - configs = stdexp.buildConfigs { + + common = callPackage ./common.nix {}; + + inherit (common) getConfigs pipeline; + + configs = getConfigs { inherit varConf genConf; }; - exec = {nextStage, conf, ...}: stages.exec { - inherit nextStage; - argv = [ "-t" conf.timesteps "-p" conf.particles ]; - }; - - program = {nextStage, conf, ...}: with conf; bsc.garlic.apps.nbody.override { - inherit (conf) blocksize gitBranch; - }; - - pipeline = stdexp.stdPipeline ++ [ exec program ]; - in stdexp.genExperiment { inherit configs pipeline; } diff --git a/garlic/exp/nbody/nodes-or-sockets-mpi.nix b/garlic/exp/nbody/nodes-or-sockets-mpi.nix deleted file mode 100644 index 44c0c16..0000000 --- a/garlic/exp/nbody/nodes-or-sockets-mpi.nix +++ /dev/null @@ -1,72 +0,0 @@ -{ - stdenv -, stdexp -, bsc -, targetMachine -, stages -, garlicTools -, numactl -}: - -with stdenv.lib; -with garlicTools; - -let - # Initial variable configuration - varConf = with bsc; { - blocksize = [ 256 512 1024 ]; - gitBranch = [ "garlic/tampi+send+oss+task" ]; - attachToSocket = [ true false ]; - numactl = [ true false ]; - }; - - # Generate the complete configuration for each unit - genConf = c: targetMachine.config // rec { - hw = targetMachine.config.hw; - particles = 4 * 4096 * hw.cpusPerSocket; - timesteps = 10; - blocksize = c.blocksize; - gitBranch = c.gitBranch; - socketAtt = c.attachToSocket; - useNumact = c.numactl; - - expName = "nbody-granularity"; - attachName = if (socketAtt) then "PerSocket" else "PerNode"; - numaName = if (useNumact) then "True" else "False"; - unitName = expName + - "-${toString gitBranch}" + - "-bs${toString blocksize}" + - "-ranks${toString attachName}" + - "-useNuma${toString numaName}"; - - loops = 30; - - qos = "debug"; - ntasksPerNode = if (socketAtt) then 2 else 1; - nodes = 4; - time = "02:00:00"; - cpusPerTask = if (socketAtt) then hw.cpusPerSocket else 2*hw.cpusPerSocket; - jobName = unitName; - }; - - # Compute the array of configurations - configs = stdexp.buildConfigs { - inherit varConf genConf; - }; - - exec = {nextStage, conf, ...}: stages.exec ({ - inherit nextStage; - argv = [ "-t" conf.timesteps "-p" conf.particles ]; - } // optionalAttrs (conf.useNumact) { - program = "${numactl}/bin/numactl --interleave=all ${stageProgram nextStage}"; - }); - - program = {nextStage, conf, ...}: with conf; bsc.garlic.apps.nbody.override { - inherit (conf) blocksize gitBranch; - }; - - pipeline = stdexp.stdPipeline ++ [ exec program ]; - -in - - stdexp.genExperiment { inherit configs pipeline; } diff --git a/garlic/exp/nbody/numa.nix b/garlic/exp/nbody/numa.nix new file mode 100644 index 0000000..d4a3c28 --- /dev/null +++ b/garlic/exp/nbody/numa.nix @@ -0,0 +1,63 @@ +{ + stdenv +, stdexp +, bsc +, targetMachine +, stages +, garlicTools +, numactl +, callPackage +}: + +with stdenv.lib; +with garlicTools; + +let + # Initial variable configuration + varConf = { + blocksize = range2 256 1024; + gitBranch = [ "garlic/tampi+send+oss+task" ]; + attachToSocket = [ true false ]; + interleaveMem = [ true false ]; + }; + + # Generate the complete configuration for each unit + genConf = c: targetMachine.config // rec { + hw = targetMachine.config.hw; + particles = 4 * 1024 * hw.cpusPerSocket; + timesteps = 10; + + inherit (c) attachToSocket interleaveMem gitBranch blocksize; + + expName = "nbody-numa"; + unitName = expName + + "-${toString gitBranch}" + + "-bs.${toString blocksize}" + + "-tpn.${toString ntasksPerNode}" + + "-interleave.${if (interleaveMem) then "yes" else "no"}"; + + loops = 10; + + qos = "debug"; + cpusPerTask = if (attachToSocket) + then hw.cpusPerSocket + else hw.cpusPerNode; + ntasksPerNode = if (attachToSocket) + then hw.socketsPerNode + else 1; + nodes = 4; + time = "02:00:00"; + jobName = unitName; + }; + + common = callPackage ./common.nix {}; + + inherit (common) getConfigs pipeline; + + configs = getConfigs { + inherit varConf genConf; + }; + +in + + stdexp.genExperiment { inherit configs pipeline; } diff --git a/garlic/exp/nbody/ss.nix b/garlic/exp/nbody/ss.nix new file mode 100644 index 0000000..75ffa56 --- /dev/null +++ b/garlic/exp/nbody/ss.nix @@ -0,0 +1,58 @@ +{ + stdenv +, stdexp +, bsc +, targetMachine +, stages +, garlicTools +, callPackage +}: + +with stdenv.lib; +with garlicTools; + +let + # Initial variable configuration + varConf = { + blocksize = [ 128 ]; + nodes = range2 1 16; + gitBranch = [ +# "garlic/mpi+send+oss+task" +# "garlic/tampi+send+oss+task" + "garlic/tampi+isend+oss+task" + ]; + }; + + # Generate the complete configuration for each unit + genConf = c: targetMachine.config // rec { + hw = targetMachine.config.hw; + particles = 8 * 1024 * hw.cpusPerSocket; + timesteps = 10; + + inherit (c) blocksize nodes gitBranch; + + expName = "nbody-scaling"; + unitName = expName + + "-${toString gitBranch}" + + "-nodes${toString nodes}"; + + loops = 5; + + qos = "debug"; + ntasksPerNode = hw.socketsPerNode; + time = "02:00:00"; + cpusPerTask = hw.cpusPerSocket; + jobName = unitName; + }; + + common = callPackage ./common.nix {}; + + inherit (common) getConfigs pipeline; + + configs = getConfigs { + inherit varConf genConf; + }; + +in + + stdexp.genExperiment { inherit configs pipeline; } diff --git a/garlic/exp/nbody/strong-scaling-mpi.nix b/garlic/exp/nbody/strong-scaling-mpi.nix deleted file mode 100644 index 3ca7041..0000000 --- a/garlic/exp/nbody/strong-scaling-mpi.nix +++ /dev/null @@ -1,65 +0,0 @@ -{ - stdenv -, stdexp -, bsc -, targetMachine -, stages -, garlicTools -}: - -with stdenv.lib; -with garlicTools; - -let - # Initial variable configuration - varConf = with bsc; { - blocksize = [ 512 ]; - nodes = [ 1 2 4 8 16 ]; - gitBranch = [ - "garlic/mpi+send+oss+task" - "garlic/tampi+send+oss+task" - "garlic/tampi+isend+oss+task" - ]; - }; - - # Generate the complete configuration for each unit - genConf = c: targetMachine.config // rec { - hw = targetMachine.config.hw; - particles = 16 * 4096 * hw.cpusPerSocket; - timesteps = 10; - blocksize = c.blocksize; - numNodes = c.nodes; - gitBranch = c.gitBranch; - - expName = "nbody-scaling"; - unitName = expName + "-${toString gitBranch}" + "-nodes${toString numNodes}"; - - loops = 30; - - nodes = numNodes; - qos = "debug"; - ntasksPerNode = 2; - time = "02:00:00"; - cpusPerTask = hw.cpusPerSocket; - jobName = unitName; - }; - - # Compute the array of configurations - configs = stdexp.buildConfigs { - inherit varConf genConf; - }; - - exec = {nextStage, conf, ...}: stages.exec { - inherit nextStage; - argv = [ "-t" conf.timesteps "-p" conf.particles ]; - }; - - program = {nextStage, conf, ...}: with conf; bsc.garlic.apps.nbody.override { - inherit (conf) blocksize gitBranch; - }; - - pipeline = stdexp.stdPipeline ++ [ exec program ]; - -in - - stdexp.genExperiment { inherit configs pipeline; }