bscpkgs/test/compilers/clang-openmp.nix
Raúl Peñacoba 8ceaddfea7 Split OpenMP from Clang in LLVM
As the OpenMP-V implementation requires to be built with nOS-V, we can
split the OpenMP package in a different derivation to prevent rebuilds
of clang. Additionally, as OpenMP-V now can be build alongside the
vanilla OpenMP runtime, we simply build a single openmp derivation with
both runtimes. Only a single build of the clang compiler is now
required.

Reviewed-by: Aleix Roca Nonell <aleix.rocanonell@bsc.es>
Reviewed-by: Rodrigo Arias Mallo <rodrigo.arias@bsc.es>
2023-12-01 16:31:56 +01:00

50 lines
731 B
Nix

{
stdenv
, writeText
, openmp
}:
let
hello_c = writeText "hello.c" ''
int main(int argc, char *argv[])
{
int test = 1;
#pragma omp parallel
#pragma omp single
#pragma omp task
test = 0;
return test;
}
'';
in stdenv.mkDerivation {
pname = "openmp-test";
version = "1.0.0";
dontUnpack = true;
dontConfigure = true;
# nOS-V 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;
buildInputs = [ openmp ];
buildPhase = ''
set -x
cp ${hello_c} hello.c
clang -fopenmp ./hello.c -o hello
./hello
set +x
'';
installPhase = ''
touch $out
'';
}