Avoid nixpkgs reevaluation

The bsc attrset is now extensible: replacing a few bsc packages is very
fast. Also we allow the complete bscpkgs to be within other custom
overlays (not tested yet).
This commit is contained in:
Rodrigo Arias 2020-11-17 10:49:45 +01:00
parent 3372f94855
commit 18afcb1f44
2 changed files with 60 additions and 77 deletions

View File

@ -4,6 +4,7 @@
, stages , stages
, targetMachine , targetMachine
, garlicTools , garlicTools
, bsc
}: }:
with stdenv.lib; with stdenv.lib;
@ -82,18 +83,8 @@ rec {
stdPipeline = stdPipelineOverride {}; stdPipeline = stdPipelineOverride {};
# FIXME: Remove this hack and allow custom nixpkgs replaceMpi = customMpi: bsc.extend (self: super: {
bscOverlay = import ../overlay.nix; mpi = customMpi;
nixpkgs = import <nixpkgs>;
genPkgs = newOverlay: nixpkgs {
overlays = [
bscOverlay
newOverlay
];
};
replaceMpi = mpi: genPkgs (self: super: {
bsc = super.bsc // { inherit mpi; };
}); });
# Generate the experimental units # Generate the experimental units

View File

@ -1,6 +1,8 @@
self: /* Future last stage */ self: /* Future last stage */
super: /* Previous stage */ super: /* Previous stage */
with self.lib;
let let
inherit (self.lib) callPackageWith; inherit (self.lib) callPackageWith;
inherit (self.lib) callPackagesWith; inherit (self.lib) callPackagesWith;
@ -10,10 +12,10 @@ let
# BSC Packages # BSC Packages
# --------------------------------------------------------- # # --------------------------------------------------------- #
bsc = { _bsc = makeExtensible (bsc: {
# Default MPI implementation to use. Will be overwritten by the # Default MPI implementation to use. Will be overwritten by the
# experiments. # experiments.
mpi = self.bsc.impi; mpi = bsc.impi;
perf = callPackage ./bsc/perf/default.nix { perf = callPackage ./bsc/perf/default.nix {
kernel = self.linuxPackages_4_9.kernel; kernel = self.linuxPackages_4_9.kernel;
@ -28,15 +30,15 @@ let
mpich = callPackage ./bsc/mpich/default.nix { }; mpich = callPackage ./bsc/mpich/default.nix { };
mpichDebug = self.bsc.mpich.override { enableDebug = true; }; mpichDebug = bsc.mpich.override { enableDebug = true; };
# Updated version of libpsm2: TODO push upstream. # Updated version of libpsm2: TODO push upstream.
#libpsm2 = callPackage ./bsc/libpsm2/default.nix { }; #libpsm2 = callPackage ./bsc/libpsm2/default.nix { };
# Default Intel MPI version is 2019 (the last one) # Default Intel MPI version is 2019 (the last one)
impi = self.bsc.intelMpi; impi = bsc.intelMpi;
intelMpi = self.bsc.intelMpi2019; intelMpi = bsc.intelMpi2019;
intelMpi2019 = callPackage ./bsc/intel-mpi/default.nix { intelMpi2019 = callPackage ./bsc/intel-mpi/default.nix {
# Intel MPI provides a debug version of the MPI library, but # Intel MPI provides a debug version of the MPI library, but
@ -45,17 +47,17 @@ let
}; };
# By default we use Intel compiler 2020 update 1 # By default we use Intel compiler 2020 update 1
iccUnwrapped = self.bsc.icc2020Unwrapped; iccUnwrapped = bsc.icc2020Unwrapped;
icc2020Unwrapped = callPackage ./bsc/intel-compiler/icc2020.nix { icc2020Unwrapped = callPackage ./bsc/intel-compiler/icc2020.nix {
intel-mpi = self.bsc.intelMpi; intel-mpi = bsc.intelMpi;
}; };
# A wrapper script that puts all the flags and environment vars properly and # A wrapper script that puts all the flags and environment vars properly and
# calls the intel compiler binary # calls the intel compiler binary
icc = callPackage ./bsc/intel-compiler/default.nix { icc = callPackage ./bsc/intel-compiler/default.nix {
iccUnwrapped = self.bsc.iccUnwrapped; iccUnwrapped = bsc.iccUnwrapped;
intelLicense = self.bsc.intelLicense; intelLicense = bsc.intelLicense;
}; };
# We need to set the cc.cc.CC and cc.cc.CXX attributes, in order to # We need to set the cc.cc.CC and cc.cc.CXX attributes, in order to
@ -75,29 +77,29 @@ let
pmix2 = callPackage ./bsc/pmix/pmix2.nix { }; pmix2 = callPackage ./bsc/pmix/pmix2.nix { };
slurm17 = callPackage ./bsc/slurm/default.nix { slurm17 = callPackage ./bsc/slurm/default.nix {
pmix = self.bsc.pmix2; pmix = bsc.pmix2;
}; };
slurm17-libpmi2 = callPackage ./bsc/slurm/pmi2.nix { slurm17-libpmi2 = callPackage ./bsc/slurm/pmi2.nix {
pmix = self.bsc.pmix2; pmix = bsc.pmix2;
}; };
# Use a slurm compatible with MN4 # Use a slurm compatible with MN4
slurm = self.bsc.slurm17; slurm = bsc.slurm17;
openmpi-mn4 = callPackage ./bsc/openmpi/default.nix { openmpi-mn4 = callPackage ./bsc/openmpi/default.nix {
pmix = self.bsc.pmix2; pmix = bsc.pmix2;
pmi2 = self.bsc.slurm17-libpmi2; pmi2 = bsc.slurm17-libpmi2;
enableCxx = true; enableCxx = true;
}; };
openmpi = self.bsc.openmpi-mn4; openmpi = bsc.openmpi-mn4;
fftw = callPackage ./bsc/fftw/default.nix { }; fftw = callPackage ./bsc/fftw/default.nix { };
extrae = callPackage ./bsc/extrae/default.nix { }; extrae = callPackage ./bsc/extrae/default.nix { };
tampi = self.bsc.tampiRelease; tampi = bsc.tampiRelease;
tampiRelease = callPackage ./bsc/tampi/default.nix { }; tampiRelease = callPackage ./bsc/tampi/default.nix { };
tampiGit = callPackage ./bsc/tampi/git.nix { }; tampiGit = callPackage ./bsc/tampi/git.nix { };
@ -109,10 +111,10 @@ let
bison = self.bison_3_5; bison = self.bison_3_5;
}; };
mcxx = self.bsc.mcxxGit; mcxx = bsc.mcxxGit;
# Use nanos6 git by default # Use nanos6 git by default
nanos6 = self.bsc.nanos6Git; nanos6 = bsc.nanos6Git;
nanos6Latest = callPackage ./bsc/nanos6/default.nix { }; nanos6Latest = callPackage ./bsc/nanos6/default.nix { };
nanos6Git = callPackage ./bsc/nanos6/git.nix { }; nanos6Git = callPackage ./bsc/nanos6/git.nix { };
@ -147,17 +149,17 @@ let
}; };
clangOmpss2 = callPackage bsc/llvm-ompss2/default.nix { clangOmpss2 = callPackage bsc/llvm-ompss2/default.nix {
clangOmpss2Unwrapped = self.bsc.clangOmpss2Unwrapped; clangOmpss2Unwrapped = bsc.clangOmpss2Unwrapped;
}; };
stdenvOmpss2 = self.clangStdenv.override { stdenvOmpss2 = self.clangStdenv.override {
cc = self.bsc.clangOmpss2; cc = bsc.clangOmpss2;
}; };
cpic = callPackage ./bsc/apps/cpic/default.nix { cpic = callPackage ./bsc/apps/cpic/default.nix {
stdenv = self.bsc.stdenvOmpss2; stdenv = bsc.stdenvOmpss2;
mpi = self.bsc.mpi; mpi = bsc.mpi;
tampi = self.bsc.tampi; tampi = bsc.tampi;
}; };
mpptest = callPackage ./bsc/mpptest/default.nix { }; mpptest = callPackage ./bsc/mpptest/default.nix { };
@ -172,6 +174,12 @@ let
garlicTools = callPackage ./garlic/tools.nix {}; garlicTools = callPackage ./garlic/tools.nix {};
# Aliases
apps = bsc.garlic.apps;
fig = bsc.garlic.fig;
exp = bsc.garlic.exp;
ds = bsc.garlic.ds;
garlic = { garlic = {
# TODO: move into garlic/default.nix # TODO: move into garlic/default.nix
@ -179,19 +187,19 @@ let
machines = callPackage ./garlic/machines.nix {}; machines = callPackage ./garlic/machines.nix {};
report = callPackage ./garlic/report.nix { report = callPackage ./garlic/report.nix {
fig = self.bsc.garlic.fig; fig = bsc.garlic.fig;
}; };
sedReport = callPackage ./garlic/sedReport.nix { sedReport = callPackage ./garlic/sedReport.nix {
fig = self.bsc.garlic.fig; fig = bsc.garlic.fig;
}; };
# Use the configuration for the following target machine # Use the configuration for the following target machine
targetMachine = self.garlic.machines.mn4; targetMachine = bsc.garlic.machines.mn4;
# Load some helper functions to generate app variants # Load some helper functions to generate app variants
stdexp = callPackage ./garlic/stdexp.nix { stdexp = callPackage ./garlic/stdexp.nix {
inherit (self.garlic) targetMachine stages; inherit (bsc.garlic) targetMachine stages;
}; };
# Apps for Garlic # Apps for Garlic
@ -199,23 +207,23 @@ let
apps = { apps = {
nbody = callPackage ./garlic/apps/nbody/default.nix { nbody = callPackage ./garlic/apps/nbody/default.nix {
cc = self.bsc.icc; cc = bsc.icc;
mpi = self.bsc.mpi; mpi = bsc.mpi;
tampi = self.bsc.tampi; tampi = bsc.tampi;
mcxx = self.bsc.mcxx; mcxx = bsc.mcxx;
gitBranch = "garlic/seq"; gitBranch = "garlic/seq";
}; };
saiph = callPackage ./garlic/apps/saiph/default.nix { saiph = callPackage ./garlic/apps/saiph/default.nix {
cc = self.bsc.clangOmpss2; cc = bsc.clangOmpss2;
}; };
creams = callPackage ./garlic/apps/creams/default.nix { creams = callPackage ./garlic/apps/creams/default.nix {
gnuDef = self.gfortran10 ; # Default GNU compiler version gnuDef = self.gfortran10 ; # Default GNU compiler version
intelDef = self.bsc.icc ; # Default Intel compiler version intelDef = bsc.icc ; # Default Intel compiler version
gitBranch = "garlic/mpi+send+seq"; gitBranch = "garlic/mpi+send+seq";
cc = self.bsc.icc; # self.bsc.icc OR self.gfortran10; cc = bsc.icc; # bsc.icc OR self.gfortran10;
mpi = self.bsc.mpi; # self.bsc.mpi OR self.bsc.openmpi-mn4; mpi = bsc.mpi; # bsc.mpi OR bsc.openmpi-mn4;
}; };
creamsInput = callPackage ./garlic/apps/creams/input.nix { creamsInput = callPackage ./garlic/apps/creams/input.nix {
@ -223,25 +231,10 @@ let
}; };
hpcg = callPackage ./garlic/apps/hpcg/default.nix { hpcg = callPackage ./garlic/apps/hpcg/default.nix {
cc = self.bsc.icc; cc = bsc.icc;
mcxx = self.bsc.mcxx; mcxx = bsc.mcxx;
nanos6 = self.bsc.nanos6; nanos6 = bsc.nanos6;
gitBranch = "garlic/oss"; gitBranch = "garlic/oss";
# cc = self.bsc.icc;
# gitBranch = "garlic/seq";
# cc = self.bsc.icc;
# mpi = self.bsc.mpi;
# gitBranch = "garlic/mpi";
# cc = self.bsc.icc;
# gitBranch = "garlic/omp";
# cc = self.bsc.icc;
# mpi = self.bsc.mpi;
# gitBranch = "garlic/mpi+omp";
}; };
heat = callPackage ./garlic/apps/heat/default.nix { }; heat = callPackage ./garlic/apps/heat/default.nix { };
@ -253,8 +246,8 @@ let
# #
# # FIXME: Nanos6 fails to load if we are not using a compatible stdc++ # # FIXME: Nanos6 fails to load if we are not using a compatible stdc++
# # version, so we use the same provided by gcc7 # # version, so we use the same provided by gcc7
# mcxx = self.bsc.mcxx.override { # mcxx = bsc.mcxx.override {
# nanos6 = self.bsc.nanos6.override { # nanos6 = bsc.nanos6.override {
# stdenv = self.gcc7Stdenv; # stdenv = self.gcc7Stdenv;
# }; # };
# }; # };
@ -290,7 +283,7 @@ let
mpptest = callPackage ./garlic/mpptest { }; mpptest = callPackage ./garlic/mpptest { };
ppong = callPackage ./garlic/ppong { ppong = callPackage ./garlic/ppong {
mpi = self.bsc.mpi; mpi = bsc.mpi;
}; };
hist = callPackage ./garlic/pp/hist { }; hist = callPackage ./garlic/pp/hist { };
@ -300,7 +293,7 @@ let
}; };
# Post processing tools # Post processing tools
pp = with self.bsc.garlicTools; rec { pp = with bsc.garlicTools; rec {
store = callPackage ./garlic/pp/store.nix { }; store = callPackage ./garlic/pp/store.nix { };
resultFromTrebuchet = trebuchetStage: (store { resultFromTrebuchet = trebuchetStage: (store {
experimentStage = getExperimentStage trebuchetStage; experimentStage = getExperimentStage trebuchetStage;
@ -346,10 +339,10 @@ let
omp = callPackage ./garlic/exp/hpcg/omp.nix { }; omp = callPackage ./garlic/exp/hpcg/omp.nix { };
mpi_omp = callPackage ./garlic/exp/hpcg/mpi+omp.nix { }; mpi_omp = callPackage ./garlic/exp/hpcg/mpi+omp.nix { };
input = callPackage ./garlic/exp/hpcg/gen.nix { input = callPackage ./garlic/exp/hpcg/gen.nix {
inherit (self.bsc.garlic.pp) resultFromTrebuchet; inherit (bsc.garlic.pp) resultFromTrebuchet;
}; };
oss = callPackage ./garlic/exp/hpcg/oss.nix { oss = callPackage ./garlic/exp/hpcg/oss.nix {
genInput = self.bsc.garlic.exp.hpcg.input; genInput = bsc.garlic.exp.hpcg.input;
}; };
}; };
@ -359,7 +352,7 @@ let
}; };
# Datasets used in the figures # Datasets used in the figures
ds = with self.bsc.garlic; with pp; { ds = with bsc.garlic; with pp; {
nbody = with exp.nbody; { nbody = with exp.nbody; {
baseline = merge [ baseline ]; baseline = merge [ baseline ];
jemalloc = merge [ baseline jemalloc ]; jemalloc = merge [ baseline jemalloc ];
@ -381,7 +374,7 @@ let
}; };
# Figures generated from the experiments # Figures generated from the experiments
fig = with self.bsc.garlic; { fig = with bsc.garlic; {
nbody = { nbody = {
baseline = pp.rPlot { baseline = pp.rPlot {
script = ./garlic/fig/nbody/baseline.R; script = ./garlic/fig/nbody/baseline.R;
@ -419,13 +412,12 @@ let
}; };
}; };
}; };
}; });
in in
{ {
bsc = bsc; bsc = _bsc;
# Aliases # Aliases
garlic = bsc.garlic; garlic = _bsc.garlic;
inherit (bsc.garlic) exp fig apps ds;
} }