WIP: Introduce Intel 2024, 2025, tasycl and oneMath #3

Draft
abonerib wants to merge 486 commits from abonerib/bscpkgs:pkgs/tasycl into master
2 changed files with 51 additions and 30 deletions
Showing only changes of commit 94276875c4 - Show all commits

View File

@ -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
@ -71,17 +55,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;

This is not good enough, since icpx is using gcc13 and clangOmpss may use a different version, which breaks everything.

<...>
hello-syclompss> extra flags after to /nix/store/zpqa97qz4xqd7cvr7fprs40gyq0fzzja-clang-ompss2-2025.06/bin/clang++:
<...>
hello-syclompss>   -isystem
hello-syclompss>   /nix/store/r5qg0d2j0pggy490rvp62vcgb7dp06dc-gcc-13.3.0/include/c++/13.3.0
hello-syclompss>   -isystem
hello-syclompss>   /nix/store/r5qg0d2j0pggy490rvp62vcgb7dp06dc-gcc-13.3.0/include/c++/13.3.0/x86_64-unknown-linux-gnu
hello-syclompss>   -isystem
hello-syclompss>   /nix/store/6i862vz60awrlsila8vw18rg4d4l66iy-gcc-14.2.1.20250322/include/c++/14.2.1.20250322
hello-syclompss>   -isystem
hello-syclompss>   /nix/store/6i862vz60awrlsila8vw18rg4d4l66iy-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/x86_64-unknown-linux-gnu
<...>
This is not good enough, since icpx is using gcc13 and clangOmpss may use a different version, which breaks everything. ``` <...> hello-syclompss> extra flags after to /nix/store/zpqa97qz4xqd7cvr7fprs40gyq0fzzja-clang-ompss2-2025.06/bin/clang++: <...> hello-syclompss> -isystem hello-syclompss> /nix/store/r5qg0d2j0pggy490rvp62vcgb7dp06dc-gcc-13.3.0/include/c++/13.3.0 hello-syclompss> -isystem hello-syclompss> /nix/store/r5qg0d2j0pggy490rvp62vcgb7dp06dc-gcc-13.3.0/include/c++/13.3.0/x86_64-unknown-linux-gnu hello-syclompss> -isystem hello-syclompss> /nix/store/6i862vz60awrlsila8vw18rg4d4l66iy-gcc-14.2.1.20250322/include/c++/14.2.1.20250322 hello-syclompss> -isystem hello-syclompss> /nix/store/6i862vz60awrlsila8vw18rg4d4l66iy-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/x86_64-unknown-linux-gnu <...> ```
};
})

View File

@ -1,4 +1,4 @@
{ writeText, intelPackages, nodes, nosv, clangOmpss2Nodes, clangOmpss2Unwrapped, clangOmpss2, strace }:
{ writeText, intelPackages, nodes, nosv, clangOmpss2Nodes, strace }:
let
hello_cpp = writeText "hello.cpp" ''
@ -44,6 +44,10 @@ intelPackages.stdenv.mkDerivation {
dontUnpack = true;
dontConfigure = true;
# NODES requires access to /sys/devices to request NUMA information. It will
# fail to run otherwise, so we disable the sandbox for this test.
__noChroot = true;
env.NODES_HOME = nodes;
NIX_DEBUG = 0;
@ -55,7 +59,7 @@ intelPackages.stdenv.mkDerivation {
command -v $CXX
icpx -Wno-deprecated-declarations -fsycl \
-fsycl-host-compiler=${clangOmpss2Nodes}/bin/clang++ \
-fsycl-host-compiler=${clangOmpss2Nodes.forIcpx}/bin/clang++ \
-fsycl-host-compiler-options='-Wno-deprecated-declarations -fompss-2=libnodes' \
-lnodes -lnosv \
$NODES_HOME/lib/nodes-main-wrapper.o \