Fix OpenACC files

pull/31/head
sfilippone 7 months ago
parent b60fc25314
commit 8f6000f940

@ -144,9 +144,15 @@ contains
! but with size 0, then CREATE,UPDATE and DELETE
! will fail
!
if (psb_size(a%val)>0) call acc_delete_finalize(a%val)
if (psb_size(a%ja)>0) call acc_delete_finalize(a%ja)
if (psb_size(a%irp)>0) call acc_delete_finalize(a%irp)
if (psb_size(a%val)>0) then
!$acc exit data delete(a%val) finalize
end if
if (psb_size(a%ja)>0) then
!$acc exit data delete(a%ja) finalize
end if
if (psb_size(a%irp)>0) then
!$acc exit data delete(a%irp) finalize
end if
return
end subroutine c_oacc_csr_free_dev_space
@ -257,9 +263,15 @@ contains
! but with size 0, then CREATE,UPDATE and DELETE
! will fail
!
if (psb_size(a%val)>0) call acc_copyin(a%val)
if (psb_size(a%ja)>0) call acc_copyin(a%ja)
if (psb_size(a%irp)>0) call acc_copyin(a%irp)
if (psb_size(a%val)>0) then
!$acc enter data copyin(a%val)
end if
if (psb_size(a%ja)>0) then
!$acc enter data copyin(a%ja)
end if
if (psb_size(a%irp)>0) then
!$acc enter data copyin(a%irp)
end if
end subroutine c_oacc_csr_sync_dev_space
subroutine c_oacc_csr_sync(a)
@ -275,13 +287,25 @@ contains
! will fail
!
if (a%is_dev()) then
if (psb_size(a%val)>0) call acc_update_self(a%val)
if (psb_size(a%ja)>0) call acc_update_self(a%ja)
if (psb_size(a%irp)>0) call acc_update_self(a%irp)
if (psb_size(a%val)>0) then
!$acc update self(a%val)
end if
if (psb_size(a%ja)>0) then
!$acc update self(a%ja)
end if
if (psb_size(a%irp)>0) then
!$acc update self(a%irp)
end if
else if (a%is_host()) then
if (psb_size(a%val)>0) call acc_update_device(a%val)
if (psb_size(a%ja)>0) call acc_update_device(a%ja)
if (psb_size(a%irp)>0) call acc_update_device(a%irp)
if (psb_size(a%val)>0) then
!$acc update device(a%val)
end if
if (psb_size(a%ja)>0) then
!$acc update device(a%ja)
end if
if (psb_size(a%irp)>0) then
!$acc update device(a%irp)
end if
end if
call tmpa%set_sync()
end subroutine c_oacc_csr_sync

@ -143,10 +143,18 @@ contains
! but with size 0, then CREATE,UPDATE and DELETE
! will fail
!
if (psb_size(a%val)>0) call acc_delete_finalize(a%val)
if (psb_size(a%ja)>0) call acc_delete_finalize(a%ja)
if (psb_size(a%irn)>0) call acc_delete_finalize(a%irn)
if (psb_size(a%idiag)>0) call acc_delete_finalize(a%idiag)
if (psb_size(a%val)>0) then
!$acc exit data delete(a%val) finalize
end if
if (psb_size(a%ja)>0) then
!$acc exit data delete(a%ja) finalize
end if
if (psb_size(a%irn)>0) then
!$acc exit data delete(a%irn) finalize
end if
if (psb_size(a%idiag)>0) then
!$acc exit data delete(a%idiag) finalize
end if
return
end subroutine c_oacc_ell_free_dev_space
@ -170,7 +178,7 @@ contains
if (a%is_dev()) call a%sync()
res = 8
res = res + psb_sizeof_dp * size(a%val)
res = res + (2*psb_sizeof_sp) * size(a%val)
res = res + psb_sizeof_ip * size(a%ja)
res = res + psb_sizeof_ip * size(a%irn)
res = res + psb_sizeof_ip * size(a%idiag)
@ -186,10 +194,18 @@ contains
! but with size 0, then CREATE,UPDATE and DELETE
! will fail
!
if (psb_size(a%val)>0) call acc_copyin(a%val)
if (psb_size(a%ja)>0) call acc_copyin(a%ja)
if (psb_size(a%irn)>0) call acc_copyin(a%irn)
if (psb_size(a%idiag)>0) call acc_copyin(a%idiag)
if (psb_size(a%val)>0) then
!$acc enter data copyin(a%val)
end if
if (psb_size(a%ja)>0) then
!$acc enter data copyin(a%ja)
end if
if (psb_size(a%irn)>0) then
!$acc enter data copyin(a%irn)
end if
if (psb_size(a%idiag)>0) then
!$acc enter data copyin(a%idiag)
end if
end subroutine c_oacc_ell_sync_dev_space
function c_oacc_ell_is_host(a) result(res)
@ -256,15 +272,31 @@ contains
! will fail
!
if (a%is_dev()) then
if (psb_size(a%val)>0) call acc_update_self(a%val)
if (psb_size(a%ja)>0) call acc_update_self(a%ja)
if (psb_size(a%irn)>0) call acc_update_self(a%irn)
if (psb_size(a%idiag)>0) call acc_update_self(a%idiag)
if (psb_size(a%val)>0) then
!$acc update self(a%val)
end if
if (psb_size(a%ja)>0) then
!$acc update self(a%ja)
end if
if (psb_size(a%irn)>0) then
!$acc update self(a%irn)
end if
if (psb_size(a%idiag)>0) then
!$acc update self(a%idiag)
end if
else if (a%is_host()) then
if (psb_size(a%val)>0) call acc_update_device(a%val)
if (psb_size(a%ja)>0) call acc_update_device(a%ja)
if (psb_size(a%irn)>0) call acc_update_device(a%irn)
if (psb_size(a%idiag)>0) call acc_update_device(a%idiag)
if (psb_size(a%val)>0) then
!$acc update device(a%val)
end if
if (psb_size(a%ja)>0) then
!$acc update device(a%ja)
end if
if (psb_size(a%irn)>0) then
!$acc update device(a%irn)
end if
if (psb_size(a%idiag)>0) then
!$acc update device(a%idiag)
end if
end if
call tmpa%set_sync()
end subroutine c_oacc_ell_sync

@ -171,7 +171,7 @@ contains
if (a%is_dev()) call a%sync()
res = 8
res = res + psb_sizeof_dp * size(a%val)
res = res + (2*psb_sizeof_sp) * size(a%val)
res = res + psb_sizeof_ip * size(a%ja)
res = res + psb_sizeof_ip * size(a%irn)
res = res + psb_sizeof_ip * size(a%idiag)

@ -829,9 +829,10 @@ contains
complex(psb_spk_) :: res
integer(psb_ipk_) :: i
res = czero
!$acc parallel loop reduction(+:res) present(x, y)
do i = 1, n
res = res + x(i) * y(i)
res = res + conjg(x(i)) * y(i)
end do
!$acc end parallel loop
end function c_inner_oacc_dot
@ -843,10 +844,10 @@ contains
complex(psb_spk_), intent(in) :: y(:)
integer(psb_ipk_), intent(in) :: n
complex(psb_spk_) :: res
complex(psb_spk_), external :: cdot
complex(psb_spk_), external :: cdotc
if (x%is_dev()) call x%sync()
res = cdot(n, y, 1, x%v, 1)
res = cdotc(n, y, 1, x%v, 1)
end function c_oacc_dot_a
@ -943,6 +944,7 @@ contains
class(psb_c_vect_oacc), intent(out) :: x
integer(psb_ipk_), intent(out) :: info
call x%free(info)
call psb_realloc(n, x%v, info)
if (info /= 0) then
info = psb_err_alloc_request_

@ -144,9 +144,15 @@ contains
! but with size 0, then CREATE,UPDATE and DELETE
! will fail
!
if (psb_size(a%val)>0) call acc_delete_finalize(a%val)
if (psb_size(a%ja)>0) call acc_delete_finalize(a%ja)
if (psb_size(a%irp)>0) call acc_delete_finalize(a%irp)
if (psb_size(a%val)>0) then
!$acc exit data delete(a%val) finalize
end if
if (psb_size(a%ja)>0) then
!$acc exit data delete(a%ja) finalize
end if
if (psb_size(a%irp)>0) then
!$acc exit data delete(a%irp) finalize
end if
return
end subroutine d_oacc_csr_free_dev_space
@ -257,9 +263,15 @@ contains
! but with size 0, then CREATE,UPDATE and DELETE
! will fail
!
if (psb_size(a%val)>0) call acc_copyin(a%val)
if (psb_size(a%ja)>0) call acc_copyin(a%ja)
if (psb_size(a%irp)>0) call acc_copyin(a%irp)
if (psb_size(a%val)>0) then
!$acc enter data copyin(a%val)
end if
if (psb_size(a%ja)>0) then
!$acc enter data copyin(a%ja)
end if
if (psb_size(a%irp)>0) then
!$acc enter data copyin(a%irp)
end if
end subroutine d_oacc_csr_sync_dev_space
subroutine d_oacc_csr_sync(a)
@ -275,13 +287,25 @@ contains
! will fail
!
if (a%is_dev()) then
if (psb_size(a%val)>0) call acc_update_self(a%val)
if (psb_size(a%ja)>0) call acc_update_self(a%ja)
if (psb_size(a%irp)>0) call acc_update_self(a%irp)
if (psb_size(a%val)>0) then
!$acc update self(a%val)
end if
if (psb_size(a%ja)>0) then
!$acc update self(a%ja)
end if
if (psb_size(a%irp)>0) then
!$acc update self(a%irp)
end if
else if (a%is_host()) then
if (psb_size(a%val)>0) call acc_update_device(a%val)
if (psb_size(a%ja)>0) call acc_update_device(a%ja)
if (psb_size(a%irp)>0) call acc_update_device(a%irp)
if (psb_size(a%val)>0) then
!$acc update device(a%val)
end if
if (psb_size(a%ja)>0) then
!$acc update device(a%ja)
end if
if (psb_size(a%irp)>0) then
!$acc update device(a%irp)
end if
end if
call tmpa%set_sync()
end subroutine d_oacc_csr_sync

@ -143,10 +143,18 @@ contains
! but with size 0, then CREATE,UPDATE and DELETE
! will fail
!
if (psb_size(a%val)>0) call acc_delete_finalize(a%val)
if (psb_size(a%ja)>0) call acc_delete_finalize(a%ja)
if (psb_size(a%irn)>0) call acc_delete_finalize(a%irn)
if (psb_size(a%idiag)>0) call acc_delete_finalize(a%idiag)
if (psb_size(a%val)>0) then
!$acc exit data delete(a%val) finalize
end if
if (psb_size(a%ja)>0) then
!$acc exit data delete(a%ja) finalize
end if
if (psb_size(a%irn)>0) then
!$acc exit data delete(a%irn) finalize
end if
if (psb_size(a%idiag)>0) then
!$acc exit data delete(a%idiag) finalize
end if
return
end subroutine d_oacc_ell_free_dev_space
@ -186,10 +194,18 @@ contains
! but with size 0, then CREATE,UPDATE and DELETE
! will fail
!
if (psb_size(a%val)>0) call acc_copyin(a%val)
if (psb_size(a%ja)>0) call acc_copyin(a%ja)
if (psb_size(a%irn)>0) call acc_copyin(a%irn)
if (psb_size(a%idiag)>0) call acc_copyin(a%idiag)
if (psb_size(a%val)>0) then
!$acc enter data copyin(a%val)
end if
if (psb_size(a%ja)>0) then
!$acc enter data copyin(a%ja)
end if
if (psb_size(a%irn)>0) then
!$acc enter data copyin(a%irn)
end if
if (psb_size(a%idiag)>0) then
!$acc enter data copyin(a%idiag)
end if
end subroutine d_oacc_ell_sync_dev_space
function d_oacc_ell_is_host(a) result(res)
@ -256,15 +272,31 @@ contains
! will fail
!
if (a%is_dev()) then
if (psb_size(a%val)>0) call acc_update_self(a%val)
if (psb_size(a%ja)>0) call acc_update_self(a%ja)
if (psb_size(a%irn)>0) call acc_update_self(a%irn)
if (psb_size(a%idiag)>0) call acc_update_self(a%idiag)
if (psb_size(a%val)>0) then
!$acc update self(a%val)
end if
if (psb_size(a%ja)>0) then
!$acc update self(a%ja)
end if
if (psb_size(a%irn)>0) then
!$acc update self(a%irn)
end if
if (psb_size(a%idiag)>0) then
!$acc update self(a%idiag)
end if
else if (a%is_host()) then
if (psb_size(a%val)>0) call acc_update_device(a%val)
if (psb_size(a%ja)>0) call acc_update_device(a%ja)
if (psb_size(a%irn)>0) call acc_update_device(a%irn)
if (psb_size(a%idiag)>0) call acc_update_device(a%idiag)
if (psb_size(a%val)>0) then
!$acc update device(a%val)
end if
if (psb_size(a%ja)>0) then
!$acc update device(a%ja)
end if
if (psb_size(a%irn)>0) then
!$acc update device(a%irn)
end if
if (psb_size(a%idiag)>0) then
!$acc update device(a%idiag)
end if
end if
call tmpa%set_sync()
end subroutine d_oacc_ell_sync

@ -829,9 +829,10 @@ contains
real(psb_dpk_) :: res
integer(psb_ipk_) :: i
res = dzero
!$acc parallel loop reduction(+:res) present(x, y)
do i = 1, n
res = res + x(i) * y(i)
res = res + (x(i)) * y(i)
end do
!$acc end parallel loop
end function d_inner_oacc_dot
@ -943,6 +944,7 @@ contains
class(psb_d_vect_oacc), intent(out) :: x
integer(psb_ipk_), intent(out) :: info
call x%free(info)
call psb_realloc(n, x%v, info)
if (info /= 0) then
info = psb_err_alloc_request_

@ -547,6 +547,7 @@ contains
class(psb_i_vect_oacc), intent(out) :: x
integer(psb_ipk_), intent(out) :: info
call x%free(info)
call psb_realloc(n, x%v, info)
if (info /= 0) then
info = psb_err_alloc_request_

@ -549,6 +549,7 @@ contains
class(psb_l_vect_oacc), intent(out) :: x
integer(psb_ipk_), intent(out) :: info
call x%free(info)
call psb_realloc(n, x%v, info)
if (info /= 0) then
info = psb_err_alloc_request_

@ -144,9 +144,15 @@ contains
! but with size 0, then CREATE,UPDATE and DELETE
! will fail
!
if (psb_size(a%val)>0) call acc_delete_finalize(a%val)
if (psb_size(a%ja)>0) call acc_delete_finalize(a%ja)
if (psb_size(a%irp)>0) call acc_delete_finalize(a%irp)
if (psb_size(a%val)>0) then
!$acc exit data delete(a%val) finalize
end if
if (psb_size(a%ja)>0) then
!$acc exit data delete(a%ja) finalize
end if
if (psb_size(a%irp)>0) then
!$acc exit data delete(a%irp) finalize
end if
return
end subroutine s_oacc_csr_free_dev_space
@ -257,9 +263,15 @@ contains
! but with size 0, then CREATE,UPDATE and DELETE
! will fail
!
if (psb_size(a%val)>0) call acc_copyin(a%val)
if (psb_size(a%ja)>0) call acc_copyin(a%ja)
if (psb_size(a%irp)>0) call acc_copyin(a%irp)
if (psb_size(a%val)>0) then
!$acc enter data copyin(a%val)
end if
if (psb_size(a%ja)>0) then
!$acc enter data copyin(a%ja)
end if
if (psb_size(a%irp)>0) then
!$acc enter data copyin(a%irp)
end if
end subroutine s_oacc_csr_sync_dev_space
subroutine s_oacc_csr_sync(a)
@ -275,13 +287,25 @@ contains
! will fail
!
if (a%is_dev()) then
if (psb_size(a%val)>0) call acc_update_self(a%val)
if (psb_size(a%ja)>0) call acc_update_self(a%ja)
if (psb_size(a%irp)>0) call acc_update_self(a%irp)
if (psb_size(a%val)>0) then
!$acc update self(a%val)
end if
if (psb_size(a%ja)>0) then
!$acc update self(a%ja)
end if
if (psb_size(a%irp)>0) then
!$acc update self(a%irp)
end if
else if (a%is_host()) then
if (psb_size(a%val)>0) call acc_update_device(a%val)
if (psb_size(a%ja)>0) call acc_update_device(a%ja)
if (psb_size(a%irp)>0) call acc_update_device(a%irp)
if (psb_size(a%val)>0) then
!$acc update device(a%val)
end if
if (psb_size(a%ja)>0) then
!$acc update device(a%ja)
end if
if (psb_size(a%irp)>0) then
!$acc update device(a%irp)
end if
end if
call tmpa%set_sync()
end subroutine s_oacc_csr_sync

@ -143,10 +143,18 @@ contains
! but with size 0, then CREATE,UPDATE and DELETE
! will fail
!
if (psb_size(a%val)>0) call acc_delete_finalize(a%val)
if (psb_size(a%ja)>0) call acc_delete_finalize(a%ja)
if (psb_size(a%irn)>0) call acc_delete_finalize(a%irn)
if (psb_size(a%idiag)>0) call acc_delete_finalize(a%idiag)
if (psb_size(a%val)>0) then
!$acc exit data delete(a%val) finalize
end if
if (psb_size(a%ja)>0) then
!$acc exit data delete(a%ja) finalize
end if
if (psb_size(a%irn)>0) then
!$acc exit data delete(a%irn) finalize
end if
if (psb_size(a%idiag)>0) then
!$acc exit data delete(a%idiag) finalize
end if
return
end subroutine s_oacc_ell_free_dev_space
@ -170,7 +178,7 @@ contains
if (a%is_dev()) call a%sync()
res = 8
res = res + psb_sizeof_dp * size(a%val)
res = res + psb_sizeof_sp * size(a%val)
res = res + psb_sizeof_ip * size(a%ja)
res = res + psb_sizeof_ip * size(a%irn)
res = res + psb_sizeof_ip * size(a%idiag)
@ -186,10 +194,18 @@ contains
! but with size 0, then CREATE,UPDATE and DELETE
! will fail
!
if (psb_size(a%val)>0) call acc_copyin(a%val)
if (psb_size(a%ja)>0) call acc_copyin(a%ja)
if (psb_size(a%irn)>0) call acc_copyin(a%irn)
if (psb_size(a%idiag)>0) call acc_copyin(a%idiag)
if (psb_size(a%val)>0) then
!$acc enter data copyin(a%val)
end if
if (psb_size(a%ja)>0) then
!$acc enter data copyin(a%ja)
end if
if (psb_size(a%irn)>0) then
!$acc enter data copyin(a%irn)
end if
if (psb_size(a%idiag)>0) then
!$acc enter data copyin(a%idiag)
end if
end subroutine s_oacc_ell_sync_dev_space
function s_oacc_ell_is_host(a) result(res)
@ -256,15 +272,31 @@ contains
! will fail
!
if (a%is_dev()) then
if (psb_size(a%val)>0) call acc_update_self(a%val)
if (psb_size(a%ja)>0) call acc_update_self(a%ja)
if (psb_size(a%irn)>0) call acc_update_self(a%irn)
if (psb_size(a%idiag)>0) call acc_update_self(a%idiag)
if (psb_size(a%val)>0) then
!$acc update self(a%val)
end if
if (psb_size(a%ja)>0) then
!$acc update self(a%ja)
end if
if (psb_size(a%irn)>0) then
!$acc update self(a%irn)
end if
if (psb_size(a%idiag)>0) then
!$acc update self(a%idiag)
end if
else if (a%is_host()) then
if (psb_size(a%val)>0) call acc_update_device(a%val)
if (psb_size(a%ja)>0) call acc_update_device(a%ja)
if (psb_size(a%irn)>0) call acc_update_device(a%irn)
if (psb_size(a%idiag)>0) call acc_update_device(a%idiag)
if (psb_size(a%val)>0) then
!$acc update device(a%val)
end if
if (psb_size(a%ja)>0) then
!$acc update device(a%ja)
end if
if (psb_size(a%irn)>0) then
!$acc update device(a%irn)
end if
if (psb_size(a%idiag)>0) then
!$acc update device(a%idiag)
end if
end if
call tmpa%set_sync()
end subroutine s_oacc_ell_sync

@ -171,7 +171,7 @@ contains
if (a%is_dev()) call a%sync()
res = 8
res = res + psb_sizeof_dp * size(a%val)
res = res + psb_sizeof_sp * size(a%val)
res = res + psb_sizeof_ip * size(a%ja)
res = res + psb_sizeof_ip * size(a%irn)
res = res + psb_sizeof_ip * size(a%idiag)

@ -829,9 +829,10 @@ contains
real(psb_spk_) :: res
integer(psb_ipk_) :: i
res = szero
!$acc parallel loop reduction(+:res) present(x, y)
do i = 1, n
res = res + x(i) * y(i)
res = res + (x(i)) * y(i)
end do
!$acc end parallel loop
end function s_inner_oacc_dot
@ -943,6 +944,7 @@ contains
class(psb_s_vect_oacc), intent(out) :: x
integer(psb_ipk_), intent(out) :: info
call x%free(info)
call psb_realloc(n, x%v, info)
if (info /= 0) then
info = psb_err_alloc_request_

@ -144,9 +144,15 @@ contains
! but with size 0, then CREATE,UPDATE and DELETE
! will fail
!
if (psb_size(a%val)>0) call acc_delete_finalize(a%val)
if (psb_size(a%ja)>0) call acc_delete_finalize(a%ja)
if (psb_size(a%irp)>0) call acc_delete_finalize(a%irp)
if (psb_size(a%val)>0) then
!$acc exit data delete(a%val) finalize
end if
if (psb_size(a%ja)>0) then
!$acc exit data delete(a%ja) finalize
end if
if (psb_size(a%irp)>0) then
!$acc exit data delete(a%irp) finalize
end if
return
end subroutine z_oacc_csr_free_dev_space
@ -257,9 +263,15 @@ contains
! but with size 0, then CREATE,UPDATE and DELETE
! will fail
!
if (psb_size(a%val)>0) call acc_copyin(a%val)
if (psb_size(a%ja)>0) call acc_copyin(a%ja)
if (psb_size(a%irp)>0) call acc_copyin(a%irp)
if (psb_size(a%val)>0) then
!$acc enter data copyin(a%val)
end if
if (psb_size(a%ja)>0) then
!$acc enter data copyin(a%ja)
end if
if (psb_size(a%irp)>0) then
!$acc enter data copyin(a%irp)
end if
end subroutine z_oacc_csr_sync_dev_space
subroutine z_oacc_csr_sync(a)
@ -275,13 +287,25 @@ contains
! will fail
!
if (a%is_dev()) then
if (psb_size(a%val)>0) call acc_update_self(a%val)
if (psb_size(a%ja)>0) call acc_update_self(a%ja)
if (psb_size(a%irp)>0) call acc_update_self(a%irp)
if (psb_size(a%val)>0) then
!$acc update self(a%val)
end if
if (psb_size(a%ja)>0) then
!$acc update self(a%ja)
end if
if (psb_size(a%irp)>0) then
!$acc update self(a%irp)
end if
else if (a%is_host()) then
if (psb_size(a%val)>0) call acc_update_device(a%val)
if (psb_size(a%ja)>0) call acc_update_device(a%ja)
if (psb_size(a%irp)>0) call acc_update_device(a%irp)
if (psb_size(a%val)>0) then
!$acc update device(a%val)
end if
if (psb_size(a%ja)>0) then
!$acc update device(a%ja)
end if
if (psb_size(a%irp)>0) then
!$acc update device(a%irp)
end if
end if
call tmpa%set_sync()
end subroutine z_oacc_csr_sync

@ -143,10 +143,18 @@ contains
! but with size 0, then CREATE,UPDATE and DELETE
! will fail
!
if (psb_size(a%val)>0) call acc_delete_finalize(a%val)
if (psb_size(a%ja)>0) call acc_delete_finalize(a%ja)
if (psb_size(a%irn)>0) call acc_delete_finalize(a%irn)
if (psb_size(a%idiag)>0) call acc_delete_finalize(a%idiag)
if (psb_size(a%val)>0) then
!$acc exit data delete(a%val) finalize
end if
if (psb_size(a%ja)>0) then
!$acc exit data delete(a%ja) finalize
end if
if (psb_size(a%irn)>0) then
!$acc exit data delete(a%irn) finalize
end if
if (psb_size(a%idiag)>0) then
!$acc exit data delete(a%idiag) finalize
end if
return
end subroutine z_oacc_ell_free_dev_space
@ -170,7 +178,7 @@ contains
if (a%is_dev()) call a%sync()
res = 8
res = res + psb_sizeof_dp * size(a%val)
res = res + (2*psb_sizeof_dp) * size(a%val)
res = res + psb_sizeof_ip * size(a%ja)
res = res + psb_sizeof_ip * size(a%irn)
res = res + psb_sizeof_ip * size(a%idiag)
@ -186,10 +194,18 @@ contains
! but with size 0, then CREATE,UPDATE and DELETE
! will fail
!
if (psb_size(a%val)>0) call acc_copyin(a%val)
if (psb_size(a%ja)>0) call acc_copyin(a%ja)
if (psb_size(a%irn)>0) call acc_copyin(a%irn)
if (psb_size(a%idiag)>0) call acc_copyin(a%idiag)
if (psb_size(a%val)>0) then
!$acc enter data copyin(a%val)
end if
if (psb_size(a%ja)>0) then
!$acc enter data copyin(a%ja)
end if
if (psb_size(a%irn)>0) then
!$acc enter data copyin(a%irn)
end if
if (psb_size(a%idiag)>0) then
!$acc enter data copyin(a%idiag)
end if
end subroutine z_oacc_ell_sync_dev_space
function z_oacc_ell_is_host(a) result(res)
@ -256,15 +272,31 @@ contains
! will fail
!
if (a%is_dev()) then
if (psb_size(a%val)>0) call acc_update_self(a%val)
if (psb_size(a%ja)>0) call acc_update_self(a%ja)
if (psb_size(a%irn)>0) call acc_update_self(a%irn)
if (psb_size(a%idiag)>0) call acc_update_self(a%idiag)
if (psb_size(a%val)>0) then
!$acc update self(a%val)
end if
if (psb_size(a%ja)>0) then
!$acc update self(a%ja)
end if
if (psb_size(a%irn)>0) then
!$acc update self(a%irn)
end if
if (psb_size(a%idiag)>0) then
!$acc update self(a%idiag)
end if
else if (a%is_host()) then
if (psb_size(a%val)>0) call acc_update_device(a%val)
if (psb_size(a%ja)>0) call acc_update_device(a%ja)
if (psb_size(a%irn)>0) call acc_update_device(a%irn)
if (psb_size(a%idiag)>0) call acc_update_device(a%idiag)
if (psb_size(a%val)>0) then
!$acc update device(a%val)
end if
if (psb_size(a%ja)>0) then
!$acc update device(a%ja)
end if
if (psb_size(a%irn)>0) then
!$acc update device(a%irn)
end if
if (psb_size(a%idiag)>0) then
!$acc update device(a%idiag)
end if
end if
call tmpa%set_sync()
end subroutine z_oacc_ell_sync

@ -171,7 +171,7 @@ contains
if (a%is_dev()) call a%sync()
res = 8
res = res + psb_sizeof_dp * size(a%val)
res = res + (2*psb_sizeof_dp) * size(a%val)
res = res + psb_sizeof_ip * size(a%ja)
res = res + psb_sizeof_ip * size(a%irn)
res = res + psb_sizeof_ip * size(a%idiag)

@ -829,9 +829,10 @@ contains
complex(psb_dpk_) :: res
integer(psb_ipk_) :: i
res = zzero
!$acc parallel loop reduction(+:res) present(x, y)
do i = 1, n
res = res + x(i) * y(i)
res = res + conjg(x(i)) * y(i)
end do
!$acc end parallel loop
end function z_inner_oacc_dot
@ -843,10 +844,10 @@ contains
complex(psb_dpk_), intent(in) :: y(:)
integer(psb_ipk_), intent(in) :: n
complex(psb_dpk_) :: res
complex(psb_dpk_), external :: zdot
complex(psb_dpk_), external :: zdotc
if (x%is_dev()) call x%sync()
res = zdot(n, y, 1, x%v, 1)
res = zdotc(n, y, 1, x%v, 1)
end function z_oacc_dot_a
@ -943,6 +944,7 @@ contains
class(psb_z_vect_oacc), intent(out) :: x
integer(psb_ipk_), intent(out) :: info
call x%free(info)
call psb_realloc(n, x%v, info)
if (info /= 0) then
info = psb_err_alloc_request_

Loading…
Cancel
Save