forked from rarias/bscpkgs
Compare commits
10 Commits
cd61d6691f
...
pkgs/tasyc
| Author | SHA1 | Date | |
|---|---|---|---|
|
9aa866ee76
|
|||
|
3f6950c1f0
|
|||
|
53f556626e
|
|||
|
f3483e8a88
|
|||
|
2d637cc88c
|
|||
|
8836ca4359
|
|||
|
8ffb971348
|
|||
|
bdbfd77446
|
|||
|
83ae2f489d
|
|||
|
39157ea318
|
@@ -46,14 +46,24 @@ let
|
|||||||
in (wrapCCWith {
|
in (wrapCCWith {
|
||||||
inherit cc;
|
inherit cc;
|
||||||
extraBuildCommands = ''
|
extraBuildCommands = ''
|
||||||
echo "-isystem ${cc}/include" >> $out/nix-support/cc-cflags
|
|
||||||
echo "-isystem ${cc}/include/intel64" >> $out/nix-support/cc-cflags
|
|
||||||
|
|
||||||
echo "-L${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}" >> $out/nix-support/cc-ldflags
|
echo "-L${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}" >> $out/nix-support/cc-ldflags
|
||||||
echo "-L${gcc.cc.lib}/lib" >> $out/nix-support/cc-ldflags
|
echo "-L${gcc.cc.lib}/lib" >> $out/nix-support/cc-ldflags
|
||||||
echo "-L${cc}/lib" >> $out/nix-support/cc-ldflags
|
echo "-L${cc}/lib" >> $out/nix-support/cc-ldflags
|
||||||
|
|
||||||
echo "--gcc-toolchain=${gcc.cc}" >> $out/nix-support/libcxx-cxxflags
|
echo "--gcc-toolchain=${gcc.cc}" >> $out/nix-support/cc-cflags
|
||||||
|
|
||||||
|
# For some reason, If we don't resolve the realpath things go wrong
|
||||||
|
for stddef in ${cc}/lib/clang/*/include/stddef.h ; do
|
||||||
|
dir=$(dirname $(realpath "$stddef"))
|
||||||
|
echo "-isystem $dir" >> $out/nix-support/cc-cflags
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "-isystem ${cc}/include" >> $out/nix-support/cc-cflags
|
||||||
|
echo "-isystem ${cc}/include/intel64" >> $out/nix-support/cc-cflags
|
||||||
|
|
||||||
|
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
|
for dir in ${gcc.cc}/include/c++/*; do
|
||||||
echo "-isystem $dir" >> $out/nix-support/libcxx-cxxflags
|
echo "-isystem $dir" >> $out/nix-support/libcxx-cxxflags
|
||||||
@@ -68,12 +78,6 @@ let
|
|||||||
# Disable hardening by default
|
# Disable hardening by default
|
||||||
echo "" > $out/nix-support/add-hardening.sh
|
echo "" > $out/nix-support/add-hardening.sh
|
||||||
|
|
||||||
# For some reason, If we don't resolve the realpath things go wrong
|
|
||||||
for stddef in ${cc}/lib/clang/*/include/stddef.h ; do
|
|
||||||
dir=$(dirname $(realpath "$stddef"))
|
|
||||||
echo "-isystem $dir" >> $out/nix-support/cc-cflags
|
|
||||||
done
|
|
||||||
|
|
||||||
'' + extraBuildCommands;
|
'' + extraBuildCommands;
|
||||||
} // (removeAttrs args ["cc" "extraBuildCommands" "extraInstall"])
|
} // (removeAttrs args ["cc" "extraBuildCommands" "extraInstall"])
|
||||||
).overrideAttrs (old: {
|
).overrideAttrs (old: {
|
||||||
@@ -153,7 +157,6 @@ stdenvNoCC.mkDerivation (finalAttrs: {
|
|||||||
|
|
||||||
sed -i 's/.*isCxx=0/isCxx=1/' $out/bin/icpx
|
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}/lib $out/lib
|
||||||
ln -s ${finalAttrs.finalPackage.pkgs.compiler}/include $out/include
|
ln -s ${finalAttrs.finalPackage.pkgs.compiler}/include $out/include
|
||||||
'';
|
'';
|
||||||
|
|||||||
@@ -39,6 +39,25 @@ let
|
|||||||
cc = clangOmpss2Unwrapped;
|
cc = clangOmpss2Unwrapped;
|
||||||
gccVersion = with versions; let v = gcc.version; in concatStringsSep "." [(major v) (minor v) (patch v)];
|
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" = 1 ]; then
|
||||||
|
unset NIX_CFLAGS_COMPILE_${tconf}
|
||||||
|
unset NIX_CFLAGS_COMPILE_BEFORE_${tconf}
|
||||||
|
unset NIX_CFLAGS_LINK_${tconf}
|
||||||
|
unset NIX_CXXSTDLIB_COMPILE_${tconf}
|
||||||
|
unset NIX_CXXSTDLIB_LINK_${tconf}
|
||||||
|
unset NIX_GNATFLAGS_COMPILE_${tconf}
|
||||||
|
|
||||||
|
unset NIX_CC_WRAPPER_FLAGS_SET_${tconf}
|
||||||
|
# unset NIX_BINTOOLS_WRAPPER_FLAGS_${tconf}
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
|
||||||
|
in wrapCCWith {
|
||||||
|
inherit cc bintools;
|
||||||
|
# extraPackages adds packages to depsTargetTargetPropagated
|
||||||
|
extraPackages = 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}/${gccVersion}" >> $out/nix-support/cc-cflags
|
echo "-B${gcc.cc}/lib/gcc/${targetConfig}/${gccVersion}" >> $out/nix-support/cc-cflags
|
||||||
@@ -58,50 +77,19 @@ let
|
|||||||
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++
|
||||||
|
|
||||||
|
sed -i 's|# Flirting.*|&\nsource ${resetIntelCCFlags}|' $out/bin/clang
|
||||||
|
sed -i 's|# Flirting.*|&\nsource ${resetIntelCCFlags}|' $out/bin/clang++
|
||||||
|
|
||||||
|
echo "" > $out/nix-support/add-hardening.sh
|
||||||
|
|
||||||
|
'' + 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;
|
|
||||||
};
|
|
||||||
})
|
|
||||||
|
|||||||
@@ -1,51 +1,40 @@
|
|||||||
{ lib
|
{ lib
|
||||||
|
, intelPackages
|
||||||
|
, withCFlags
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, cmake
|
, cmake
|
||||||
, withCFlags
|
, cudaPackages
|
||||||
, intelPackages
|
, enableNvidia ? true
|
||||||
|
, withHipTargets ? null # only one target at a time supported
|
||||||
, mklSupport ? true
|
, rocmPackages
|
||||||
|
, enableMkl ? true
|
||||||
, config
|
|
||||||
|
|
||||||
, cudaSupport ? config.cudaSupport
|
|
||||||
, cudaPackages ? { }
|
|
||||||
|
|
||||||
, rocmSupport ? config.rocmSupport
|
|
||||||
, hipTargets ? null # only one target at a time supported
|
|
||||||
, rocmPackages ? { }
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
# rocmSupport is not enough, we need a specific target
|
enableHip = withHipTargets != null;
|
||||||
enableHip = rocmSupport && hipTargets != null;
|
|
||||||
|
|
||||||
stdenv = withCFlags (lib.optionals cudaSupport [ "--cuda-path=${cudaPackages.cudatoolkit}" ]) intelPackages.stdenv;
|
stdenv = withCFlags (lib.optionals enableNvidia [ "--cuda-path=${cudaPackages.cudatoolkit}" ]) intelPackages.stdenv;
|
||||||
in
|
in
|
||||||
|
|
||||||
# at least one backend has to be enabled
|
|
||||||
assert mklSupport || cudaSupport || enableHip;
|
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "oneMath";
|
pname = "oneMath";
|
||||||
version = "0.8";
|
version = "0.7";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "uxlfoundation";
|
owner = "uxlfoundation";
|
||||||
repo = "oneMath";
|
repo = "oneMath";
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
sha256 = "sha256-xK8lKI3oqKlx3xtvdScpMq+HXAuoYCP0BZdkEqnJP5o=";
|
sha256 = "sha256-De04PUmI68Jx4rJ+MRb+RepayZCapgnouCUCrAu6G38=";
|
||||||
};
|
};
|
||||||
|
|
||||||
cmakeFlags = [
|
cmakeFlags = [
|
||||||
(lib.cmakeBool "ENABLE_MKLCPU_BACKEND" mklSupport)
|
(lib.cmakeBool "ENABLE_MKLCPU_BACKEND" enableMkl)
|
||||||
(lib.cmakeBool "ENABLE_MKLGPU_BACKEND" mklSupport)
|
(lib.cmakeBool "ENABLE_MKLGPU_BACKEND" enableMkl)
|
||||||
|
|
||||||
(lib.cmakeBool "ENABLE_CUBLAS_BACKEND" cudaSupport)
|
(lib.cmakeBool "ENABLE_CUBLAS_BACKEND" enableNvidia)
|
||||||
(lib.cmakeBool "ENABLE_CUFFT_BACKEND" cudaSupport)
|
(lib.cmakeBool "ENABLE_CUFFT_BACKEND" enableNvidia)
|
||||||
(lib.cmakeBool "ENABLE_CURAND_BACKEND" cudaSupport)
|
(lib.cmakeBool "ENABLE_CURAND_BACKEND" enableNvidia)
|
||||||
(lib.cmakeBool "ENABLE_CUSOLVER_BACKEND" cudaSupport)
|
(lib.cmakeBool "ENABLE_CUSOLVER_BACKEND" enableNvidia)
|
||||||
(lib.cmakeBool "ENABLE_CUSPARSE_BACKEND" cudaSupport)
|
(lib.cmakeBool "ENABLE_CUSPARSE_BACKEND" enableNvidia)
|
||||||
|
|
||||||
(lib.cmakeBool "ENABLE_ROCBLAS_BACKEND" enableHip)
|
(lib.cmakeBool "ENABLE_ROCBLAS_BACKEND" enableHip)
|
||||||
(lib.cmakeBool "ENABLE_ROCFFT_BACKEND" enableHip)
|
(lib.cmakeBool "ENABLE_ROCFFT_BACKEND" enableHip)
|
||||||
@@ -56,11 +45,11 @@ stdenv.mkDerivation rec {
|
|||||||
(lib.cmakeBool "BUILD_FUNCTIONAL_TESTS" false)
|
(lib.cmakeBool "BUILD_FUNCTIONAL_TESTS" false)
|
||||||
(lib.cmakeBool "BUILD_EXAMPLES" false)
|
(lib.cmakeBool "BUILD_EXAMPLES" false)
|
||||||
] ++ lib.optionals enableHip [
|
] ++ lib.optionals enableHip [
|
||||||
(lib.cmakeFeature "HIP_TARGETS" hipTargets)
|
(lib.cmakeFeature "HIP_TARGETS" withHipTargets)
|
||||||
];
|
];
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake ];
|
nativeBuildInputs = [ cmake ];
|
||||||
buildInputs = lib.optionals (mklSupport) [
|
buildInputs = lib.optionals (enableMkl) [
|
||||||
intelPackages.mkl
|
intelPackages.mkl
|
||||||
intelPackages.tbb
|
intelPackages.tbb
|
||||||
] ++ lib.optionals (enableHip) [
|
] ++ lib.optionals (enableHip) [
|
||||||
@@ -70,7 +59,7 @@ stdenv.mkDerivation rec {
|
|||||||
rocmPackages.rocsolver
|
rocmPackages.rocsolver
|
||||||
rocmPackages.rocrand
|
rocmPackages.rocrand
|
||||||
rocmPackages.rocsparse
|
rocmPackages.rocsparse
|
||||||
] ++ lib.optionals (cudaSupport) [
|
] ++ lib.optionals (enableNvidia) [
|
||||||
(lib.getDev cudaPackages.cuda_cudart)
|
(lib.getDev cudaPackages.cuda_cudart)
|
||||||
cudaPackages.cudatoolkit
|
cudaPackages.cudatoolkit
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{ writeText, intelPackages, nodes, nosv, clangOmpss2Nodes, strace }:
|
{ writeText, intelPackages, nodes, nosv, clangOmpss2Nodes, clangOmpss2Unwrapped, clangOmpss2, strace }:
|
||||||
|
|
||||||
let
|
let
|
||||||
hello_cpp = writeText "hello.cpp" ''
|
hello_cpp = writeText "hello.cpp" ''
|
||||||
@@ -44,10 +44,6 @@ intelPackages.stdenv.mkDerivation {
|
|||||||
dontUnpack = true;
|
dontUnpack = true;
|
||||||
dontConfigure = 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;
|
env.NODES_HOME = nodes;
|
||||||
|
|
||||||
NIX_DEBUG = 0;
|
NIX_DEBUG = 0;
|
||||||
@@ -58,9 +54,9 @@ intelPackages.stdenv.mkDerivation {
|
|||||||
echo NODES_HOME=$NODES_HOME
|
echo NODES_HOME=$NODES_HOME
|
||||||
command -v $CXX
|
command -v $CXX
|
||||||
|
|
||||||
icpx -Wno-deprecated-declarations -fsycl \
|
icpx -fsycl \
|
||||||
-fsycl-host-compiler=${clangOmpss2Nodes.forIcpx}/bin/clang++ \
|
-fsycl-host-compiler=${clangOmpss2Nodes}/bin/clang++ \
|
||||||
-fsycl-host-compiler-options='-Wno-deprecated-declarations -fompss-2=libnodes' \
|
-fsycl-host-compiler-options='-fompss-2=libnodes' \
|
||||||
-lnodes -lnosv \
|
-lnodes -lnosv \
|
||||||
$NODES_HOME/lib/nodes-main-wrapper.o \
|
$NODES_HOME/lib/nodes-main-wrapper.o \
|
||||||
hello.cpp -o hello
|
hello.cpp -o hello
|
||||||
|
|||||||
Reference in New Issue
Block a user