From e20061254bec561428622cfe9516b74307bdc28f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Pe=C3=B1acoba?= Date: Tue, 13 Oct 2020 19:20:24 +0200 Subject: [PATCH] WIP: Add mpi, omp and mpi+omp experiments. See more. Seems that gcc compilation with OpenMP throws an error. Investigate. I think I've forgot to add an override of mpicxx compiler backend --- garlic/apps/hpcg/default.nix | 16 +++------ garlic/exp/hpcg/mpi+omp.nix | 63 ++++++++++++++++++++++++++++++++++++ garlic/exp/hpcg/mpi.nix | 6 ++-- garlic/exp/hpcg/omp.nix | 63 ++++++++++++++++++++++++++++++++++++ garlic/exp/hpcg/serial.nix | 4 +-- overlay.nix | 7 ++-- 6 files changed, 139 insertions(+), 20 deletions(-) create mode 100644 garlic/exp/hpcg/mpi+omp.nix create mode 100644 garlic/exp/hpcg/omp.nix diff --git a/garlic/apps/hpcg/default.nix b/garlic/apps/hpcg/default.nix index 257f02e..6dc697c 100644 --- a/garlic/apps/hpcg/default.nix +++ b/garlic/apps/hpcg/default.nix @@ -1,11 +1,11 @@ { stdenv , cc -, mpi -, gitBranch ? "garlic/seq" -, makefileName ? "Linux_Serial" +, mpi ? null +, gitBranch }: +with stdenv.lib; stdenv.mkDerivation rec { name = "hpcg"; @@ -20,8 +20,8 @@ stdenv.mkDerivation rec { buildInputs = [ cc - mpi - ]; + ] + ++ optional (mpi != null) mpi; makeFlags = [ "CC=${cc.cc.CC}" @@ -30,12 +30,6 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; - configurePhase = '' - mkdir build - cd build - ../configure ${makefileName} - ''; - installPhase = '' mkdir -p $out/bin cp bin/* $out/bin/ diff --git a/garlic/exp/hpcg/mpi+omp.nix b/garlic/exp/hpcg/mpi+omp.nix new file mode 100644 index 0000000..e4facc5 --- /dev/null +++ b/garlic/exp/hpcg/mpi+omp.nix @@ -0,0 +1,63 @@ +{ + stdenv +, stdexp +, bsc +, targetMachine +, stages +}: + +with stdenv.lib; + +let + # Initial variable configuration + varConf = with bsc; { + n = [ 104 64 ]; + }; + + # Generate the complete configuration for each unit + genConf = with bsc; c: targetMachine.config // rec { + # hpcg options + n = c.n; + cc = icc; + mpi = impi; + gitBranch = "garlic/mpi+omp"; + + # Repeat the execution of each unit 30 times + loops = 30; + + # Resources + qos = "debug"; + ntasksPerNode = 48; + nodes = 1; + time = "02:00:00"; + cpuBind = "sockets,verbose"; + jobName = "hpcg-${toString n}-${gitBranch}"; + }; + + # Compute the array of configurations + configs = stdexp.buildConfigs { + inherit varConf genConf; + }; + + exec = {nextStage, conf, ...}: with conf; stages.exec { + inherit nextStage; + argv = [ + "--nx=${toString n}" + "--ny=${toString n}" + "--nz=${toString n}" + ]; + }; + + program = {nextStage, conf, ...}: with conf; + let + customPkgs = stdexp.replaceMpi conf.mpi; + in + customPkgs.apps.hpcg.override { + inherit cc mpi gitBranch; + }; + + pipeline = stdexp.stdPipeline ++ [ exec program ]; + +in + + stdexp.genExperiment { inherit configs pipeline; } diff --git a/garlic/exp/hpcg/mpi.nix b/garlic/exp/hpcg/mpi.nix index 91b0429..331bd91 100644 --- a/garlic/exp/hpcg/mpi.nix +++ b/garlic/exp/hpcg/mpi.nix @@ -21,8 +21,6 @@ let cc = icc; mpi = impi; gitBranch = "garlic/mpi"; - # FIXME: fix this option in the garlic/mpi git branch - makefileName = "MPI"; # Repeat the execution of each unit 30 times loops = 30; @@ -55,11 +53,11 @@ let customPkgs = stdexp.replaceMpi conf.mpi; in customPkgs.apps.hpcg.override { - inherit cc mpi gitBranch makefileName; + inherit cc mpi gitBranch; }; pipeline = stdexp.stdPipeline ++ [ exec program ]; in - + stdexp.genExperiment { inherit configs pipeline; } diff --git a/garlic/exp/hpcg/omp.nix b/garlic/exp/hpcg/omp.nix new file mode 100644 index 0000000..bf3d59d --- /dev/null +++ b/garlic/exp/hpcg/omp.nix @@ -0,0 +1,63 @@ +{ + stdenv +, stdexp +, bsc +, targetMachine +, stages +}: + +with stdenv.lib; + +let + # Initial variable configuration + varConf = with bsc; { + n = [ 104 64 ]; + }; + + # Generate the complete configuration for each unit + genConf = with bsc; c: targetMachine.config // rec { + # hpcg options + n = c.n; + cc = icc; + mpi = null; # TODO: Remove this for omp + gitBranch = "garlic/seq"; + + # Repeat the execution of each unit 30 times + loops = 30; + + # Resources + qos = "debug"; + ntasksPerNode = 48; + nodes = 1; + time = "02:00:00"; + cpuBind = "sockets,verbose"; + jobName = "hpcg-${toString n}-${gitBranch}"; + }; + + # Compute the array of configurations + configs = stdexp.buildConfigs { + inherit varConf genConf; + }; + + exec = {nextStage, conf, ...}: with conf; stages.exec { + inherit nextStage; + argv = [ + "--nx=${toString n}" + "--ny=${toString n}" + "--nz=${toString n}" + ]; + }; + + program = {nextStage, conf, ...}: with conf; + let + customPkgs = stdexp.replaceMpi conf.mpi; + in + customPkgs.apps.hpcg.override { + inherit cc gitBranch; + }; + + pipeline = stdexp.stdPipeline ++ [ exec program ]; + +in + + stdexp.genExperiment { inherit configs pipeline; } diff --git a/garlic/exp/hpcg/serial.nix b/garlic/exp/hpcg/serial.nix index 0d5d855..91ce793 100644 --- a/garlic/exp/hpcg/serial.nix +++ b/garlic/exp/hpcg/serial.nix @@ -19,7 +19,7 @@ let # hpcg options n = c.n; cc = icc; - mpi = impi; + mpi = null; # TODO: Remove this for serial gitBranch = "garlic/seq"; # Repeat the execution of each unit 30 times @@ -59,5 +59,5 @@ let pipeline = stdexp.stdPipeline ++ [ exec program ]; in - + stdexp.genExperiment { inherit configs pipeline; } diff --git a/overlay.nix b/overlay.nix index 3ce3368..3e782c9 100644 --- a/overlay.nix +++ b/overlay.nix @@ -199,7 +199,8 @@ let hpcg = callPackage ./garlic/apps/hpcg/default.nix { cc = self.bsc.icc; - gitBranch = "garlic/seq"; + mpi = self.bsc.impi; + gitBranch = "garlic/mpi+omp"; }; # heat = callPackage ./garlic/apps/heat { @@ -262,8 +263,8 @@ let hpcg = { serial = callPackage ./garlic/exp/hpcg/serial.nix { }; mpi = callPackage ./garlic/exp/hpcg/mpi.nix { }; - # omp = callPackage ./garlic/exp/hpcg/omp.nix { }; - # mpi+omp = callPackage ./garlic/exp/hpcg/mpi+omp.nix { }; + omp = callPackage ./garlic/exp/hpcg/omp.nix { }; + mpi_omp = callPackage ./garlic/exp/hpcg/mpi+omp.nix { }; }; test = {