1 // RUN: %libomptarget-compile-generic -fopenmp-offload-mandatory -O3
2 // RUN: %libomptarget-run-generic
3 // RUN: %libomptarget-compileopt-generic -fopenmp-offload-mandatory -O3
4 // RUN: %libomptarget-run-generic
12 void __kmpc_barrier_simple_spmd(struct IdentTy
*Loc
, int32_t TId
);
13 void __kmpc_barrier_simple_generic(struct IdentTy
*Loc
, int32_t TId
);
15 #pragma omp begin declare target device_type(nohost)
16 static int A
[512] __attribute__((address_space(3), loader_uninitialized
));
17 static int B
[512 * 32] __attribute__((loader_uninitialized
));
18 #pragma omp end declare target
21 printf("Testing simple spmd barrier\n");
22 for (int r
= 0; r
< 50; r
++) {
23 #pragma omp target teams distribute thread_limit(512) num_teams(440)
24 for (int j
= 0; j
< 512 * 32; ++j
) {
25 #pragma omp parallel firstprivate(j)
27 int TId
= omp_get_thread_num();
28 int TeamId
= omp_get_team_num();
29 int NT
= omp_get_num_threads();
31 for (int i
= 0; i
< NT
; ++i
) {
32 // Test shared memory globals
35 __kmpc_barrier_simple_spmd(0, TId
);
38 __kmpc_barrier_simple_spmd(0, TId
);
39 // Test generic globals
42 __kmpc_barrier_simple_spmd(0, TId
);
45 __kmpc_barrier_simple_spmd(0, TId
);
51 printf("Testing simple generic barrier\n");
52 for (int r
= 0; r
< 50; r
++) {
53 #pragma omp target teams distribute thread_limit(512) num_teams(440)
54 for (int j
= 0; j
< 512 * 32; ++j
) {
55 #pragma omp parallel firstprivate(j)
57 int TId
= omp_get_thread_num();
58 int TeamId
= omp_get_team_num();
59 int NT
= omp_get_num_threads();
61 for (int i
= 0; i
< NT
; ++i
) {
64 __kmpc_barrier_simple_generic(0, TId
);
67 __kmpc_barrier_simple_generic(0, TId
);
70 __kmpc_barrier_simple_generic(0, TId
);
73 __kmpc_barrier_simple_generic(0, TId
);