Set num_threads to 50 on 32-bit hppa in two libgomp loop tests
[official-gcc.git] / libgomp / testsuite / libgomp.c-c++-common / target-is-accessible-1.c
blob2e75c6300ae622ae495106d39be886a08e37ad26
1 #include <omp.h>
3 int
4 main ()
6 int d = omp_get_default_device ();
7 int id = omp_get_initial_device ();
8 int n = omp_get_num_devices ();
9 void *p;
11 if (d < 0 || d >= n)
12 d = id;
14 if (!omp_target_is_accessible (p, sizeof (int), n))
15 __builtin_abort ();
17 if (!omp_target_is_accessible (p, sizeof (int), id))
18 __builtin_abort ();
20 if (!omp_target_is_accessible (p, sizeof (int), omp_initial_device))
21 __builtin_abort ();
23 if (omp_target_is_accessible (p, sizeof (int), -5))
24 __builtin_abort ();
26 if (omp_target_is_accessible (p, sizeof (int), n + 1))
27 __builtin_abort ();
29 /* Currently, a host pointer is accessible if the device supports shared
30 memory or omp_target_is_accessible is executed on the host. This
31 test case must be adapted when unified shared memory is avialable. */
32 int a[128];
33 for (int d = 0; d <= omp_get_num_devices (); d++)
35 int shared_mem = 0;
36 #pragma omp target map (alloc: shared_mem) device (d)
37 shared_mem = 1;
38 if (omp_target_is_accessible (p, sizeof (int), d) != shared_mem)
39 __builtin_abort ();
41 if (omp_target_is_accessible (a, 128 * sizeof (int), d) != shared_mem)
42 __builtin_abort ();
44 for (int i = 0; i < 128; i++)
45 if (omp_target_is_accessible (&a[i], sizeof (int), d) != shared_mem)
46 __builtin_abort ();
49 return 0;