| 1 |
! { dg-additional-options "-fopenmp-allocators" } |
| 2 |
module my_omp_lib |
| 3 |
use iso_c_binding, only: c_intptr_t |
| 4 |
!use omp_lib |
| 5 |
implicit none |
| 6 |
integer, parameter :: omp_allocator_handle_kind = c_intptr_t |
| 7 |
|
| 8 |
integer (kind=omp_allocator_handle_kind), & |
| 9 |
parameter :: omp_null_allocator = 0 |
| 10 |
|
| 11 |
integer (kind=omp_allocator_handle_kind), & |
| 12 |
parameter :: omp_default_mem_alloc = 1 |
| 13 |
integer (kind=omp_allocator_handle_kind), & |
| 14 |
parameter :: omp_large_cap_mem_alloc = 2 |
| 15 |
integer (kind=omp_allocator_handle_kind), & |
| 16 |
parameter :: omp_const_mem_alloc = 3 |
| 17 |
integer (kind=omp_allocator_handle_kind), & |
| 18 |
parameter :: omp_high_bw_mem_alloc = 4 |
| 19 |
integer (kind=omp_allocator_handle_kind), & |
| 20 |
parameter :: omp_low_lat_mem_alloc = 5 |
| 21 |
integer (kind=omp_allocator_handle_kind), & |
| 22 |
parameter :: omp_cgroup_mem_alloc = 6 |
| 23 |
integer (kind=omp_allocator_handle_kind), & |
| 24 |
parameter :: omp_pteam_mem_alloc = 7 |
| 25 |
integer (kind=omp_allocator_handle_kind), & |
| 26 |
parameter :: omp_thread_mem_alloc = 8 |
| 27 |
type t |
| 28 |
integer :: a |
| 29 |
end type t |
| 30 |
end module my_omp_lib |
| 31 |
|
| 32 |
subroutine zero() |
| 33 |
!$omp assumes absent (allocators) |
| 34 |
|
| 35 |
!$omp assume absent (allocators) |
| 36 |
!$omp end assume |
| 37 |
end |
| 38 |
|
| 39 |
subroutine two(c,x2,y2) |
| 40 |
use my_omp_lib |
| 41 |
implicit none |
| 42 |
integer, allocatable :: a, b(:), c(:,:) |
| 43 |
type(t), allocatable :: x1 |
| 44 |
type(t), pointer :: x2(:) |
| 45 |
class(t), allocatable :: y1 |
| 46 |
class(t), pointer :: y2(:) |
| 47 |
|
| 48 |
!$omp flush ! some executable statement |
| 49 |
!$omp allocate(a) |
| 50 |
allocate(a) |
| 51 |
deallocate(a) |
| 52 |
|
| 53 |
!$omp allocate(x1,y1,x2,y2) |
| 54 |
allocate(x1,y1,x2(5),y2(5)) |
| 55 |
deallocate(x1,y1,x2,y2) |
| 56 |
|
| 57 |
!$omp allocate(b,a) align ( 128 ) |
| 58 |
!$omp allocate align ( 64 ) |
| 59 |
allocate(a,b(4),c(3,4)) |
| 60 |
deallocate(a,b,c) |
| 61 |
end |
| 62 |
|
| 63 |
subroutine three(c) |
| 64 |
use my_omp_lib |
| 65 |
implicit none |
| 66 |
integer :: q |
| 67 |
integer, allocatable :: a, b(:), c(:,:) |
| 68 |
|
| 69 |
call foo() ! executable stmt |
| 70 |
!$omp allocate allocator( omp_large_cap_mem_alloc ) , align(64) |
| 71 |
!$omp allocate(b) allocator( omp_high_bw_mem_alloc ) |
| 72 |
!$omp allocate(c) allocator( omp_high_bw_mem_alloc ) |
| 73 |
allocate(a,b(4),c(3,4)) |
| 74 |
deallocate(a,b,c) |
| 75 |
|
| 76 |
block |
| 77 |
q = 5 ! executable stmt |
| 78 |
!$omp allocate(a) align(64) |
| 79 |
!$omp allocate(b) allocator( omp_high_bw_mem_alloc ), align(32) |
| 80 |
!$omp allocate(c) allocator( omp_thread_mem_alloc ) |
| 81 |
allocate(a,b(4),c(3,4)) |
| 82 |
deallocate(a,b,c) |
| 83 |
end block |
| 84 |
call inner |
| 85 |
contains |
| 86 |
subroutine inner |
| 87 |
call foo() ! executable stmt |
| 88 |
!$omp allocate(a) align(64) |
| 89 |
!$omp allocate(b) allocator( omp_high_bw_mem_alloc ), align(32) |
| 90 |
!$omp allocate(c) allocator( omp_thread_mem_alloc ) |
| 91 |
allocate(a,b(4),c(3,4)) |
| 92 |
deallocate(a,b,c) |
| 93 |
end subroutine inner |
| 94 |
end |