Intermediate impl of ABGDXYZ

nond-rep
Salvatore Filippone 11 months 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)
select type(yy => y)
class is (psb_d_vect_cuda)
select type(zz => z)
class is (psb_d_vect_cuda)
! Do something different here ! Do something different here
if ((beta /= dzero).and.y%is_host())& if ((beta /= dzero).and.yy%is_host())&
& call y%sync() & call yy%sync()
if ((delta /= dzero).and.zz%is_host())&
& call zz%sync()
if (xx%is_host()) call xx%sync() if (xx%is_host()) call xx%sync()
nx = getMultiVecDeviceSize(xx%deviceVect) nx = getMultiVecDeviceSize(xx%deviceVect)
ny = getMultiVecDeviceSize(y%deviceVect) ny = getMultiVecDeviceSize(yy%deviceVect)
if ((nx<m).or.(ny<m)) then nz = getMultiVecDeviceSize(zz%deviceVect)
if ((nx<m).or.(ny<m).or.(nz<m)) then
info = psb_err_internal_error_ info = psb_err_internal_error_
else else
info = axpbyMultiVecDevice(m,alpha,xx%deviceVect,beta,y%deviceVect) !info = axpbyMultiVecDevice(m,alpha,xx%deviceVect,beta,y%deviceVect)
end if end if
call y%set_dev() call yy%set_dev()
class default call zz%set_dev()
! Do it on the host side gpu_done = .true.
if ((alpha /= dzero).and.(x%is_dev()))& end select
& call x%sync() end select
call y%axpby(m,alpha,x%v,beta,info)
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