bscpkgs/test/compilers/ompss2.nix

53 lines
1.0 KiB
Nix
Raw Normal View History

2023-03-13 23:16:34 +08:00
{ stdenv, writeText, which, strace, gdb }:
2023-03-13 21:54:40 +08: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 19:55:23 +08: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 21:54:40 +08:00
buildPhase = ''
set -x
2023-05-22 19:55:23 +08:00
#$CC -v
2023-03-13 21:54:40 +08:00
cp ${task_c} task.c
2023-05-22 19:55:23 +08:00
echo CC=$CC
echo NANOS6_HOME=$NANOS6_HOME
echo NODES_HOME=$NODES_HOME
2023-03-13 21:54:40 +08:00
cat task.c
2023-05-22 19:55:23 +08:00
$CC -fompss-2 task.c -o task
2023-03-13 23:16:34 +08:00
#strace -ff -e trace=open,openat -s9999999 ./task
LD_DEBUG=libs ./task
#gdb -batch -ex "run" -ex "bt" ./task
2023-03-13 21:54:40 +08:00
set +x
'';
installPhase = ''
touch $out
'';
}