Set num_threads to 50 on 32-bit hppa in two libgomp loop tests
[official-gcc.git] / libgomp / testsuite / libgomp.c-c++-common / target-present-3.c
blob582247dc05e15e43863a684670866e37c63b064c
1 #include <stdio.h>
3 #define N 100
5 int main (void)
7 int a[N], b[N], c[N];
9 for (int i = 0; i < N; i++) {
10 a[i] = i * 2;
11 b[i] = i * 3 + 1;
14 #pragma omp target enter data map (alloc: a, c)
16 /* This should work as a has already been allocated. */
17 #pragma omp target update to (present: a)
19 #pragma omp target map(present,alloc: a, c)
20 for (int i = 0; i < N; i++) {
21 if (a[i] != i * 2)
22 __builtin_abort ();
23 c[i] = 23*i;
26 #pragma omp target update from(present : c)
27 for (int i = 0; i < N; i++) {
28 if (c[i] != 23*i)
29 __builtin_abort ();
32 fprintf (stderr, "CheCKpOInT\n");
33 /* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */
35 /* This should fail as b has not been allocated. */
36 /* { dg-output "libgomp: present clause: not present on the device \\(addr: 0x\[0-9a-f\]+, size: \[0-9\]+ \\(0x\[0-9a-f\]+\\), dev: \[0-9\]+\\\)" { target offload_device_nonshared_as } } */
37 /* { dg-shouldfail "present error triggered" { offload_device_nonshared_as } } */
38 #pragma omp target update to (present: b)
40 #pragma omp target exit data map (from: c)