mirror of
https://github.com/sfilippone/psblas3.git
synced 2026-10-07 07:04:57 +00:00
Attempt at fixing CSRG in CUDA 10.2. Not complete yet.
This commit is contained in:
@@ -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_;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user