Attempt at fixing CSRG in CUDA 10.2. Not complete yet.

repack-nvid
Salvatore Filippone 1 year ago
parent 1bc2a884e2
commit 20a01d4d71

@ -141,15 +141,16 @@ int T_spmvCSRGDevice(T_Cmat *Matrix, TYPE alpha, void *deviceX,
cusparseHandle_t *my_handle=getHandle(); cusparseHandle_t *my_handle=getHandle();
TYPE ealpha=alpha, ebeta=beta; TYPE ealpha=alpha, ebeta=beta;
#if CUDA_SHORT_VERSION <= 10 #if CUDA_SHORT_VERSION <= 10
/*getAddrMultiVecDevice(deviceX, &vX); /* getAddrMultiVecDevice(deviceX, &vX); */
getAddrMultiVecDevice(deviceY, &vY); */ /* getAddrMultiVecDevice(deviceY, &vY); */
vX=x->v_; vX=x->v_;
vY=y->v_; vY=y->v_;
return cusparseTcsrmv(*my_handle,CUSPARSE_OPERATION_NON_TRANSPOSE, CHECK_CUSPARSE(cusparseTcsrmv(*my_handle,CUSPARSE_OPERATION_NON_TRANSPOSE,
cMat->m,cMat->n,cMat->nz,(const TYPE *) &alpha,cMat->descr, cMat->m,cMat->n,cMat->nz,(const TYPE *) &alpha,cMat->descr,
cMat->val, cMat->irp, cMat->ja, cMat->val, cMat->irp, cMat->ja,
(const TYPE *) vX, (const TYPE *) &beta, (TYPE *) vY); (const TYPE *) vX, (const TYPE *) &beta, (TYPE *) vY));
#elif CUDA_VERSION < 11030 #elif CUDA_VERSION < 11030
size_t bfsz; size_t bfsz;
vX=x->v_; vX=x->v_;

@ -55,7 +55,7 @@ subroutine psb_c_cuda_csrg_to_gpu(a,info,nzrm)
if (c_associated(a%deviceMat%Mat)) then if (c_associated(a%deviceMat%Mat)) then
info = CSRGDeviceFree(a%deviceMat) info = CSRGDeviceFree(a%deviceMat)
end if end if
#if CUDA_SHORT_VERSION <= 10 #if (CUDA_SHORT_VERSION <= 10 )
if (a%is_unit()) then if (a%is_unit()) then
! !
! CUSPARSE has the habit of storing the diagonal and then ignoring, ! CUSPARSE has the habit of storing the diagonal and then ignoring,
@ -74,7 +74,7 @@ subroutine psb_c_cuda_csrg_to_gpu(a,info,nzrm)
!!! We are explicitly adding the diagonal !!! We are explicitly adding the diagonal
!! info = CSRGDeviceSetMatDiagType(a%deviceMat,cusparse_diag_type_non_unit) !! info = CSRGDeviceSetMatDiagType(a%deviceMat,cusparse_diag_type_non_unit)
if ((info == 0) .and. a%is_triangle()) then if ((info == 0) .and. a%is_triangle()) then
info = CSRGDeviceSetMatType(a%deviceMat,cusparse_matrix_type_triangular) !info = CSRGDeviceSetMatType(a%deviceMat,cusparse_matrix_type_triangular)
if ((info == 0).and.a%is_upper()) then if ((info == 0).and.a%is_upper()) then
info = CSRGDeviceSetMatFillMode(a%deviceMat,cusparse_fill_mode_upper) info = CSRGDeviceSetMatFillMode(a%deviceMat,cusparse_fill_mode_upper)
else else
@ -114,15 +114,15 @@ subroutine psb_c_cuda_csrg_to_gpu(a,info,nzrm)
if (info == 0) info = CSRGDeviceAlloc(a%deviceMat,m,n,nz) if (info == 0) info = CSRGDeviceAlloc(a%deviceMat,m,n,nz)
if (info == 0) info = CSRGDeviceSetMatIndexBase(a%deviceMat,cusparse_index_base_one) if (info == 0) info = CSRGDeviceSetMatIndexBase(a%deviceMat,cusparse_index_base_one)
if (info == 0) then !!$ if (info == 0) then
if (a%is_unit()) then !!$ if (a%is_unit()) then
info = CSRGDeviceSetMatDiagType(a%deviceMat,cusparse_diag_type_unit) !!$ info = CSRGDeviceSetMatDiagType(a%deviceMat,cusparse_diag_type_unit)
else !!$ else
info = CSRGDeviceSetMatDiagType(a%deviceMat,cusparse_diag_type_non_unit) !!$ info = CSRGDeviceSetMatDiagType(a%deviceMat,cusparse_diag_type_non_unit)
end if !!$ end if
end if !!$ end if
if ((info == 0) .and. a%is_triangle()) then if ((info == 0) .and. a%is_triangle()) then
info = CSRGDeviceSetMatType(a%deviceMat,cusparse_matrix_type_triangular) !info = CSRGDeviceSetMatType(a%deviceMat,cusparse_matrix_type_triangular)
if ((info == 0).and.a%is_upper()) then if ((info == 0).and.a%is_upper()) then
info = CSRGDeviceSetMatFillMode(a%deviceMat,cusparse_fill_mode_upper) info = CSRGDeviceSetMatFillMode(a%deviceMat,cusparse_fill_mode_upper)
else else

@ -55,7 +55,7 @@ subroutine psb_d_cuda_csrg_to_gpu(a,info,nzrm)
if (c_associated(a%deviceMat%Mat)) then if (c_associated(a%deviceMat%Mat)) then
info = CSRGDeviceFree(a%deviceMat) info = CSRGDeviceFree(a%deviceMat)
end if end if
#if CUDA_SHORT_VERSION <= 10 #if (CUDA_SHORT_VERSION <= 10 )
if (a%is_unit()) then if (a%is_unit()) then
! !
! CUSPARSE has the habit of storing the diagonal and then ignoring, ! CUSPARSE has the habit of storing the diagonal and then ignoring,
@ -74,7 +74,7 @@ subroutine psb_d_cuda_csrg_to_gpu(a,info,nzrm)
!!! We are explicitly adding the diagonal !!! We are explicitly adding the diagonal
!! info = CSRGDeviceSetMatDiagType(a%deviceMat,cusparse_diag_type_non_unit) !! info = CSRGDeviceSetMatDiagType(a%deviceMat,cusparse_diag_type_non_unit)
if ((info == 0) .and. a%is_triangle()) then if ((info == 0) .and. a%is_triangle()) then
info = CSRGDeviceSetMatType(a%deviceMat,cusparse_matrix_type_triangular) !info = CSRGDeviceSetMatType(a%deviceMat,cusparse_matrix_type_triangular)
if ((info == 0).and.a%is_upper()) then if ((info == 0).and.a%is_upper()) then
info = CSRGDeviceSetMatFillMode(a%deviceMat,cusparse_fill_mode_upper) info = CSRGDeviceSetMatFillMode(a%deviceMat,cusparse_fill_mode_upper)
else else
@ -114,15 +114,15 @@ subroutine psb_d_cuda_csrg_to_gpu(a,info,nzrm)
if (info == 0) info = CSRGDeviceAlloc(a%deviceMat,m,n,nz) if (info == 0) info = CSRGDeviceAlloc(a%deviceMat,m,n,nz)
if (info == 0) info = CSRGDeviceSetMatIndexBase(a%deviceMat,cusparse_index_base_one) if (info == 0) info = CSRGDeviceSetMatIndexBase(a%deviceMat,cusparse_index_base_one)
if (info == 0) then !!$ if (info == 0) then
if (a%is_unit()) then !!$ if (a%is_unit()) then
info = CSRGDeviceSetMatDiagType(a%deviceMat,cusparse_diag_type_unit) !!$ info = CSRGDeviceSetMatDiagType(a%deviceMat,cusparse_diag_type_unit)
else !!$ else
info = CSRGDeviceSetMatDiagType(a%deviceMat,cusparse_diag_type_non_unit) !!$ info = CSRGDeviceSetMatDiagType(a%deviceMat,cusparse_diag_type_non_unit)
end if !!$ end if
end if !!$ end if
if ((info == 0) .and. a%is_triangle()) then if ((info == 0) .and. a%is_triangle()) then
info = CSRGDeviceSetMatType(a%deviceMat,cusparse_matrix_type_triangular) !info = CSRGDeviceSetMatType(a%deviceMat,cusparse_matrix_type_triangular)
if ((info == 0).and.a%is_upper()) then if ((info == 0).and.a%is_upper()) then
info = CSRGDeviceSetMatFillMode(a%deviceMat,cusparse_fill_mode_upper) info = CSRGDeviceSetMatFillMode(a%deviceMat,cusparse_fill_mode_upper)
else else

@ -55,7 +55,7 @@ subroutine psb_s_cuda_csrg_to_gpu(a,info,nzrm)
if (c_associated(a%deviceMat%Mat)) then if (c_associated(a%deviceMat%Mat)) then
info = CSRGDeviceFree(a%deviceMat) info = CSRGDeviceFree(a%deviceMat)
end if end if
#if CUDA_SHORT_VERSION <= 10 #if (CUDA_SHORT_VERSION <= 10 )
if (a%is_unit()) then if (a%is_unit()) then
! !
! CUSPARSE has the habit of storing the diagonal and then ignoring, ! CUSPARSE has the habit of storing the diagonal and then ignoring,
@ -74,7 +74,7 @@ subroutine psb_s_cuda_csrg_to_gpu(a,info,nzrm)
!!! We are explicitly adding the diagonal !!! We are explicitly adding the diagonal
!! info = CSRGDeviceSetMatDiagType(a%deviceMat,cusparse_diag_type_non_unit) !! info = CSRGDeviceSetMatDiagType(a%deviceMat,cusparse_diag_type_non_unit)
if ((info == 0) .and. a%is_triangle()) then if ((info == 0) .and. a%is_triangle()) then
info = CSRGDeviceSetMatType(a%deviceMat,cusparse_matrix_type_triangular) !info = CSRGDeviceSetMatType(a%deviceMat,cusparse_matrix_type_triangular)
if ((info == 0).and.a%is_upper()) then if ((info == 0).and.a%is_upper()) then
info = CSRGDeviceSetMatFillMode(a%deviceMat,cusparse_fill_mode_upper) info = CSRGDeviceSetMatFillMode(a%deviceMat,cusparse_fill_mode_upper)
else else
@ -114,15 +114,15 @@ subroutine psb_s_cuda_csrg_to_gpu(a,info,nzrm)
if (info == 0) info = CSRGDeviceAlloc(a%deviceMat,m,n,nz) if (info == 0) info = CSRGDeviceAlloc(a%deviceMat,m,n,nz)
if (info == 0) info = CSRGDeviceSetMatIndexBase(a%deviceMat,cusparse_index_base_one) if (info == 0) info = CSRGDeviceSetMatIndexBase(a%deviceMat,cusparse_index_base_one)
if (info == 0) then !!$ if (info == 0) then
if (a%is_unit()) then !!$ if (a%is_unit()) then
info = CSRGDeviceSetMatDiagType(a%deviceMat,cusparse_diag_type_unit) !!$ info = CSRGDeviceSetMatDiagType(a%deviceMat,cusparse_diag_type_unit)
else !!$ else
info = CSRGDeviceSetMatDiagType(a%deviceMat,cusparse_diag_type_non_unit) !!$ info = CSRGDeviceSetMatDiagType(a%deviceMat,cusparse_diag_type_non_unit)
end if !!$ end if
end if !!$ end if
if ((info == 0) .and. a%is_triangle()) then if ((info == 0) .and. a%is_triangle()) then
info = CSRGDeviceSetMatType(a%deviceMat,cusparse_matrix_type_triangular) !info = CSRGDeviceSetMatType(a%deviceMat,cusparse_matrix_type_triangular)
if ((info == 0).and.a%is_upper()) then if ((info == 0).and.a%is_upper()) then
info = CSRGDeviceSetMatFillMode(a%deviceMat,cusparse_fill_mode_upper) info = CSRGDeviceSetMatFillMode(a%deviceMat,cusparse_fill_mode_upper)
else else

@ -55,7 +55,7 @@ subroutine psb_z_cuda_csrg_to_gpu(a,info,nzrm)
if (c_associated(a%deviceMat%Mat)) then if (c_associated(a%deviceMat%Mat)) then
info = CSRGDeviceFree(a%deviceMat) info = CSRGDeviceFree(a%deviceMat)
end if end if
#if CUDA_SHORT_VERSION <= 10 #if (CUDA_SHORT_VERSION <= 10 )
if (a%is_unit()) then if (a%is_unit()) then
! !
! CUSPARSE has the habit of storing the diagonal and then ignoring, ! CUSPARSE has the habit of storing the diagonal and then ignoring,
@ -74,7 +74,7 @@ subroutine psb_z_cuda_csrg_to_gpu(a,info,nzrm)
!!! We are explicitly adding the diagonal !!! We are explicitly adding the diagonal
!! info = CSRGDeviceSetMatDiagType(a%deviceMat,cusparse_diag_type_non_unit) !! info = CSRGDeviceSetMatDiagType(a%deviceMat,cusparse_diag_type_non_unit)
if ((info == 0) .and. a%is_triangle()) then if ((info == 0) .and. a%is_triangle()) then
info = CSRGDeviceSetMatType(a%deviceMat,cusparse_matrix_type_triangular) !info = CSRGDeviceSetMatType(a%deviceMat,cusparse_matrix_type_triangular)
if ((info == 0).and.a%is_upper()) then if ((info == 0).and.a%is_upper()) then
info = CSRGDeviceSetMatFillMode(a%deviceMat,cusparse_fill_mode_upper) info = CSRGDeviceSetMatFillMode(a%deviceMat,cusparse_fill_mode_upper)
else else
@ -114,15 +114,15 @@ subroutine psb_z_cuda_csrg_to_gpu(a,info,nzrm)
if (info == 0) info = CSRGDeviceAlloc(a%deviceMat,m,n,nz) if (info == 0) info = CSRGDeviceAlloc(a%deviceMat,m,n,nz)
if (info == 0) info = CSRGDeviceSetMatIndexBase(a%deviceMat,cusparse_index_base_one) if (info == 0) info = CSRGDeviceSetMatIndexBase(a%deviceMat,cusparse_index_base_one)
if (info == 0) then !!$ if (info == 0) then
if (a%is_unit()) then !!$ if (a%is_unit()) then
info = CSRGDeviceSetMatDiagType(a%deviceMat,cusparse_diag_type_unit) !!$ info = CSRGDeviceSetMatDiagType(a%deviceMat,cusparse_diag_type_unit)
else !!$ else
info = CSRGDeviceSetMatDiagType(a%deviceMat,cusparse_diag_type_non_unit) !!$ info = CSRGDeviceSetMatDiagType(a%deviceMat,cusparse_diag_type_non_unit)
end if !!$ end if
end if !!$ end if
if ((info == 0) .and. a%is_triangle()) then if ((info == 0) .and. a%is_triangle()) then
info = CSRGDeviceSetMatType(a%deviceMat,cusparse_matrix_type_triangular) !info = CSRGDeviceSetMatType(a%deviceMat,cusparse_matrix_type_triangular)
if ((info == 0).and.a%is_upper()) then if ((info == 0).and.a%is_upper()) then
info = CSRGDeviceSetMatFillMode(a%deviceMat,cusparse_fill_mode_upper) info = CSRGDeviceSetMatFillMode(a%deviceMat,cusparse_fill_mode_upper)
else else

Loading…
Cancel
Save