bscpkgs/test/compilers/ompss2.nix

50 lines
968 B
Nix
Raw Normal View History

2023-03-13 16:16:34 +01:00
{ stdenv, writeText, which, strace, gdb }:
2023-03-13 14:54:40 +01:00
let
task_c = writeText "task.c" ''
#include <stdio.h>
int main()
{
for (int i = 0; i < 10; i++) {
#pragma oss task
printf("Hello world!\n");
}
return 0;
}
'';
in
stdenv.mkDerivation rec {
version = "0.0.1";
name = "task_c";
src = task_c;
dontUnpack = true;
dontConfigure = true;
hardeningDisable = [ "all" ];
NIX_DEBUG = 1;
2023-03-13 16:16:34 +01:00
buildInputs = [ strace gdb ];
# 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;
2023-03-13 14:54:40 +01:00
buildPhase = ''
set -x
echo CC=$CC
$CC -v
cp ${task_c} task.c
cat task.c
$CC -v -fompss-2 task.c -o task
2023-03-13 16:16:34 +01:00
#strace -ff -e trace=open,openat -s9999999 ./task
LD_DEBUG=libs ./task
#gdb -batch -ex "run" -ex "bt" ./task
2023-03-13 14:54:40 +01:00
set +x
'';
installPhase = ''
touch $out
'';
}