Add missing target directive in OpenMP dispatch Fortran runtime test
Without the target directive, the test would run on the host but still try to use device pointers, which causes a segfault. libgomp/ChangeLog: * testsuite/libgomp.fortran/dispatch-1.f90: Add missing target directive.
This commit is contained in:
parent
7cd4de65ff
commit
655a8a024d
1 changed files with 13 additions and 8 deletions
|
@ -48,16 +48,21 @@ module procedures
|
|||
integer :: res, n, i
|
||||
type(c_ptr) :: d_bv
|
||||
type(c_ptr) :: d_av
|
||||
real(8), pointer :: fp_bv(:), fp_av(:) ! Fortran pointers for array access
|
||||
|
||||
! Associate C pointers with Fortran pointers
|
||||
call c_f_pointer(d_bv, fp_bv, [n])
|
||||
call c_f_pointer(d_av, fp_av, [n])
|
||||
!$omp target is_device_ptr(d_bv, d_av)
|
||||
block
|
||||
real(8), pointer :: fp_bv(:), fp_av(:) ! Fortran pointers for array access
|
||||
|
||||
! Associate C pointers with Fortran pointers
|
||||
call c_f_pointer(d_bv, fp_bv, [n])
|
||||
call c_f_pointer(d_av, fp_av, [n])
|
||||
|
||||
! Perform operations on target
|
||||
do i = 1, n
|
||||
fp_bv(i) = fp_av(i) * i
|
||||
end do
|
||||
end block
|
||||
|
||||
! Perform operations on target
|
||||
do i = 1, n
|
||||
fp_bv(i) = fp_av(i) * i
|
||||
end do
|
||||
res = -2
|
||||
end function bar
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue