mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-10 16:32:11 +01:00
38 lines
802 B
Fortran
38 lines
802 B
Fortran
! @@name: target_mapper.3
|
|
! @@type: F-free
|
|
! @@operation: compile
|
|
! @@expect: success
|
|
! @@version: omp_5.0
|
|
module my_structures
|
|
type myvec_t
|
|
integer :: len
|
|
double precision, pointer :: data(:)
|
|
end type
|
|
!$omp declare mapper(myvec_t :: v) &
|
|
!$omp& map(v, v%data(:))
|
|
|
|
type mypoints_t
|
|
type(myvec_t) :: scratch
|
|
type(myvec_t), pointer :: x(:)
|
|
double precision :: hostonly_data(500000)
|
|
end type
|
|
!$omp declare mapper(mypoints_t :: v) &
|
|
!$omp& map(v%x, v%x(1)) map(alloc:v%scratch)
|
|
|
|
end module
|
|
|
|
|
|
program main
|
|
use my_structures
|
|
external init_mypts_array, eval_mypts_array
|
|
|
|
type(mypoints_t) :: P
|
|
|
|
call init_mypts_array(P)
|
|
|
|
!$omp target map(P)
|
|
call eval_mypts_array(P)
|
|
!$omp end target
|
|
|
|
end program
|