Add test for icpx with ompss-2 as host compiler

This commit is contained in:
Aleix Boné 2025-06-06 11:02:55 +02:00
parent f15055ccdb
commit 25543ac0a1
No known key found for this signature in database
2 changed files with 75 additions and 0 deletions

View File

@ -71,6 +71,7 @@ let
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; };

View File

@ -0,0 +1,74 @@
{ 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;
# NODES requires access to /sys/devices to request NUMA information
requiredSystemFeatures = [ "sys-devices" ];
env.NODES_HOME = nodes;
NIX_DEBUG = 1;
buildPhase = ''
cp $src hello.cpp
set -x
echo CXX=$CXX
echo NODES_HOME=$NODES_HOME
command -v $CXX
icpx -Wno-deprecated-declarations -fsycl \
-fsycl-host-compiler=${clangOmpss2Nodes}/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
./hello
set +x
'';
installPhase = ''
touch $out
'';
}