LLVM OpenMP
omp61_dyn_gprivate_routines.f90
Go to the documentation of this file.
1! RUN: %flang %flags %openmp_flags %s -o %t.exe
2! RUN: %t.exe | FileCheck %s
3
4! REQUIRES: linux
5
6! Test the Fortran interfaces of the OpenMP dynamic-groupprivate-information
7! routines and omp_get_gprivate_limit (TR15 Sec. 34.13).
8!
9! This exercises the interfaces, including the optional offset and access_group
10! arguments, and checks the values reported by the host runtime. When no dynamic
11! groupprivate block exists and no offload runtime is loaded, the routines report
12! a null pointer, a size of zero, a null memory space and a zero limit.
13
15 use omp_lib
16 use, intrinsic :: iso_c_binding, only : c_ptr, c_size_t, c_int, c_associated
17 implicit none
18
19 type(c_ptr) :: p
20 integer(c_size_t) :: sz
21 integer(omp_memspace_handle_kind) :: ms
22 logical :: ok
23
24 ok = .true.
25
26 ! omp_get_dyn_gprivate_ptr: no block => null pointer. Cover default args,
27 ! explicit offset, explicit access_group, and the offset-omitted-via-keyword
28 ! form.
30 if (c_associated(p)) ok = .false.
31 p = omp_get_dyn_gprivate_ptr(0_c_size_t)
32 if (c_associated(p)) ok = .false.
34 if (c_associated(p)) ok = .false.
36 if (c_associated(p)) ok = .false.
37
38 ! omp_get_dyn_gprivate_nofb_ptr: no block => null pointer.
40 if (c_associated(p)) ok = .false.
42 if (c_associated(p)) ok = .false.
43
44 ! omp_get_dyn_gprivate_size: no block => zero.
46 if (sz /= 0_c_size_t) ok = .false.
48 if (sz /= 0_c_size_t) ok = .false.
49
50 ! omp_get_dyn_gprivate_memspace: no block => omp_null_mem_space.
52 if (ms /= omp_null_mem_space) ok = .false.
54 if (ms /= omp_null_mem_space) ok = .false.
55
56 ! omp_get_gprivate_limit: the host reports no groupprivate limit.
57 sz = omp_get_gprivate_limit(0_c_int)
58 if (sz /= 0_c_size_t) ok = .false.
60 if (sz /= 0_c_size_t) ok = .false.
61
62 if (ok) then
63 print *, "PASS"
64 else
65 print *, "FAIL"
66 end if
67
68! CHECK: PASS
void * omp_get_dyn_gprivate_nofb_ptr(size_t offset, omp_access_t access_group)
size_t omp_get_dyn_gprivate_size(omp_access_t access_group)
void * omp_get_dyn_gprivate_ptr(size_t offset, omp_access_t access_group)
omp_memspace_handle_t omp_get_dyn_gprivate_memspace(omp_access_t access_group)
@ omp_access_cgroup
Definition kmp.h:1090
size_t omp_get_gprivate_limit(int device_num, omp_access_t access_group)
Definition kmp_stub.cpp:481
program omp61_dyn_gprivate_routines