Split openmp versions in separate derivations
The openmp derivation provides both libomp and libompv. To avoid accidentally linking with the wrong library and to avoid the nosv dependency on libomp, this patch separates each version in a different derivation. Also, it adapts the clang wrappers and stdenvs to provide an stdenv per openmp library where each openmp will be used by default when the compiler flag "-fopenmp" is used. This eases linking ompv with nixpkgs libraries, such as blis, that expect openmp to be provided with stdenv. Reviewed-by: Rodrigo Arias Mallo <rodrigo.arias@bsc.es> Tested-by: Rodrigo Arias Mallo <rodrigo.arias@bsc.es>
This commit is contained in:
parent
3f2b9a766b
commit
c4d5135fde
15
overlay.nix
15
overlay.nix
@ -12,9 +12,9 @@ let
|
|||||||
bscPkgs = {
|
bscPkgs = {
|
||||||
bench6 = callPackage ./pkgs/bench6/default.nix { };
|
bench6 = callPackage ./pkgs/bench6/default.nix { };
|
||||||
clangOmpss2 = callPackage ./pkgs/llvm-ompss2/default.nix { };
|
clangOmpss2 = callPackage ./pkgs/llvm-ompss2/default.nix { };
|
||||||
openmp = callPackage ./pkgs/llvm-ompss2/openmp.nix { monorepoSrc = final.clangOmpss2Unwrapped.src; version = final.clangOmpss2Unwrapped.version; };
|
|
||||||
clangOmpss2Nanos6 = callPackage ./pkgs/llvm-ompss2/default.nix { ompss2rt = final.nanos6; };
|
clangOmpss2Nanos6 = callPackage ./pkgs/llvm-ompss2/default.nix { ompss2rt = final.nanos6; };
|
||||||
clangOmpss2Nodes = callPackage ./pkgs/llvm-ompss2/default.nix { ompss2rt = final.nodes; };
|
clangOmpss2Nodes = callPackage ./pkgs/llvm-ompss2/default.nix { ompss2rt = final.nodes; openmp = final.openmp; };
|
||||||
|
clangOmpss2NodesOmpv = callPackage ./pkgs/llvm-ompss2/default.nix { ompss2rt = final.nodes; openmp = final.openmpv; };
|
||||||
clangOmpss2Unwrapped = callPackage ./pkgs/llvm-ompss2/clang.nix { };
|
clangOmpss2Unwrapped = callPackage ./pkgs/llvm-ompss2/clang.nix { };
|
||||||
#extrae = callPackage ./pkgs/extrae/default.nix { }; # Broken and outdated
|
#extrae = callPackage ./pkgs/extrae/default.nix { }; # Broken and outdated
|
||||||
gpi-2 = callPackage ./pkgs/gpi-2/default.nix { };
|
gpi-2 = callPackage ./pkgs/gpi-2/default.nix { };
|
||||||
@ -30,6 +30,8 @@ let
|
|||||||
#nix-wrap = callPackage ./pkgs/nix-wrap/default.nix { };
|
#nix-wrap = callPackage ./pkgs/nix-wrap/default.nix { };
|
||||||
nodes = callPackage ./pkgs/nodes/default.nix { };
|
nodes = callPackage ./pkgs/nodes/default.nix { };
|
||||||
nosv = callPackage ./pkgs/nosv/default.nix { };
|
nosv = callPackage ./pkgs/nosv/default.nix { };
|
||||||
|
openmp = callPackage ./pkgs/llvm-ompss2/openmp.nix { monorepoSrc = final.clangOmpss2Unwrapped.src; version = final.clangOmpss2Unwrapped.version; };
|
||||||
|
openmpv = final.openmp.override { enableNosv = true; };
|
||||||
osumb = callPackage ./pkgs/osu/default.nix { };
|
osumb = callPackage ./pkgs/osu/default.nix { };
|
||||||
ovni = callPackage ./pkgs/ovni/default.nix { };
|
ovni = callPackage ./pkgs/ovni/default.nix { };
|
||||||
ovniGit = final.ovni.override { useGit = true; };
|
ovniGit = final.ovni.override { useGit = true; };
|
||||||
@ -40,6 +42,7 @@ let
|
|||||||
stdenvClangOmpss2 = final.stdenv.override { cc = final.clangOmpss2; allowedRequisites = null; };
|
stdenvClangOmpss2 = final.stdenv.override { cc = final.clangOmpss2; allowedRequisites = null; };
|
||||||
stdenvClangOmpss2Nanos6 = final.stdenv.override { cc = final.clangOmpss2Nanos6; allowedRequisites = null; };
|
stdenvClangOmpss2Nanos6 = final.stdenv.override { cc = final.clangOmpss2Nanos6; allowedRequisites = null; };
|
||||||
stdenvClangOmpss2Nodes = final.stdenv.override { cc = final.clangOmpss2Nodes; allowedRequisites = null; };
|
stdenvClangOmpss2Nodes = final.stdenv.override { cc = final.clangOmpss2Nodes; allowedRequisites = null; };
|
||||||
|
stdenvClangOmpss2NodesOmpv = final.stdenv.override { cc = final.clangOmpss2NodesOmpv; allowedRequisites = null; };
|
||||||
tagaspi = callPackage ./pkgs/tagaspi/default.nix { };
|
tagaspi = callPackage ./pkgs/tagaspi/default.nix { };
|
||||||
tampi = callPackage ./pkgs/tampi/default.nix { };
|
tampi = callPackage ./pkgs/tampi/default.nix { };
|
||||||
wxparaver = callPackage ./pkgs/paraver/default.nix { };
|
wxparaver = callPackage ./pkgs/paraver/default.nix { };
|
||||||
@ -76,11 +79,11 @@ in bscPkgs // {
|
|||||||
clangNosvOpenmp-task = callPackage ./test/compilers/clang-openmp.nix {
|
clangNosvOpenmp-task = callPackage ./test/compilers/clang-openmp.nix {
|
||||||
stdenv = final.stdenvClangOmpss2Nodes;
|
stdenv = final.stdenvClangOmpss2Nodes;
|
||||||
};
|
};
|
||||||
clangNosvOpenmp-nosv = callPackage ./test/compilers/clang-openmp-nosv.nix {
|
clangNosvOmpv-nosv = callPackage ./test/compilers/clang-openmp-nosv.nix {
|
||||||
stdenv = final.stdenvClangOmpss2Nodes;
|
stdenv = final.stdenvClangOmpss2NodesOmpv;
|
||||||
};
|
};
|
||||||
clangNosvOpenmp-ld = callPackage ./test/compilers/clang-openmp-ld.nix {
|
clangNosvOmpv-ld = callPackage ./test/compilers/clang-openmp-ld.nix {
|
||||||
stdenv = final.stdenvClangOmpss2Nodes;
|
stdenv = final.stdenvClangOmpss2NodesOmpv;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3,15 +3,24 @@
|
|||||||
, lib
|
, lib
|
||||||
, gcc
|
, gcc
|
||||||
, clangOmpss2Unwrapped
|
, clangOmpss2Unwrapped
|
||||||
|
, openmp ? null
|
||||||
, wrapCCWith
|
, wrapCCWith
|
||||||
, llvmPackages_latest
|
, llvmPackages_latest
|
||||||
, ompss2rt ? null
|
, ompss2rt ? null
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
usingNodesAndOmpv = (openmp.pname == "openmp-v" && ompss2rt.pname == "nodes");
|
||||||
|
sameNosv = openmp.nosv == ompss2rt.nosv;
|
||||||
|
in
|
||||||
|
|
||||||
|
assert lib.assertMsg (usingNodesAndOmpv -> sameNosv) "OpenMP-V and NODES must share the same nOS-V";
|
||||||
|
|
||||||
let
|
let
|
||||||
homevar = if ompss2rt.pname == "nanos6" then "NANOS6_HOME" else "NODES_HOME";
|
homevar = if ompss2rt.pname == "nanos6" then "NANOS6_HOME" else "NODES_HOME";
|
||||||
rtname = if ompss2rt.pname == "nanos6" then "libnanos6" else "libnodes";
|
rtname = if ompss2rt.pname == "nanos6" then "libnanos6" else "libnodes";
|
||||||
|
ompname = if openmp.pname == "openmp-v" then "libompv" else "libomp";
|
||||||
|
|
||||||
|
|
||||||
# We need to replace the lld linker from bintools with our linker just built,
|
# We need to replace the lld linker from bintools with our linker just built,
|
||||||
# otherwise we run into incompatibility issues when mixing compiler and linker
|
# otherwise we run into incompatibility issues when mixing compiler and linker
|
||||||
@ -27,6 +36,8 @@ let
|
|||||||
cc = clangOmpss2Unwrapped;
|
cc = clangOmpss2Unwrapped;
|
||||||
in wrapCCWith {
|
in wrapCCWith {
|
||||||
inherit cc bintools;
|
inherit cc bintools;
|
||||||
|
# extraPackages adds packages to depsTargetTargetPropagated
|
||||||
|
extraPackages = lib.optional (openmp != null) openmp;
|
||||||
extraBuildCommands = ''
|
extraBuildCommands = ''
|
||||||
echo "-target ${targetConfig}" >> $out/nix-support/cc-cflags
|
echo "-target ${targetConfig}" >> $out/nix-support/cc-cflags
|
||||||
echo "-B${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}" >> $out/nix-support/cc-cflags
|
echo "-B${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}" >> $out/nix-support/cc-cflags
|
||||||
@ -43,6 +54,9 @@ in wrapCCWith {
|
|||||||
echo "--gcc-toolchain=${gcc}" >> $out/nix-support/cc-cflags
|
echo "--gcc-toolchain=${gcc}" >> $out/nix-support/cc-cflags
|
||||||
|
|
||||||
wrap clang++ $wrapper $ccPath/clang++
|
wrap clang++ $wrapper $ccPath/clang++
|
||||||
|
|
||||||
|
'' + lib.optionalString (openmp != null) ''
|
||||||
|
echo "export OPENMP_RUNTIME=${ompname}" >> $out/nix-support/cc-wrapper-hook
|
||||||
'' + lib.optionalString (ompss2rt != null) ''
|
'' + lib.optionalString (ompss2rt != null) ''
|
||||||
echo "export OMPSS2_RUNTIME=${rtname}" >> $out/nix-support/cc-wrapper-hook
|
echo "export OMPSS2_RUNTIME=${rtname}" >> $out/nix-support/cc-wrapper-hook
|
||||||
echo "export ${homevar}=${ompss2rt}" >> $out/nix-support/cc-wrapper-hook
|
echo "export ${homevar}=${ompss2rt}" >> $out/nix-support/cc-wrapper-hook
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
, pkg-config
|
, pkg-config
|
||||||
, version
|
, version
|
||||||
, nosv
|
, nosv
|
||||||
|
, enableNosv ? false
|
||||||
, enableDebug ? false
|
, enableDebug ? false
|
||||||
}:
|
}:
|
||||||
|
|
||||||
@ -16,22 +17,23 @@ let
|
|||||||
stdenv = llvmPackages_latest.stdenv;
|
stdenv = llvmPackages_latest.stdenv;
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "openmp";
|
pname = "openmp" + (lib.optionalString enableNosv "-v");
|
||||||
inherit version;
|
inherit version;
|
||||||
|
|
||||||
src = runCommand "${pname}-src" {} ''
|
src = runCommand "${pname}-src" {} ''
|
||||||
mkdir -p "$out"
|
mkdir -p "$out"
|
||||||
cp -r ${monorepoSrc}/cmake "$out"
|
cp -r ${monorepoSrc}/cmake "$out"
|
||||||
cp -r ${monorepoSrc}/${pname} "$out"
|
cp -r ${monorepoSrc}/openmp "$out"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
sourceRoot = "${src.name}/${pname}";
|
sourceRoot = "${src.name}/openmp";
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
cmake
|
cmake
|
||||||
ninja
|
ninja
|
||||||
perl
|
perl
|
||||||
pkg-config
|
pkg-config
|
||||||
|
] ++ lib.optionals enableNosv [
|
||||||
nosv
|
nosv
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -48,10 +50,18 @@ stdenv.mkDerivation rec {
|
|||||||
"-DOPENMP_ENABLE_LIBOMPTARGET=OFF"
|
"-DOPENMP_ENABLE_LIBOMPTARGET=OFF"
|
||||||
];
|
];
|
||||||
|
|
||||||
# Remove support for GNU and Intel Openmp
|
# Remove support for GNU and Intel Openmp.
|
||||||
|
# Also, remove libomp if building with nosv, as there is no support to build
|
||||||
|
# only one runtime at a time.
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
rm -f $out/lib/libgomp*
|
rm -f $out/lib/libgomp*
|
||||||
rm -f $out/lib/libiomp*
|
rm -f $out/lib/libiomp*
|
||||||
|
'' + lib.optionalString enableNosv ''
|
||||||
|
rm -f $out/lib/libomp.*
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
passthru = {
|
||||||
|
inherit nosv;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,6 +84,6 @@ in
|
|||||||
];
|
];
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
nosv = nosv;
|
inherit nosv;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
stdenv
|
stdenv
|
||||||
, nosv
|
, nosv
|
||||||
, writeText
|
, writeText
|
||||||
, openmp
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
@ -41,7 +40,7 @@ in stdenv.mkDerivation {
|
|||||||
# fail to run otherwise, so we disable the sandbox for this test.
|
# fail to run otherwise, so we disable the sandbox for this test.
|
||||||
__noChroot = true;
|
__noChroot = true;
|
||||||
|
|
||||||
buildInputs = [ nosv openmp ];
|
buildInputs = [ nosv ];
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
set -x
|
set -x
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
{
|
{
|
||||||
stdenv
|
stdenv
|
||||||
, writeText
|
, writeText
|
||||||
, openmp
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
@ -29,8 +28,6 @@ in stdenv.mkDerivation {
|
|||||||
# fail to run otherwise, so we disable the sandbox for this test.
|
# fail to run otherwise, so we disable the sandbox for this test.
|
||||||
__noChroot = true;
|
__noChroot = true;
|
||||||
|
|
||||||
buildInputs = [ openmp ];
|
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user