Intermediate impl of ABGDXYZ

nond-rep
Salvatore Filippone 2 years ago
parent 864872ecac
commit 105aa3c570

@ -922,33 +922,47 @@ contains
class(psb_d_vect_cuda), intent(inout) :: z class(psb_d_vect_cuda), intent(inout) :: z
real(psb_dpk_), intent (in) :: alpha, beta, gamma, delta real(psb_dpk_), intent (in) :: alpha, beta, gamma, delta
integer(psb_ipk_), intent(out) :: info integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: nx, ny, nz
logical :: gpu_done
info = psb_success_ info = psb_success_
if (.false.) then if (.false.) then
gpu_done = .false.
select type(xx => x) select type(xx => x)
type is (psb_d_vect_cuda) class is (psb_d_vect_cuda)
! Do something different here select type(yy => y)
if ((beta /= dzero).and.y%is_host())& class is (psb_d_vect_cuda)
& call y%sync() select type(zz => z)
if (xx%is_host()) call xx%sync() class is (psb_d_vect_cuda)
nx = getMultiVecDeviceSize(xx%deviceVect) ! Do something different here
ny = getMultiVecDeviceSize(y%deviceVect) if ((beta /= dzero).and.yy%is_host())&
if ((nx<m).or.(ny<m)) then & call yy%sync()
info = psb_err_internal_error_ if ((delta /= dzero).and.zz%is_host())&
else & call zz%sync()
info = axpbyMultiVecDevice(m,alpha,xx%deviceVect,beta,y%deviceVect) if (xx%is_host()) call xx%sync()
end if nx = getMultiVecDeviceSize(xx%deviceVect)
call y%set_dev() ny = getMultiVecDeviceSize(yy%deviceVect)
class default nz = getMultiVecDeviceSize(zz%deviceVect)
! Do it on the host side if ((nx<m).or.(ny<m).or.(nz<m)) then
if ((alpha /= dzero).and.(x%is_dev()))& info = psb_err_internal_error_
& call x%sync() else
call y%axpby(m,alpha,x%v,beta,info) !info = axpbyMultiVecDevice(m,alpha,xx%deviceVect,beta,y%deviceVect)
end if
call yy%set_dev()
call zz%set_dev()
gpu_done = .true.
end select
end select
end select end select
if (.not.gpu_done) then
if (x%is_host()) call x%sync()
if (y%is_host()) call y%sync()
if (z%is_host()) call z%sync()
call y%axpby(m,alpha,x,beta,info)
call z%axpby(m,gamma,y,delta,info)
end if
else else
if (x%is_host()) call x%sync() if (x%is_host()) call x%sync()

Loading…
Cancel
Save