|
|
|
@ -227,7 +227,7 @@ subroutine psb_d_cuda_csrg_to_gpu(a,info,nzrm)
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
#elif 0
|
|
|
|
|
|
|
|
|
|
if (a%is_unit()) then
|
|
|
|
|
!
|
|
|
|
@ -308,7 +308,85 @@ subroutine psb_d_cuda_csrg_to_gpu(a,info,nzrm)
|
|
|
|
|
!!$ if ((info == 0) .and. a%is_triangle()) then
|
|
|
|
|
!!$ info = CSRGDeviceCsrsmAnalysis(a%deviceMat)
|
|
|
|
|
!!$ end if
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
|
|
if (a%is_unit()) then
|
|
|
|
|
!
|
|
|
|
|
! CUSPARSE has the habit of storing the diagonal and then ignoring,
|
|
|
|
|
! whereas we do not store it. Hence this adapter code.
|
|
|
|
|
!
|
|
|
|
|
nzdi = nz + m
|
|
|
|
|
if (info == 0) info = CSRGDeviceAlloc(a%deviceMat,m,n,nzdi)
|
|
|
|
|
if (info == 0) then
|
|
|
|
|
if (a%is_unit()) then
|
|
|
|
|
info = CSRGDeviceSetMatDiagType(a%deviceMat,cusparse_diag_type_unit)
|
|
|
|
|
else
|
|
|
|
|
info = CSRGDeviceSetMatDiagType(a%deviceMat,cusparse_diag_type_non_unit)
|
|
|
|
|
end if
|
|
|
|
|
end if
|
|
|
|
|
!!! We are explicitly adding the diagonal
|
|
|
|
|
!! info = CSRGDeviceSetMatDiagType(a%deviceMat,cusparse_diag_type_non_unit)
|
|
|
|
|
if ((info == 0) .and. a%is_triangle()) then
|
|
|
|
|
!!$ info = CSRGDeviceSetMatType(a%deviceMat,cusparse_matrix_type_triangular)
|
|
|
|
|
if ((info == 0).and.a%is_upper()) then
|
|
|
|
|
info = CSRGDeviceSetMatFillMode(a%deviceMat,cusparse_fill_mode_upper)
|
|
|
|
|
else
|
|
|
|
|
info = CSRGDeviceSetMatFillMode(a%deviceMat,cusparse_fill_mode_lower)
|
|
|
|
|
end if
|
|
|
|
|
end if
|
|
|
|
|
if (info == 0) allocate(irpdi(m+1),jadi(nzdi),valdi(nzdi),stat=info)
|
|
|
|
|
if (info == 0) then
|
|
|
|
|
irpdi(1) = 1
|
|
|
|
|
if (a%is_triangle().and.a%is_upper()) then
|
|
|
|
|
do i=1,m
|
|
|
|
|
j = irpdi(i)
|
|
|
|
|
jadi(j) = i
|
|
|
|
|
valdi(j) = done
|
|
|
|
|
nrz = a%irp(i+1)-a%irp(i)
|
|
|
|
|
jadi(j+1:j+nrz) = a%ja(a%irp(i):a%irp(i+1)-1)
|
|
|
|
|
valdi(j+1:j+nrz) = a%val(a%irp(i):a%irp(i+1)-1)
|
|
|
|
|
irpdi(i+1) = j + nrz + 1
|
|
|
|
|
! write(0,*) 'Row ',i,' : ',irpdi(i:i+1),':',jadi(j:j+nrz),valdi(j:j+nrz)
|
|
|
|
|
end do
|
|
|
|
|
else
|
|
|
|
|
do i=1,m
|
|
|
|
|
j = irpdi(i)
|
|
|
|
|
nrz = a%irp(i+1)-a%irp(i)
|
|
|
|
|
jadi(j+0:j+nrz-1) = a%ja(a%irp(i):a%irp(i+1)-1)
|
|
|
|
|
valdi(j+0:j+nrz-1) = a%val(a%irp(i):a%irp(i+1)-1)
|
|
|
|
|
jadi(j+nrz) = i
|
|
|
|
|
valdi(j+nrz) = done
|
|
|
|
|
irpdi(i+1) = j + nrz + 1
|
|
|
|
|
! write(0,*) 'Row ',i,' : ',irpdi(i:i+1),':',jadi(j:j+nrz),valdi(j:j+nrz)
|
|
|
|
|
end do
|
|
|
|
|
end if
|
|
|
|
|
end if
|
|
|
|
|
if (info == 0) info = CSRGHost2Device(a%deviceMat,m,n,nzdi,irpdi,jadi,valdi)
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
|
|
if (info == 0) info = CSRGDeviceAlloc(a%deviceMat,m,n,nz)
|
|
|
|
|
!info = CSRGDeviceSetMatType(a%deviceMat,cusparse_matrix_type_general)
|
|
|
|
|
!!$ if (info == 0) info = CSRGDeviceSetMatIndexBase(a%deviceMat,cusparse_index_base_one)
|
|
|
|
|
!!$ if (a%is_triangle()) then
|
|
|
|
|
!!$ if (info == 0) then
|
|
|
|
|
!!$ if (a%is_unit()) then
|
|
|
|
|
!!$ info = CSRGDeviceSetMatDiagType(a%deviceMat,cusparse_diag_type_unit)
|
|
|
|
|
!!$ else
|
|
|
|
|
!!$ info = CSRGDeviceSetMatDiagType(a%deviceMat,cusparse_diag_type_non_unit)
|
|
|
|
|
!!$ end if
|
|
|
|
|
!!$ end if
|
|
|
|
|
!!$ if ((info == 0) )then
|
|
|
|
|
!!$ if ((info == 0).and.a%is_upper()) then
|
|
|
|
|
!!$ info = CSRGDeviceSetMatFillMode(a%deviceMat,cusparse_fill_mode_upper)
|
|
|
|
|
!!$ else
|
|
|
|
|
!!$ info = CSRGDeviceSetMatFillMode(a%deviceMat,cusparse_fill_mode_lower)
|
|
|
|
|
!!$ end if
|
|
|
|
|
!!$ end if
|
|
|
|
|
!!$ end if
|
|
|
|
|
if (info == 0) info = CSRGHost2Device(a%deviceMat,m,n,nz,a%irp,a%ja,a%val)
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
call a%set_sync()
|
|
|
|
|
|
|
|
|
|