From f65e4d01c3143ba2abd2c597d4f4e2f2a032f9c0 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Thu, 3 Dec 2020 18:06:51 +0100 Subject: [PATCH] Simplify compiler name variables --- garlic/apps/bigsort/default.nix | 6 +++--- garlic/apps/bigsort/genseq.nix | 2 +- garlic/apps/bigsort/shuffle.nix | 2 +- garlic/apps/hpcg/default.nix | 4 ++-- garlic/apps/nbody/default.nix | 2 +- garlic/apps/saiph/default.nix | 2 +- overlay.nix | 31 ++++++++++++++++--------------- 7 files changed, 25 insertions(+), 24 deletions(-) diff --git a/garlic/apps/bigsort/default.nix b/garlic/apps/bigsort/default.nix index 05c0342..e22097c 100644 --- a/garlic/apps/bigsort/default.nix +++ b/garlic/apps/bigsort/default.nix @@ -20,7 +20,7 @@ stdenv.mkDerivation rec { preBuild = '' cd BigSort - export I_MPI_CXX=${cc.cc.CXX} + export I_MPI_CXX=${cc.CXX} ''; buildInputs = [ @@ -31,8 +31,8 @@ stdenv.mkDerivation rec { ++ optional (nanos6 != null) nanos6; makeFlags = [ - "CC=${cc.cc.CC}" - "CXX=${cc.cc.CXX}" + "CC=${cc.CC}" + "CXX=${cc.CXX}" "CPP_BIN=mpicxx" "CLUSTER=MareNostrum4" "OPENMP=yes" diff --git a/garlic/apps/bigsort/genseq.nix b/garlic/apps/bigsort/genseq.nix index 8d95bbb..ca12edc 100644 --- a/garlic/apps/bigsort/genseq.nix +++ b/garlic/apps/bigsort/genseq.nix @@ -28,7 +28,7 @@ stdenv.mkDerivation rec { ]; makeFlags = [ - "I_MPI_CXX=${cc.cc.CXX}" + "I_MPI_CXX=${cc.CXX}" "CPP_BIN=mpicxx" ]; diff --git a/garlic/apps/bigsort/shuffle.nix b/garlic/apps/bigsort/shuffle.nix index 02c02e8..55ac106 100644 --- a/garlic/apps/bigsort/shuffle.nix +++ b/garlic/apps/bigsort/shuffle.nix @@ -28,7 +28,7 @@ stdenv.mkDerivation rec { ]; makeFlags = [ - "I_MPI_CXX=${cc.cc.CXX}" + "I_MPI_CXX=${cc.CXX}" "CPP_BIN=mpicxx" ]; diff --git a/garlic/apps/hpcg/default.nix b/garlic/apps/hpcg/default.nix index 3d62904..3f5737f 100644 --- a/garlic/apps/hpcg/default.nix +++ b/garlic/apps/hpcg/default.nix @@ -28,8 +28,8 @@ stdenv.mkDerivation rec { ++ optional (mpi != null) mpi; makeFlags = [ - "CC=${cc.cc.CC}" - "CXX=${cc.cc.CXX}" + "CC=${cc.CC}" + "CXX=${cc.CXX}" ]; enableParallelBuilding = true; diff --git a/garlic/apps/nbody/default.nix b/garlic/apps/nbody/default.nix index 70ece4b..57efb0c 100644 --- a/garlic/apps/nbody/default.nix +++ b/garlic/apps/nbody/default.nix @@ -36,7 +36,7 @@ stdenv.mkDerivation rec { '' else ""); makeFlags = [ - "CC=${cc.cc.CC}" + "CC=${cc.CC}" "BS=${toString blocksize}" ] ++ optional (tampi != null) "TAMPI_HOME=${tampi}"; diff --git a/garlic/apps/saiph/default.nix b/garlic/apps/saiph/default.nix index 9fe5f74..73f890c 100644 --- a/garlic/apps/saiph/default.nix +++ b/garlic/apps/saiph/default.nix @@ -52,7 +52,7 @@ stdenv.mkDerivation rec { ''; makeFlags = [ - "-f" "Makefile.${cc.cc.CC}" + "-f" "Makefile.${cc.CC}" "apps" "APP=Heat3D_vect" ] ++ optional (nbx != null) "NB_X=${toString nbx}" diff --git a/overlay.nix b/overlay.nix index f92befc..dad6235 100644 --- a/overlay.nix +++ b/overlay.nix @@ -8,6 +8,10 @@ let inherit (self.lib) callPackagesWith; callPackage = callPackageWith (self // self.bsc // self.garlic); + appendPasstru = drv: attrs: drv.overrideAttrs (old:{ + passthru = old.passthru // attrs; + }); + # --------------------------------------------------------- # # BSC Packages # --------------------------------------------------------- # @@ -55,22 +59,14 @@ let # A wrapper script that puts all the flags and environment vars properly and # calls the intel compiler binary - icc = callPackage ./bsc/intel-compiler/default.nix { + icc = appendPasstru (callPackage ./bsc/intel-compiler/default.nix { iccUnwrapped = bsc.iccUnwrapped; intelLicense = bsc.intelLicense; - }; + }) { CC = "icc"; CXX = "icpc"; }; - # We need to set the cc.cc.CC and cc.cc.CXX attributes, in order to + # We need to set the cc.CC and cc.CXX attributes, in order to # determine the name of the compiler - # FIXME: Use a proper and automatic way to compute the compiler name - gcc = self.gcc.overrideAttrs (old1: { - cc = old1.cc.overrideAttrs (old2: { - passthru = old2.passthru // { - CC = "gcc"; - CXX = "g++"; - }; - }); - }); + gcc = appendPasstru self.gcc { CC = "gcc"; CXX = "g++"; }; intelLicense = callPackage ./bsc/intel-compiler/license.nix { }; @@ -151,7 +147,12 @@ let #rdma-core = callPackage ./bsc/rdma-core/default.nix { }; # Last llvm release by default - llvmPackages = self.llvmPackages_11; + llvmPackages = self.llvmPackages_11 // { + clang = appendPasstru self.llvmPackages_11.clang { + CC = "clang"; CXX = "clang++"; + }; + }; + lld = bsc.llvmPackages.lld; clangOmpss2Unwrapped = callPackage ./bsc/llvm-ompss2/clang.nix { @@ -159,9 +160,9 @@ let enableDebug = false; }; - clangOmpss2 = callPackage bsc/llvm-ompss2/default.nix { + clangOmpss2 = appendPasstru (callPackage bsc/llvm-ompss2/default.nix { clangOmpss2Unwrapped = bsc.clangOmpss2Unwrapped; - }; + }) { CC = "clang"; CXX = "clang++"; }; stdenvOmpss2 = self.clangStdenv.override { cc = bsc.clangOmpss2;