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 6cb7e8dbe8
commit 97d128338a
Signed by: abonerib
SSH Key Fingerprint: SHA256:Jmq7aNH8XDdGy7E9dqfqrc/LRaVqhnFgDgdxlFw/pl8
2 changed files with 72 additions and 0 deletions

View File

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

View 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
'';
}