Merge branch 'creams' into 'master'

Creams

See merge request rarias/bscpkgs!2
This commit is contained in:
Rodrigo Arias 2020-10-02 18:40:45 +02:00
commit 18081b3485
6 changed files with 454 additions and 13 deletions

View File

@ -2,23 +2,45 @@
stdenv
, nanos6
, mpi
, openmpi
, impi
, tampi
, mcxx
, icc
, gnuDef
, intelDef
, cc
, gitBranch
}:
assert (mpi == impi || mpi == openmpi);
let
mpiName = (if mpi == openmpi then
"OpenMPI"
else
"IntelMPI");
compName = (if cc == intelDef then
"Intel"
else
"GNU");
in
stdenv.mkDerivation rec {
name = "creams";
# src = /home/Computational/pmartin1/creams-simplified;
src = builtins.fetchGit {
url = "ssh://git@bscpm02.bsc.es/pmartin1/creams-simplified.git";
ref = "MPI+OmpSs-2+TAMPI";
ref = "${gitBranch}";
};
programPath = "/bin/creams.exe";
buildInputs = [
nanos6
mpi
icc
cc
tampi
mcxx
];
@ -27,12 +49,19 @@ stdenv.mkDerivation rec {
configurePhase = ''
export TAMPI_HOME=${tampi}
. etc/bashrc
export FORTRAN_COMPILER=${compName}
export MPI_LIB=${mpiName}
echo
CREAMS_UPDATE_ENVIRONMENT
'';
installPhase = ''
mkdir -p $out/bin
cp -a build/* $out/bin
'';
}

31
garlic/creams/input.nix Normal file
View File

@ -0,0 +1,31 @@
{
stdenv
, granul ? 0
, nprocz ? 0
, gitBranch
}:
stdenv.mkDerivation rec {
name = "creams-input";
# src = /home/Computational/pmartin1/creams-simplified;
src = builtins.fetchGit {
url = "ssh://git@bscpm02.bsc.es/pmartin1/creams-simplified.git";
ref = "${gitBranch}";
};
phases = [ "unpackPhase" "patchPhase" "installPhase" ];
patchPhase = ''
patchShebangs SodTubeBenchmark/gridScript.sh
'';
installPhase = ''
pushd SodTubeBenchmark
./gridScript.sh 0 0 ${toString nprocz} ${toString granul}
popd
mkdir -p $out
cp -a SodTubeBenchmark $out/
'';
}

View File

@ -0,0 +1,180 @@
{
stdenv
, nixpkgs
, pkgs
, genApp
, genConfigs
, runWrappers
}:
with stdenv.lib;
let
bsc = pkgs.bsc;
# Set variable configuration for the experiment
varConfig = {
cc = [ bsc.icc ]; # [ bsc.icc pkgs.gfortran10 ];
mpi = [ bsc.impi ]; # [ bsc.impi bsc.openmpi-mn4 ];
input = [
{ nodes=1 ; nprocz=2 ; granul=37; time= "10:00:00"; }
{ nodes=2 ; nprocz=4 ; granul=19; time= "05:00:00"; }
{ nodes=4 ; nprocz=8 ; granul=10; time= "03:00:00"; }
{ nodes=8 ; nprocz=16; granul=9 ; time= "02:00:00"; }
{ nodes=16; nprocz=32; granul=9 ; time= "01:00:00"; }
];
gitBranch = [ "garlic/mpi+isend+oss+task"
"garlic/mpi+send+omp+fork"
"garlic/mpi+send+oss+task"
"garlic/tampi+isend+oss+task"
];
};
# Common configuration
common = {
# Resources
ntasksPerNode = 2;
#ntasksPerSocket = 1; // Add this variable to nix
# Stage configuration
enableSbatch = true;
enableControl = true;
enableExtrae = false;
enablePerf = false;
enableCtf = false;
# MN4 path
nixPrefix = "/gpfs/projects/bsc15/nix";
};
# Compute the cartesian product of all configurations
configs = map (conf: conf // common) (genConfigs varConfig);
stageProgram = stage:
if stage ? programPath
then "${stage}${stage.programPath}" else "${stage}";
w = runWrappers;
sbatch = {stage, conf, ...}: with conf; w.sbatch {
nodes = input.nodes;
program = stageProgram stage;
exclusive = true;
time = input.time;
#qos = "debug";
jobName = "creams-ss-${toString input.nodes}-${toString gitBranch}";
inherit nixPrefix ntasksPerNode;
};
control = {stage, conf, ...}: with conf; w.control {
program = stageProgram stage;
};
srun = {stage, conf, ...}: with conf; w.srun {
program = stageProgram stage;
srunOptions = "--cpu-bind=verbose,socket";
inherit nixPrefix;
};
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;
nixsetup = "${nixPrefix}/bin/nix-setup";
};
extrae = {stage, conf, ...}: w.extrae {
program = stageProgram stage;
traceLib = "mpi"; # mpi -> libtracempi.so
configFile = ./extrae.xml;
};
ctf = {stage, conf, ...}: w.argv {
program = stageProgram stage;
env = ''
export NANOS6=ctf
export NANOS6_CTF2PRV=0
'';
};
bscOverlay = import ../../../overlay.nix;
genPkgs = newOverlay: nixpkgs {
overlays = [
bscOverlay
newOverlay
];
};
inputDataset = {stage, conf, ...}:
let
input = bsc.garlic.creamsInput.override {
gitBranch = conf.gitBranch;
granul = conf.input.granul;
nprocz = conf.input.nprocz;
};
in w.argv
{
program = stageProgram stage;
env = ''
cp -r ${input}/SodTubeBenchmark/* .
chmod +w -R .
'';
};
# We may be able to use overlays by invoking the fix function directly, but we
# have to get the definition of the bsc packages and the garlic ones as
# overlays.
creamsFn = {stage, conf, ...}: with conf;
let
# We set the mpi implementation to the one specified in the conf, so all
# packages in bsc will use that one.
customPkgs = genPkgs (self: super: {
bsc = super.bsc // { mpi = conf.mpi; };
});
in
customPkgs.bsc.garlic.creams.override {
inherit cc 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
# Optionally profile nanos6 with the new ctf
++ optional enableCtf ctf
# Execute the app with the argv and env vars
++ [ inputDataset creamsFn ];
# List of actual programs to be executed
jobs = map (conf: w.stagen { inherit conf stages; }) configs;
in
# We simply run each program one after another
w.launch jobs

View File

@ -0,0 +1,176 @@
{
stdenv
, nixpkgs
, pkgs
, genApp
, genConfigs
, runWrappers
}:
with stdenv.lib;
let
bsc = pkgs.bsc;
# Set variable configuration for the experiment
varConfig = {
cc = [ bsc.icc ]; # [ bsc.icc pkgs.gfortran10 ];
mpi = [ bsc.impi ]; # [ bsc.impi bsc.openmpi-mn4 ];
input = [
{ nodes=1 ; nprocz=48 ; granul=0; time= "10:00:00"; }
{ nodes=2 ; nprocz=96 ; granul=0; time= "05:00:00"; }
{ nodes=4 ; nprocz=192; granul=0; time= "03:00:00"; }
{ nodes=8 ; nprocz=384; granul=0; time= "02:00:00"; }
{ nodes=16; nprocz=768; granul=0; time= "01:00:00"; }
];
gitBranch = [ "garlic/mpi+send+seq" ];
};
# Common configuration
common = {
# Resources
ntasksPerNode = 48;
#ntasksPerSocket = 24; // Add this variable to nix
# Stage configuration
enableSbatch = true;
enableControl = true;
enableExtrae = false;
enablePerf = false;
enableCtf = false;
# MN4 path
nixPrefix = "/gpfs/projects/bsc15/nix";
};
# Compute the cartesian product of all configurations
configs = map (conf: conf // common) (genConfigs varConfig);
stageProgram = stage:
if stage ? programPath
then "${stage}${stage.programPath}" else "${stage}";
w = runWrappers;
sbatch = {stage, conf, ...}: with conf; w.sbatch {
nodes = input.nodes;
program = stageProgram stage;
exclusive = true;
time = input.time;
#qos = "debug";
jobName = "creams-ss-${toString input.nodes}-${toString gitBranch}";
inherit nixPrefix ntasksPerNode;
};
control = {stage, conf, ...}: with conf; w.control {
program = stageProgram stage;
};
srun = {stage, conf, ...}: with conf; w.srun {
program = stageProgram stage;
srunOptions = "--cpu-bind=verbose,rank";
inherit nixPrefix;
};
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;
nixsetup = "${nixPrefix}/bin/nix-setup";
};
extrae = {stage, conf, ...}: w.extrae {
program = stageProgram stage;
traceLib = "mpi"; # mpi -> libtracempi.so
configFile = ./extrae.xml;
};
ctf = {stage, conf, ...}: w.argv {
program = stageProgram stage;
env = ''
export NANOS6=ctf
export NANOS6_CTF2PRV=0
'';
};
bscOverlay = import ../../../overlay.nix;
genPkgs = newOverlay: nixpkgs {
overlays = [
bscOverlay
newOverlay
];
};
inputDataset = {stage, conf, ...}:
let
input = bsc.garlic.creamsInput.override {
gitBranch = conf.gitBranch;
granul = conf.input.granul;
nprocz = conf.input.nprocz;
};
in w.argv
{
program = stageProgram stage;
env = ''
cp -r ${input}/SodTubeBenchmark/* .
chmod +w -R .
'';
};
# We may be able to use overlays by invoking the fix function directly, but we
# have to get the definition of the bsc packages and the garlic ones as
# overlays.
creamsFn = {stage, conf, ...}: with conf;
let
# We set the mpi implementation to the one specified in the conf, so all
# packages in bsc will use that one.
customPkgs = genPkgs (self: super: {
bsc = super.bsc // { mpi = conf.mpi; };
});
in
customPkgs.bsc.garlic.creams.override {
inherit cc 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
# Optionally profile nanos6 with the new ctf
++ optional enableCtf ctf
# Execute the app with the argv and env vars
++ [ inputDataset creamsFn ];
# List of actual programs to be executed
jobs = map (conf: w.stagen { inherit conf stages; }) configs;
in
# We simply run each program one after another
w.launch jobs

View File

@ -28,7 +28,7 @@ with stdenv.lib;
let
sbatchOpt = name: value: optionalString (value!=null)
"#SBATCH --${name}=${value}\n";
"#SBATCH --${name}=${toString value}\n";
sbatchEnable = name: value: optionalString (value!=null)
"#SBATCH --${name}\n";

View File

@ -143,14 +143,20 @@ let
# tampi = tampi;
# };
#
# creams = callPackage ./garlic/creams {
# stdenv = pkgs.gcc9Stdenv;
# mpi = intel-mpi;
# tampi = tampi.override {
# mpi = intel-mpi;
# };
# };
#
creams = callPackage ./garlic/creams {
gnuDef = self.gfortran10 ; # Default GNU compiler version
intelDef = self.bsc.icc ; # Default Intel compiler version
gitBranch = "garlic/mpi+send+seq";
cc = self.bsc.icc; # self.bsc.icc OR self.gfortran10;
mpi = self.bsc.mpi; # self.bsc.mpi OR self.bsc.openmpi-mn4;
};
creamsInput = callPackage ./garlic/creams/input.nix {
gitBranch = "garlic/mpi+send+seq";
};
# lulesh = callPackage ./garlic/lulesh {
# mpi = intel-mpi;
# };
@ -231,6 +237,25 @@ let
};
};
creams = {
ss = {
pure = callPackage ./garlic/exp/creams/ss+pure.nix {
pkgs = self // self.bsc.garlic;
nixpkgs = import <nixpkgs>;
genApp = self.bsc.garlic.genApp;
genConfigs = self.bsc.garlic.genConfigs;
runWrappers = self.bsc.garlic.runWrappers;
};
hybrid = callPackage ./garlic/exp/creams/ss+hybrid.nix {
pkgs = self // self.bsc.garlic;
nixpkgs = import <nixpkgs>;
genApp = self.bsc.garlic.genApp;
genConfigs = self.bsc.garlic.genConfigs;
runWrappers = self.bsc.garlic.runWrappers;
};
};
};
osu = rec {
latency-internode = callPackage ./garlic/exp/osu/latency.nix { };
latency-intranode = callPackage ./garlic/exp/osu/latency.nix {