bscpkgs/test/compilers/ompss2.nix

53 lines
1.0 KiB
Nix
Raw Permalink 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" ];
2023-05-22 13:55:23 +02:00
#NIX_DEBUG = 1;
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
2023-05-22 13:55:23 +02:00
#$CC -v
2023-03-13 14:54:40 +01:00
cp ${task_c} task.c
2023-05-22 13:55:23 +02:00
echo CC=$CC
echo NANOS6_HOME=$NANOS6_HOME
echo NODES_HOME=$NODES_HOME
2023-03-13 14:54:40 +01:00
cat task.c
2023-05-22 13:55:23 +02:00
$CC -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
'';
}