1 // RUN: %libomptarget-compile-generic && %libomptarget-run-generic
2 // RUN: %libomptarget-compileopt-generic && %libomptarget-run-generic
13 // Allocate ~55MB on the device.
14 #pragma omp target map(from : DP)
15 DP
= (long unsigned *)malloc(sizeof(long unsigned) * N
* Threads
* Teams
);
17 #pragma omp target teams distribute parallel for num_teams(Teams) \
18 thread_limit(Threads) is_device_ptr(DP)
19 for (int i
= 0; i
< Threads
* Teams
; ++i
) {
20 for (int j
= 0; j
< N
; ++j
) {
21 DP
[i
* N
+ j
] = i
+ j
;
26 #pragma omp target teams distribute parallel for num_teams(Teams) \
27 thread_limit(Threads) reduction(+ : s)
28 for (int i
= 0; i
< Threads
* Teams
; ++i
) {
29 for (int j
= 0; j
< N
; ++j
) {
34 // CHECK: Sum: 6860800
35 printf("Sum: %li\n", s
);