diff --git a/openmp/runtime/test/tasking/omp_task_priority.c b/openmp/runtime/test/tasking/omp_task_priority.c new file mode 100644 index 000000000000..68394891a749 --- /dev/null +++ b/openmp/runtime/test/tasking/omp_task_priority.c @@ -0,0 +1,22 @@ +// RUN: %libomp-compile && env OMP_MAX_TASK_PRIORITY=42 %libomp-run +// Test OMP 4.5 task priorities +// Currently only API function and envirable parsing implemented. +// Test environment sets envirable: OMP_MAX_TASK_PRIORITY=42 as tested below. +#include +#include + +int main (void) { + int passed; + + passed = (omp_get_max_task_priority() == 42); + printf("Got %d\n", omp_get_max_task_priority()); + + if (passed) { + printf("passed\n"); + return 0; + } + + printf("failed\n"); + return 1; +} + diff --git a/openmp/runtime/test/worksharing/for/kmp_doacross_check.c b/openmp/runtime/test/worksharing/for/kmp_doacross_check.c new file mode 100644 index 000000000000..c0ee2019c0ab --- /dev/null +++ b/openmp/runtime/test/worksharing/for/kmp_doacross_check.c @@ -0,0 +1,56 @@ +// RUN: %libomp-compile-and-run +#include + +#define N 1000 + +struct dim { + long long lo; // lower + long long up; // upper + long long st; // stride +}; +extern void __kmpc_doacross_init(void*, int, int, struct dim *); +extern void __kmpc_doacross_wait(void*, int, long long*); +extern void __kmpc_doacross_post(void*, int, long long*); +extern void __kmpc_doacross_fini(void*, int); +extern int __kmpc_global_thread_num(void*); + +int main() +{ + int i; + int iter[N]; + struct dim dims; + for( i = 0; i < N; ++i ) + iter[i] = 1; + dims.lo = 1; + dims.up = N-1; + dims.st = 1; + #pragma omp parallel + { + int i, gtid; + long long vec; + gtid = __kmpc_global_thread_num(NULL); + __kmpc_doacross_init(NULL,gtid,1,&dims); // thread starts the loop + #pragma omp for nowait schedule(dynamic) + for( i = 1; i < N; ++i ) + { + // runtime call corresponding to #pragma omp ordered depend(sink:i-1) + vec=i-1; + __kmpc_doacross_wait(NULL,gtid,&vec); + // user's code + iter[i] = iter[i-1] + 1; + // runtime call corresponding to #pragma omp ordered depend(source) + vec=i; + __kmpc_doacross_post(NULL,gtid,&vec); + } + // thread finishes the loop (should be before the loop barrier) + __kmpc_doacross_fini(NULL,gtid); + } + if( iter[N-1] == N ) { + printf("passed\n"); + } else { + printf("failed %d != %d\n", iter[N-1], N); + return 1; + } + return 0; +} +