|
|
|
|
@ -39,22 +39,6 @@ let
|
|
|
|
|
cc = clangOmpss2Unwrapped;
|
|
|
|
|
gccVersion = with versions; let v = gcc.version; in concatStringsSep "." [(major v) (minor v) (patch v)];
|
|
|
|
|
|
|
|
|
|
resetIntelCCFlags = let tconf = builtins.replaceStrings ["-"] ["_"] targetConfig;
|
|
|
|
|
in writeShellScript "remove-intel.sh" ''
|
|
|
|
|
if [ "''${NIX_CC_WRAPPER_INTEL:-0}" = 1 ]; then
|
|
|
|
|
unset NIX_CFLAGS_COMPILE_${tconf}
|
|
|
|
|
unset NIX_CC_WRAPPER_FLAGS_SET_${tconf}
|
|
|
|
|
|
|
|
|
|
if (( "${NIX_DEBUG:-0}" >= 1 )); then
|
|
|
|
|
echo "ompss2: cleaned NIX_CFLAGS_COMPILE_${tconf} (invokation from intel compiler detected)"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
in wrapCCWith {
|
|
|
|
|
inherit cc bintools;
|
|
|
|
|
# extraPackages adds packages to depsTargetTargetPropagated
|
|
|
|
|
extraPackages = optional (openmp != null) openmp;
|
|
|
|
|
extraBuildCommands = ''
|
|
|
|
|
echo "-target ${targetConfig}" >> $out/nix-support/cc-cflags
|
|
|
|
|
echo "-B${gcc.cc}/lib/gcc/${targetConfig}/${gccVersion}" >> $out/nix-support/cc-cflags
|
|
|
|
|
@ -74,17 +58,50 @@ in wrapCCWith {
|
|
|
|
|
echo "--gcc-toolchain=${gcc}" >> $out/nix-support/cc-cflags
|
|
|
|
|
|
|
|
|
|
wrap clang++ $wrapper $ccPath/clang++
|
|
|
|
|
|
|
|
|
|
sed -i 's|# Flirting.*|source ${resetIntelCCFlags}\n\n&|' $out/bin/clang
|
|
|
|
|
sed -i 's|# Flirting.*|&\nsource ${resetIntelCCFlags}\n\n&|' $out/bin/clang++
|
|
|
|
|
|
|
|
|
|
'' + lib.optionalString (openmp != null) ''
|
|
|
|
|
echo "export OPENMP_RUNTIME=${ompname}" >> $out/nix-support/cc-wrapper-hook
|
|
|
|
|
'' + optionalString (ompss2rt != null) ''
|
|
|
|
|
echo "export OMPSS2_RUNTIME=${rtname}" >> $out/nix-support/cc-wrapper-hook
|
|
|
|
|
echo "export ${homevar}=${ompss2rt}" >> $out/nix-support/cc-wrapper-hook
|
|
|
|
|
'' + optionalString (ompss2rt != null && ompss2rt.pname == "nodes") ''
|
|
|
|
|
echo "export NOSV_HOME=${ompss2rt.nosv}" >> $out/nix-support/cc-wrapper-hook
|
|
|
|
|
'';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
envExports = lib.optionalString (openmp != null) ''
|
|
|
|
|
echo "export OPENMP_RUNTIME=${ompname}" >> $out/nix-support/cc-wrapper-hook
|
|
|
|
|
'' + optionalString (ompss2rt != null) ''
|
|
|
|
|
echo "export OMPSS2_RUNTIME=${rtname}" >> $out/nix-support/cc-wrapper-hook
|
|
|
|
|
echo "export ${homevar}=${ompss2rt}" >> $out/nix-support/cc-wrapper-hook
|
|
|
|
|
'' + optionalString (ompss2rt != null && ompss2rt.pname == "nodes") ''
|
|
|
|
|
echo "export NOSV_HOME=${ompss2rt.nosv}" >> $out/nix-support/cc-wrapper-hook
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
extraPackages = optional (openmp != null) openmp;
|
|
|
|
|
|
|
|
|
|
wrappedCC = wrapCCWith {
|
|
|
|
|
# extraPackages adds packages to depsTargetTargetPropagated
|
|
|
|
|
inherit cc bintools extraPackages;
|
|
|
|
|
extraBuildCommands = extraBuildCommands + envExports;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
resetIntelCCFlags = let tconf = builtins.replaceStrings ["-"] ["_"] targetConfig;
|
|
|
|
|
in writeShellScript "remove-intel.sh" ''
|
|
|
|
|
if [ "''${NIX_CC_WRAPPER_INTEL:-0}" = 1 ]; then
|
|
|
|
|
unset NIX_CFLAGS_COMPILE_${tconf}
|
|
|
|
|
unset NIX_CC_WRAPPER_FLAGS_SET_${tconf}
|
|
|
|
|
|
|
|
|
|
if (( "''${NIX_DEBUG:-0}" >= 1 )); then
|
|
|
|
|
echo "ompss2: cleaned NIX_CFLAGS_COMPILE_${tconf} (invokation from intel compiler detected)"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
intelExtraBuildCommands = ''
|
|
|
|
|
sed -i 's|# Flirting.*|source ${resetIntelCCFlags}\n\n&|' $out/bin/clang
|
|
|
|
|
sed -i 's|# Flirting.*|source ${resetIntelCCFlags}\n\n&|' $out/bin/clang++
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
wrappedCCIntel = wrapCCWith {
|
|
|
|
|
inherit cc bintools extraPackages;
|
|
|
|
|
# extraPackages adds packages to depsTargetTargetPropagated
|
|
|
|
|
extraBuildCommands = intelExtraBuildCommands + envExports;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
in wrappedCC.overrideAttrs (oldAttrs: {
|
|
|
|
|
passthru = oldAttrs.passthru // {
|
|
|
|
|
forIcpx = wrappedCCIntel;
|
|
|
|
|
};
|
|
|
|
|
})
|
|
|
|
|
|