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

This commit is contained in:
Salvatore Filippone
2023-12-19 11:54:42 -05:00
parent 1bc2a884e2
commit 20a01d4d71
5 changed files with 47 additions and 46 deletions
+7 -6
View File
@@ -141,15 +141,16 @@ int T_spmvCSRGDevice(T_Cmat *Matrix, TYPE alpha, void *deviceX,
cusparseHandle_t *my_handle=getHandle();
TYPE ealpha=alpha, ebeta=beta;
#if CUDA_SHORT_VERSION <= 10
/*getAddrMultiVecDevice(deviceX, &vX);
getAddrMultiVecDevice(deviceY, &vY); */
/* getAddrMultiVecDevice(deviceX, &vX); */
/* getAddrMultiVecDevice(deviceY, &vY); */
vX=x->v_;
vY=y->v_;
return cusparseTcsrmv(*my_handle,CUSPARSE_OPERATION_NON_TRANSPOSE,
cMat->m,cMat->n,cMat->nz,(const TYPE *) &alpha,cMat->descr,
cMat->val, cMat->irp, cMat->ja,
(const TYPE *) vX, (const TYPE *) &beta, (TYPE *) vY);
CHECK_CUSPARSE(cusparseTcsrmv(*my_handle,CUSPARSE_OPERATION_NON_TRANSPOSE,
cMat->m,cMat->n,cMat->nz,(const TYPE *) &alpha,cMat->descr,
cMat->val, cMat->irp, cMat->ja,
(const TYPE *) vX, (const TYPE *) &beta, (TYPE *) vY));
#elif CUDA_VERSION < 11030
size_t bfsz;
vX=x->v_;
+10 -10
View File
@@ -55,7 +55,7 @@ subroutine psb_c_cuda_csrg_to_gpu(a,info,nzrm)
if (c_associated(a%deviceMat%Mat)) then
info = CSRGDeviceFree(a%deviceMat)
end if
#if CUDA_SHORT_VERSION <= 10
#if (CUDA_SHORT_VERSION <= 10 )
if (a%is_unit()) then
!
! 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
!! 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)
!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
@@ -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 = CSRGDeviceSetMatIndexBase(a%deviceMat,cusparse_index_base_one)
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 (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) .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
info = CSRGDeviceSetMatFillMode(a%deviceMat,cusparse_fill_mode_upper)
else
+10 -10
View File
@@ -55,7 +55,7 @@ subroutine psb_d_cuda_csrg_to_gpu(a,info,nzrm)
if (c_associated(a%deviceMat%Mat)) then
info = CSRGDeviceFree(a%deviceMat)
end if
#if CUDA_SHORT_VERSION <= 10
#if (CUDA_SHORT_VERSION <= 10 )
if (a%is_unit()) then
!
! 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
!! 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)
!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
@@ -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 = CSRGDeviceSetMatIndexBase(a%deviceMat,cusparse_index_base_one)
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 (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) .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
info = CSRGDeviceSetMatFillMode(a%deviceMat,cusparse_fill_mode_upper)
else
+10 -10
View File
@@ -55,7 +55,7 @@ subroutine psb_s_cuda_csrg_to_gpu(a,info,nzrm)
if (c_associated(a%deviceMat%Mat)) then
info = CSRGDeviceFree(a%deviceMat)
end if
#if CUDA_SHORT_VERSION <= 10
#if (CUDA_SHORT_VERSION <= 10 )
if (a%is_unit()) then
!
! 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
!! 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)
!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
@@ -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 = CSRGDeviceSetMatIndexBase(a%deviceMat,cusparse_index_base_one)
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 (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) .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
info = CSRGDeviceSetMatFillMode(a%deviceMat,cusparse_fill_mode_upper)
else
+10 -10
View File
@@ -55,7 +55,7 @@ subroutine psb_z_cuda_csrg_to_gpu(a,info,nzrm)
if (c_associated(a%deviceMat%Mat)) then
info = CSRGDeviceFree(a%deviceMat)
end if
#if CUDA_SHORT_VERSION <= 10
#if (CUDA_SHORT_VERSION <= 10 )
if (a%is_unit()) then
!
! 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
!! 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)
!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
@@ -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 = CSRGDeviceSetMatIndexBase(a%deviceMat,cusparse_index_base_one)
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 (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) .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
info = CSRGDeviceSetMatFillMode(a%deviceMat,cusparse_fill_mode_upper)
else