forked from rarias/bscpkgs
Compare commits
13 Commits
1320a2dd59
...
87c1903778
Author | SHA1 | Date | |
---|---|---|---|
87c1903778 | |||
1e7d43dacb | |||
38d2425dfe | |||
4377ad3e46 | |||
d974fbee05 | |||
812d71beb1 | |||
97d128338a | |||
6cb7e8dbe8 | |||
b2831347cc | |||
2d1f1ee5c7 | |||
9d1944c658 | |||
8e5b2dc5cc | |||
f89cd4d7e2 |
@ -26,7 +26,7 @@ let
|
||||
intelPackages = final.intelPackages_2025;
|
||||
oneMath = callPackage ./pkgs/onemath/default.nix { };
|
||||
jemallocNanos6 = callPackage ./pkgs/nanos6/jemalloc.nix { };
|
||||
#lmbench = callPackage ./pkgs/lmbench/default.nix { }; # Broken
|
||||
lmbench = callPackage ./pkgs/lmbench/default.nix { };
|
||||
mcxx = callPackage ./pkgs/mcxx/default.nix { };
|
||||
nanos6 = callPackage ./pkgs/nanos6/default.nix { };
|
||||
nanos6Debug = final.nanos6.override { enableDebug = true; };
|
||||
@ -68,6 +68,7 @@ in bscPkgs // {
|
||||
hello-c = callPackage ./test/compilers/hello-c.nix { };
|
||||
hello-cpp = callPackage ./test/compilers/hello-cpp.nix { };
|
||||
hello-sycl = callPackage ./test/compilers/hello-sycl.nix { };
|
||||
hello-syclompss = callPackage ./test/compilers/icpx-ompss2.nix { };
|
||||
lto = callPackage ./test/compilers/lto.nix { };
|
||||
asan = callPackage ./test/compilers/asan.nix { };
|
||||
intel2023-icx-c = hello-c.override { stdenv = final.intelPackages_2023.stdenv; };
|
||||
|
@ -46,24 +46,14 @@ let
|
||||
in (wrapCCWith {
|
||||
inherit cc;
|
||||
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}/lib" >> $out/nix-support/cc-ldflags
|
||||
echo "-L${cc}/lib" >> $out/nix-support/cc-ldflags
|
||||
|
||||
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
|
||||
echo "--gcc-toolchain=${gcc.cc}" >> $out/nix-support/libcxx-cxxflags
|
||||
|
||||
for dir in ${gcc.cc}/include/c++/*; do
|
||||
echo "-isystem $dir" >> $out/nix-support/libcxx-cxxflags
|
||||
@ -78,6 +68,12 @@ let
|
||||
# Disable hardening by default
|
||||
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;
|
||||
} // (removeAttrs args ["cc" "extraBuildCommands" "extraInstall"])
|
||||
).overrideAttrs (old: {
|
||||
@ -151,10 +147,6 @@ 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
|
||||
|
||||
ln -s ${finalAttrs.finalPackage.pkgs.compiler}/lib $out/lib
|
||||
|
@ -3,19 +3,20 @@
|
||||
, lib
|
||||
, gcc
|
||||
, clangOmpss2Unwrapped
|
||||
, writeShellScript
|
||||
, openmp ? null
|
||||
, wrapCCWith
|
||||
, llvmPackages_latest
|
||||
, ompss2rt ? null
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
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";
|
||||
assert assertMsg (usingNodesAndOmpv -> sameNosv) "OpenMP-V and NODES must share the same nOS-V";
|
||||
|
||||
let
|
||||
homevar = if ompss2rt.pname == "nanos6" then "NANOS6_HOME" else "NODES_HOME";
|
||||
@ -35,35 +36,17 @@ let
|
||||
targetConfig = stdenv.targetPlatform.config;
|
||||
inherit gcc;
|
||||
cc = clangOmpss2Unwrapped;
|
||||
|
||||
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
|
||||
'';
|
||||
|
||||
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 = lib.optional (openmp != null) openmp;
|
||||
extraPackages = optional (openmp != null) openmp;
|
||||
extraBuildCommands = ''
|
||||
echo "-target ${targetConfig}" >> $out/nix-support/cc-cflags
|
||||
echo "-B${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}" >> $out/nix-support/cc-cflags
|
||||
echo "-L${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}" >> $out/nix-support/cc-ldflags
|
||||
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
|
||||
@ -75,17 +58,12 @@ in wrapCCWith {
|
||||
|
||||
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) ''
|
||||
'' + optionalString (openmp != null) ''
|
||||
echo "export OPENMP_RUNTIME=${ompname}" >> $out/nix-support/cc-wrapper-hook
|
||||
'' + lib.optionalString (ompss2rt != null) ''
|
||||
'' + optionalString (ompss2rt != null) ''
|
||||
echo "export OMPSS2_RUNTIME=${rtname}" >> $out/nix-support/cc-wrapper-hook
|
||||
echo "export ${homevar}=${ompss2rt}" >> $out/nix-support/cc-wrapper-hook
|
||||
'' + lib.optionalString (ompss2rt != null && ompss2rt.pname == "nodes") ''
|
||||
'' + optionalString (ompss2rt != null && ompss2rt.pname == "nodes") ''
|
||||
echo "export NOSV_HOME=${ompss2rt.nosv}" >> $out/nix-support/cc-wrapper-hook
|
||||
'';
|
||||
}
|
||||
|
@ -68,6 +68,7 @@ stdenv.mkDerivation rec {
|
||||
rm -f $out/lib/libiomp*
|
||||
'' + lib.optionalString enableNosv ''
|
||||
rm -f $out/lib/libomp.*
|
||||
rm -f $out/libllvmrt/libomp.*
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
|
@ -1,19 +1,20 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
libtirpc,
|
||||
fetchFromGitHub
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "lmbench";
|
||||
version = "701c6c35";
|
||||
version = "941a0dcc";
|
||||
|
||||
# We use the intel repo as they have fixed some problems
|
||||
src = fetchFromGitHub {
|
||||
owner = "intel";
|
||||
repo = pname;
|
||||
rev = "701c6c35b0270d4634fb1dc5272721340322b8ed";
|
||||
sha256 = "0sf6zk03knkardsfd6qx7drpm56nhg53n885cylkggk83r38idyr";
|
||||
rev = "941a0dcc0e7bdd9bb0dee05d7f620e77da8c43af";
|
||||
sha256 = "sha256-SzwplRBO3V0R3m3p15n71ivYBMGoLsajFK2TapYxdqk=";
|
||||
};
|
||||
|
||||
postUnpack = ''
|
||||
@ -24,12 +25,19 @@ stdenv.mkDerivation rec {
|
||||
sed -i "s@/bin/rm@rm@g" $(find . -name Makefile)
|
||||
'';
|
||||
|
||||
buildInputs = [ libtirpc ];
|
||||
patches = [ ./fix-install.patch ];
|
||||
|
||||
hardeningDisable = [ "all" ];
|
||||
|
||||
enableParallelBuilding = false;
|
||||
|
||||
preBuild = ''
|
||||
makeFlagsArray+=(BASE=$out)
|
||||
makeFlagsArray+=(
|
||||
BASE=$out
|
||||
CPPFLAGS=-I${libtirpc.dev}/include/tirpc
|
||||
LDFLAGS=-ltirpc
|
||||
)
|
||||
'';
|
||||
|
||||
meta = {
|
||||
|
10
pkgs/lmbench/fix-install.patch
Normal file
10
pkgs/lmbench/fix-install.patch
Normal file
@ -0,0 +1,10 @@
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -144,6 +144,7 @@ install-target:
|
||||
if [ ! -d $(BASE)/include ]; then mkdir $(BASE)/include; fi
|
||||
if [ ! -d $(BASE)/lib ]; then mkdir $(BASE)/lib; fi
|
||||
cp $(EXES) $(BASE)/bin
|
||||
+ cp $(OPT_EXES) $(BASE)/bin
|
||||
cp $(INCS) $(BASE)/include
|
||||
cp $O/lmbench.a $(BASE)/lib/libmbench.a
|
||||
cd ../doc; env MAKEFLAGS="$(MAKEFLAGS)" make CC="${CC}" OS="${OS}" BASE="$(BASE)" install
|
71
test/compilers/icpx-ompss2.nix
Normal file
71
test/compilers/icpx-ompss2.nix
Normal file
@ -0,0 +1,71 @@
|
||||
{ writeText, intelPackages, nodes, nosv, clangOmpss2Nodes, clangOmpss2Unwrapped, clangOmpss2, strace }:
|
||||
|
||||
let
|
||||
hello_cpp = writeText "hello.cpp" ''
|
||||
#include <cstdio>
|
||||
#include <sycl/sycl.hpp>
|
||||
|
||||
int main(int argc, char** argv) try {
|
||||
sycl::queue queue;
|
||||
|
||||
std::cout << "Running on: "
|
||||
<< queue.get_device().get_info<sycl::info::device::name>()
|
||||
<< std::endl;
|
||||
|
||||
#pragma oss task
|
||||
queue.submit([&] (sycl::handler& cgh) {
|
||||
auto os = sycl::stream{128, 128, cgh};
|
||||
cgh.single_task<class hello_world>([=]() {
|
||||
os << "Hello World! (on device)\n";
|
||||
});
|
||||
}).wait();
|
||||
|
||||
return 0;
|
||||
} catch (sycl::exception &e) {
|
||||
std::cout << "SYCL exception: " << e.what() << std::endl;
|
||||
return 0; // we expect to fail since no devices should be available;
|
||||
}
|
||||
|
||||
'';
|
||||
in
|
||||
|
||||
intelPackages.stdenv.mkDerivation {
|
||||
version = "0.0.1";
|
||||
name = "hello-syclompss";
|
||||
|
||||
src = hello_cpp;
|
||||
|
||||
nativeBuildInputs = [
|
||||
strace
|
||||
nodes
|
||||
nosv
|
||||
];
|
||||
|
||||
dontUnpack = true;
|
||||
dontConfigure = true;
|
||||
|
||||
env.NODES_HOME = nodes;
|
||||
|
||||
NIX_DEBUG = 0;
|
||||
buildPhase = ''
|
||||
cp $src hello.cpp
|
||||
set -x
|
||||
echo CXX=$CXX
|
||||
echo NODES_HOME=$NODES_HOME
|
||||
command -v $CXX
|
||||
|
||||
icpx -fsycl \
|
||||
-fsycl-host-compiler=${clangOmpss2Nodes}/bin/clang++ \
|
||||
-fsycl-host-compiler-options='-fompss-2=libnodes' \
|
||||
-lnodes -lnosv \
|
||||
$NODES_HOME/lib/nodes-main-wrapper.o \
|
||||
hello.cpp -o hello
|
||||
|
||||
./hello
|
||||
set +x
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
touch $out
|
||||
'';
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user