Compare commits
8 Commits
bdbfd77446
...
ab90f49af9
| Author | SHA1 | Date | |
|---|---|---|---|
| ab90f49af9 | |||
| a2b0171a06 | |||
| 1909b68999 | |||
| 9785ff3ca4 | |||
| daccf248af | |||
| 77de71bf1f | |||
| d5aa80de5a | |||
| 6b6ffa864d |
@ -24,6 +24,7 @@ let
|
||||
intelPackages_2024 = final.intel-apt.hpckit_2024;
|
||||
intelPackages_2025 = final.intel-apt.hpckit_2025;
|
||||
intelPackages = final.intelPackages_2025;
|
||||
oneMath = callPackage ./pkgs/onemath/default.nix { };
|
||||
jemallocNanos6 = callPackage ./pkgs/nanos6/jemalloc.nix { };
|
||||
lmbench = callPackage ./pkgs/lmbench/default.nix { };
|
||||
mcxx = callPackage ./pkgs/mcxx/default.nix { };
|
||||
|
||||
@ -47,40 +47,31 @@ let
|
||||
installPhase = ''
|
||||
awk -F': ' '\
|
||||
BEGIN { print "[ {" } \
|
||||
NR>1 && /^Package: / { print "} {"; } \
|
||||
NF==0 { empty=1; } \
|
||||
NF && empty { print "} {"; empty=0; } \
|
||||
/: / { printf "%s = \"%s\";\n", $1, $2 } \
|
||||
END { print "} ]" }' $srcs > $out
|
||||
'';
|
||||
};
|
||||
|
||||
aptPackages = import aptPackageIndex;
|
||||
|
||||
apthost = "https://apt.repos.intel.com/oneapi/";
|
||||
|
||||
getSum = pkgList: name:
|
||||
findMatch = name:
|
||||
let
|
||||
matches = lib.filter (x: name == x.Package) pkgList;
|
||||
#n = lib.length matches;
|
||||
#match = builtins.trace (name + " -- ${builtins.toString n}") (lib.elemAt matches 0);
|
||||
match = lib.elemAt matches 0;
|
||||
in
|
||||
match.SHA256;
|
||||
|
||||
getUrl = pkgList: name:
|
||||
let
|
||||
matches = lib.filter (x: name == x.Package) pkgList;
|
||||
#match = assert lib.length matches == 1; lib.elemAt matches 0;
|
||||
aptPackages = import aptPackageIndex;
|
||||
matches = lib.filter (x: name == x.Package) aptPackages;
|
||||
n = lib.length matches;
|
||||
match =
|
||||
#builtins.trace (name + " -- n=${builtins.toString n}")
|
||||
(lib.elemAt matches 0);
|
||||
match = builtins.traceVerbose (name + " -- ${builtins.toString n}") (builtins.head matches);
|
||||
|
||||
apthost = "https://apt.repos.intel.com/oneapi/";
|
||||
in
|
||||
apthost + match.Filename;
|
||||
{
|
||||
url = apthost + match.Filename;
|
||||
sha256 = match.SHA256;
|
||||
};
|
||||
|
||||
uncompressDebs = debs: name: stdenv.mkDerivation {
|
||||
name = name;
|
||||
srcs = debs;
|
||||
buildInputs = [ dpkg ];
|
||||
nativeBuildInputs = [ dpkg ];
|
||||
phases = [ "installPhase" ];
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
@ -93,10 +84,7 @@ let
|
||||
|
||||
joinDebs = name: names:
|
||||
let
|
||||
urls = builtins.map (x: getUrl aptPackages x) names;
|
||||
sums = builtins.map (x: getSum aptPackages x) names;
|
||||
getsrc = url: sha256: builtins.fetchurl { inherit url sha256; };
|
||||
debs = lib.zipListsWith getsrc urls sums;
|
||||
debs = builtins.map (x: builtins.fetchurl (findMatch x)) names;
|
||||
in
|
||||
uncompressDebs debs "${name}-source";
|
||||
|
||||
@ -453,7 +441,7 @@ let
|
||||
'';
|
||||
};
|
||||
|
||||
ifort-wrapper = wrapIntel rec {
|
||||
ifort-wrapper = wrapIntel {
|
||||
cc = intel-compiler-fortran;
|
||||
mygcc = gcc;
|
||||
extraBuild = ''
|
||||
|
||||
@ -147,8 +147,13 @@ stdenvNoCC.mkDerivation (finalAttrs: {
|
||||
ln -s $out/bin/icpx $out/bin/c++
|
||||
ln -s $out/bin/icx $out/bin/cc
|
||||
|
||||
# Use this to detect when a compiler subprocess is called
|
||||
# from icpx (--fsycl-host-compiler)
|
||||
echo 'export "NIX_CC_WRAPPER_INTEL=1"' >> $out/nix-support/cc-wrapper-hook
|
||||
|
||||
sed -i 's/.*isCxx=0/isCxx=1/' $out/bin/icpx
|
||||
|
||||
# oneMath looks for sycl libraries in bin/../lib
|
||||
ln -s ${finalAttrs.finalPackage.pkgs.compiler}/lib $out/lib
|
||||
ln -s ${finalAttrs.finalPackage.pkgs.compiler}/include $out/include
|
||||
'';
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
, lib
|
||||
, gcc
|
||||
, clangOmpss2Unwrapped
|
||||
, writeShellScript
|
||||
, openmp ? null
|
||||
, wrapCCWith
|
||||
, llvmPackages_latest
|
||||
@ -37,16 +38,16 @@ let
|
||||
inherit gcc;
|
||||
cc = clangOmpss2Unwrapped;
|
||||
gccVersion = with versions; let v = gcc.version; in concatStringsSep "." [(major v) (minor v) (patch v)];
|
||||
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
|
||||
echo "-L${gcc.cc}/lib/gcc/${targetConfig}/${gccVersion}" >> $out/nix-support/cc-ldflags
|
||||
echo "-L${gcc.cc.lib}/lib" >> $out/nix-support/cc-ldflags
|
||||
|
||||
for dir in ${gcc.cc}/lib/gcc/${targetConfig}/*/include; do
|
||||
echo "-isystem $dir" >> $out/nix-support/cc-cflags
|
||||
done
|
||||
for dir in ${gcc.cc}/include/c++/*; do
|
||||
echo "-isystem $dir" >> $out/nix-support/libcxx-cxxflags
|
||||
done
|
||||
@ -58,13 +59,52 @@ in wrapCCWith {
|
||||
|
||||
wrap clang++ $wrapper $ccPath/clang++
|
||||
|
||||
'' + 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
|
||||
sed -i 's|# Flirting.*|source ${resetIntelCCFlags}\n\n&|' $out/bin/clang
|
||||
sed -i 's|# Flirting.*|&\nsource ${resetIntelCCFlags}\n\n&|' $out/bin/clang++
|
||||
'';
|
||||
}
|
||||
|
||||
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.*|&\nsource ${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;
|
||||
};
|
||||
})
|
||||
|
||||
84
pkgs/onemath/default.nix
Normal file
84
pkgs/onemath/default.nix
Normal file
@ -0,0 +1,84 @@
|
||||
{ lib
|
||||
, fetchFromGitHub
|
||||
, cmake
|
||||
, withCFlags
|
||||
, intelPackages
|
||||
|
||||
, mklSupport ? true
|
||||
|
||||
, config
|
||||
|
||||
, cudaSupport ? config.cudaSupport
|
||||
, cudaPackages ? { }
|
||||
|
||||
, rocmSupport ? config.rocmSupport
|
||||
, hipTargets ? null # only one target at a time supported
|
||||
, rocmPackages ? { }
|
||||
}:
|
||||
|
||||
let
|
||||
# rocmSupport is not enough, we need a specific target
|
||||
enableHip = rocmSupport && hipTargets != null;
|
||||
|
||||
stdenv = withCFlags (lib.optionals cudaSupport [ "--cuda-path=${cudaPackages.cudatoolkit}" ]) intelPackages.stdenv;
|
||||
in
|
||||
|
||||
# at least one backend has to be enabled
|
||||
assert mklSupport || cudaSupport || enableHip;
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "oneMath";
|
||||
version = "0.8";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "uxlfoundation";
|
||||
repo = "oneMath";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-xK8lKI3oqKlx3xtvdScpMq+HXAuoYCP0BZdkEqnJP5o=";
|
||||
};
|
||||
|
||||
cmakeFlags = [
|
||||
(lib.cmakeBool "ENABLE_MKLCPU_BACKEND" mklSupport)
|
||||
(lib.cmakeBool "ENABLE_MKLGPU_BACKEND" mklSupport)
|
||||
|
||||
(lib.cmakeBool "ENABLE_CUBLAS_BACKEND" cudaSupport)
|
||||
(lib.cmakeBool "ENABLE_CUFFT_BACKEND" cudaSupport)
|
||||
(lib.cmakeBool "ENABLE_CURAND_BACKEND" cudaSupport)
|
||||
(lib.cmakeBool "ENABLE_CUSOLVER_BACKEND" cudaSupport)
|
||||
(lib.cmakeBool "ENABLE_CUSPARSE_BACKEND" cudaSupport)
|
||||
|
||||
(lib.cmakeBool "ENABLE_ROCBLAS_BACKEND" enableHip)
|
||||
(lib.cmakeBool "ENABLE_ROCFFT_BACKEND" enableHip)
|
||||
(lib.cmakeBool "ENABLE_ROCSOLVER_BACKEND" enableHip)
|
||||
(lib.cmakeBool "ENABLE_ROCRAND_BACKEND" enableHip)
|
||||
(lib.cmakeBool "ENABLE_ROCSPARSE_BACKEND" enableHip)
|
||||
|
||||
(lib.cmakeBool "BUILD_FUNCTIONAL_TESTS" false)
|
||||
(lib.cmakeBool "BUILD_EXAMPLES" false)
|
||||
] ++ lib.optionals enableHip [
|
||||
(lib.cmakeFeature "HIP_TARGETS" hipTargets)
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
buildInputs = lib.optionals (mklSupport) [
|
||||
intelPackages.mkl
|
||||
intelPackages.tbb
|
||||
] ++ lib.optionals (enableHip) [
|
||||
rocmPackages.rocmPath
|
||||
rocmPackages.rocblas
|
||||
rocmPackages.rocfft
|
||||
rocmPackages.rocsolver
|
||||
rocmPackages.rocrand
|
||||
rocmPackages.rocsparse
|
||||
] ++ lib.optionals (cudaSupport) [
|
||||
(lib.getDev cudaPackages.cuda_cudart)
|
||||
cudaPackages.cudatoolkit
|
||||
|
||||
cudaPackages.libcublas
|
||||
cudaPackages.libcurand
|
||||
cudaPackages.libcufft
|
||||
cudaPackages.libcusparse
|
||||
cudaPackages.libcusolver
|
||||
];
|
||||
|
||||
}
|
||||
@ -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;
|
||||
@ -54,9 +58,9 @@ intelPackages.stdenv.mkDerivation {
|
||||
echo NODES_HOME=$NODES_HOME
|
||||
command -v $CXX
|
||||
|
||||
icpx -fsycl \
|
||||
-fsycl-host-compiler=${clangOmpss2Nodes}/bin/clang++ \
|
||||
-fsycl-host-compiler-options='-fompss-2=libnodes' \
|
||||
icpx -Wno-deprecated-declarations -fsycl \
|
||||
-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 \
|
||||
hello.cpp -o hello
|
||||
|
||||
Reference in New Issue
Block a user