mirror of
https://github.com/sfilippone/psblas3.git
synced 2026-10-24 14:51:49 +00:00
Fixed bugs in matrix conversions, showing up in dense factors for
multilevel preconditioners.
This commit is contained in:
@@ -86,7 +86,7 @@ subroutine psb_dbaseprc_bld(a,desc_a,p,info,upd)
|
||||
use psb_const_mod
|
||||
implicit none
|
||||
|
||||
type(psb_dspmat_type), intent(in) :: a
|
||||
type(psb_dspmat_type), intent(inout) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
type(psb_dbaseprc_type), intent(inout) :: p
|
||||
integer, intent(out) :: info
|
||||
@@ -101,7 +101,7 @@ subroutine psb_dbaseprc_bld(a,desc_a,p,info,upd)
|
||||
use psb_const_mod
|
||||
implicit none
|
||||
|
||||
type(psb_dspmat_type), intent(in) :: a
|
||||
type(psb_dspmat_type), intent(inout) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
type(psb_dbaseprc_type), intent(inout) :: p
|
||||
integer, intent(out) :: info
|
||||
@@ -194,13 +194,14 @@ subroutine psb_dbaseprc_bld(a,desc_a,p,info,upd)
|
||||
& f_ilu_n_,is_legal_ml_fact)
|
||||
|
||||
if (debug) write(0,*)me, ': Calling PSB_ILU_BLD'
|
||||
|
||||
if (debug) call blacs_barrier(icontxt,'All')
|
||||
|
||||
select case(p%iprcparm(f_type_))
|
||||
|
||||
case(f_ilu_n_,f_ilu_e_)
|
||||
call psb_ilu_bld(a,desc_a,p,iupd,info)
|
||||
if(debug) write(0,*)me,': out of psb_ilu_bld'
|
||||
if (debug) call blacs_barrier(icontxt,'All')
|
||||
if(info /= 0) then
|
||||
info=4010
|
||||
ch_err='psb_ilu_bld'
|
||||
|
||||
@@ -160,6 +160,7 @@ subroutine psb_dilu_bld(a,desc_a,p,upd,info)
|
||||
t1= mpi_wtime()
|
||||
|
||||
if(debug) write(0,*)me,': calling psb_asmatbld',p%iprcparm(p_type_),p%iprcparm(n_ovr_)
|
||||
if (debug) call blacs_barrier(icontxt,'All')
|
||||
call psb_asmatbld(p%iprcparm(p_type_),p%iprcparm(n_ovr_),a,&
|
||||
& blck,desc_a,upd,p%desc_data,info)
|
||||
if(info/=0) then
|
||||
@@ -169,7 +170,8 @@ subroutine psb_dilu_bld(a,desc_a,p,upd,info)
|
||||
goto 9999
|
||||
end if
|
||||
t2= mpi_wtime()
|
||||
if(debug) write(0,*)me,': out of psb_asmatbld'
|
||||
if (debug) write(0,*)me,': out of psb_asmatbld'
|
||||
if (debug) call blacs_barrier(icontxt,'All')
|
||||
|
||||
if (associated(p%av)) then
|
||||
if (size(p%av) < bp_ilu_avsz) then
|
||||
@@ -189,6 +191,9 @@ subroutine psb_dilu_bld(a,desc_a,p,upd,info)
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
if (debug) write(0,*)me,': out spinfo',nztota
|
||||
if (debug) call blacs_barrier(icontxt,'All')
|
||||
|
||||
n_col = desc_a%matrix_data(psb_n_col_)
|
||||
nhalo = n_col-nrow_a
|
||||
n_row = p%desc_data%matrix_data(psb_n_row_)
|
||||
@@ -198,7 +203,7 @@ subroutine psb_dilu_bld(a,desc_a,p,upd,info)
|
||||
p%av(u_pr_)%m = n_row
|
||||
p%av(u_pr_)%k = n_row
|
||||
call psb_sp_all(n_row,n_row,p%av(l_pr_),nztota+lovr,info)
|
||||
call psb_sp_all(n_row,n_row,p%av(u_pr_),nztota+lovr,info)
|
||||
if (info == 0) call psb_sp_all(n_row,n_row,p%av(u_pr_),nztota+lovr,info)
|
||||
if(info/=0) then
|
||||
info=4010
|
||||
ch_err='psb_sp_all'
|
||||
@@ -305,6 +310,7 @@ subroutine psb_dilu_bld(a,desc_a,p,upd,info)
|
||||
|
||||
t5= mpi_wtime()
|
||||
if (debug) write(0,*) me,' Going for dilu_fct'
|
||||
if (debug) call blacs_barrier(icontxt,'All')
|
||||
call psb_ilu_fct(a,p%av(l_pr_),p%av(u_pr_),p%d,info,blck=blck)
|
||||
if(info/=0) then
|
||||
info=4010
|
||||
|
||||
@@ -87,7 +87,7 @@ subroutine psb_dprecbld(a,desc_a,p,info,upd)
|
||||
integer :: int_err(5)
|
||||
character :: iupd
|
||||
|
||||
logical, parameter :: debug=.false.
|
||||
logical, parameter :: debug=.false.
|
||||
integer,parameter :: iroot=0,iout=60,ilout=40
|
||||
character(len=20) :: name, ch_err
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ subroutine psb_dslu_bld(a,desc_a,p,info)
|
||||
use psb_const_mod
|
||||
implicit none
|
||||
|
||||
type(psb_dspmat_type), intent(in) :: a
|
||||
type(psb_dspmat_type), intent(inout) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
type(psb_dbaseprc_type), intent(inout) :: p
|
||||
integer, intent(out) :: info
|
||||
|
||||
+73
-69
@@ -42,7 +42,7 @@ subroutine psb_dumf_bld(a,desc_a,p,info)
|
||||
use psb_const_mod
|
||||
implicit none
|
||||
|
||||
type(psb_dspmat_type), intent(in) :: a
|
||||
type(psb_dspmat_type), intent(inout) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
type(psb_dbaseprc_type), intent(inout) :: p
|
||||
integer, intent(out) :: info
|
||||
@@ -69,7 +69,7 @@ subroutine psb_dumf_bld(a,desc_a,p,info)
|
||||
integer, intent(out) :: info
|
||||
character(len=5), optional :: outfmt
|
||||
end Subroutine psb_dasmatbld
|
||||
end interface
|
||||
end interface
|
||||
|
||||
info=0
|
||||
name='psb_umf_bld'
|
||||
@@ -84,118 +84,122 @@ subroutine psb_dumf_bld(a,desc_a,p,info)
|
||||
call psb_nullify_sp(atmp)
|
||||
atmp%fida='COO'
|
||||
if (Debug) then
|
||||
write(0,*) me, 'UMFBLD: Calling csdp'
|
||||
call blacs_barrier(icontxt,'All')
|
||||
write(0,*) me, 'UMFBLD: Calling csdp'
|
||||
call blacs_barrier(icontxt,'All')
|
||||
endif
|
||||
|
||||
call psb_dcsdp(a,atmp,info)
|
||||
if(info /= 0) then
|
||||
info=4010
|
||||
ch_err='psb_dcsdp'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
info=4010
|
||||
ch_err='psb_dcsdp'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
call psb_spinfo(psb_nztotreq_,atmp,nza,info)
|
||||
if (Debug) then
|
||||
write(0,*) me, 'UMFBLD: Done csdp',info,nza,atmp%m,atmp%k
|
||||
call blacs_barrier(icontxt,'All')
|
||||
call psb_spinfo(psb_nztotreq_,a,nzb,info)
|
||||
write(0,*) me, 'UMFBLD: Done csdp',info,nza,atmp%m,atmp%k,nzb
|
||||
call blacs_barrier(icontxt,'All')
|
||||
endif
|
||||
call psb_asmatbld(p%iprcparm(p_type_),p%iprcparm(n_ovr_),a,&
|
||||
& blck,desc_a,upd,p%desc_data,info,outfmt=fmt)
|
||||
if(info /= 0) then
|
||||
info=4010
|
||||
ch_err='psb_asmatbld'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
info=4010
|
||||
ch_err='psb_asmatbld'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call psb_spinfo(psb_nztotreq_,blck,nzb,info)
|
||||
if (Debug) then
|
||||
write(0,*) me, 'UMFBLD: Done asmatbld',info,nzb,blck%fida
|
||||
call blacs_barrier(icontxt,'All')
|
||||
write(0,*) me, 'UMFBLD: Done asmatbld',info,nzb,blck%fida
|
||||
call blacs_barrier(icontxt,'All')
|
||||
endif
|
||||
if (nzb > 0 ) then
|
||||
if (size(atmp%aspk)<nza+nzb) then
|
||||
call psb_sp_reall(atmp,nza+nzb,info)
|
||||
if(info /= 0) then
|
||||
info=4010
|
||||
ch_err='psb_sp_reall'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
endif
|
||||
if (Debug) then
|
||||
write(0,*) me, 'UMFBLD: Done realloc',info,nza+nzb,atmp%fida
|
||||
call blacs_barrier(icontxt,'All')
|
||||
endif
|
||||
if (size(atmp%aspk)<nza+nzb) then
|
||||
call psb_sp_reall(atmp,nza+nzb,info)
|
||||
if(info /= 0) then
|
||||
info=4010
|
||||
ch_err='psb_sp_reall'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
endif
|
||||
if (Debug) then
|
||||
write(0,*) me, 'UMFBLD: Done realloc',info,nza+nzb,atmp%fida
|
||||
call blacs_barrier(icontxt,'All')
|
||||
endif
|
||||
|
||||
do j=1,nzb
|
||||
atmp%aspk(nza+j) = blck%aspk(j)
|
||||
atmp%ia1(nza+j) = blck%ia1(j)
|
||||
atmp%ia2(nza+j) = blck%ia2(j)
|
||||
end do
|
||||
atmp%infoa(psb_nnz_) = nza+nzb
|
||||
atmp%m = atmp%m + blck%m
|
||||
atmp%k = max(a%k,blck%k)
|
||||
do j=1,nzb
|
||||
atmp%aspk(nza+j) = blck%aspk(j)
|
||||
atmp%ia1(nza+j) = blck%ia1(j)
|
||||
atmp%ia2(nza+j) = blck%ia2(j)
|
||||
end do
|
||||
atmp%infoa(psb_nnz_) = nza+nzb
|
||||
atmp%m = atmp%m + blck%m
|
||||
atmp%k = max(a%k,blck%k)
|
||||
else
|
||||
atmp%infoa(psb_nnz_) = nza
|
||||
atmp%m = a%m
|
||||
atmp%k = a%k
|
||||
atmp%infoa(psb_nnz_) = nza
|
||||
atmp%m = a%m
|
||||
atmp%k = a%k
|
||||
endif
|
||||
|
||||
i=0
|
||||
do j=1, atmp%infoa(psb_nnz_)
|
||||
if (atmp%ia2(j) <= atmp%m) then
|
||||
i = i + 1
|
||||
atmp%aspk(i) = atmp%aspk(j)
|
||||
atmp%ia1(i) = atmp%ia1(j)
|
||||
atmp%ia2(i) = atmp%ia2(j)
|
||||
endif
|
||||
if (atmp%ia2(j) <= atmp%m) then
|
||||
i = i + 1
|
||||
atmp%aspk(i) = atmp%aspk(j)
|
||||
atmp%ia1(i) = atmp%ia1(j)
|
||||
atmp%ia2(i) = atmp%ia2(j)
|
||||
endif
|
||||
enddo
|
||||
atmp%infoa(psb_nnz_) = i
|
||||
|
||||
|
||||
call psb_ipcoo2csc(atmp,info)
|
||||
if(info /= 0) then
|
||||
info=4010
|
||||
ch_err='psb_ipcoo2csc'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
info=4010
|
||||
ch_err='psb_ipcoo2csc'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
call psb_spinfo(psb_nztotreq_,atmp,nzt,info)
|
||||
if(info /= 0) then
|
||||
info=4010
|
||||
ch_err='psb_spinfo'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
info=4010
|
||||
ch_err='psb_spinfo'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
if (Debug) then
|
||||
write(0,*) me,'Calling psb_umf_factor ',nzt,atmp%m,&
|
||||
& atmp%k,p%desc_data%matrix_data(psb_n_row_)
|
||||
call blacs_barrier(icontxt,'All')
|
||||
write(0,*) me,'Calling psb_umf_factor ',nzt,atmp%m,&
|
||||
& atmp%k,p%desc_data%matrix_data(psb_n_row_)
|
||||
open(80+me)
|
||||
call psb_csprt(80+me,atmp)
|
||||
close(80+me)
|
||||
call blacs_barrier(icontxt,'All')
|
||||
endif
|
||||
|
||||
call psb_dumf_factor(atmp%m,nzt,&
|
||||
& atmp%aspk,atmp%ia1,atmp%ia2,&
|
||||
& p%iprcparm(umf_symptr_),p%iprcparm(umf_numptr_),info)
|
||||
if(info /= 0) then
|
||||
info=4010
|
||||
ch_err='psb_umf_fact'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
info=4010
|
||||
ch_err='psb_umf_fact'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
if (Debug) then
|
||||
write(0,*) me, 'UMFBLD: Done umf_Factor',info,p%iprcparm(umf_numptr_)
|
||||
call blacs_barrier(icontxt,'All')
|
||||
write(0,*) me, 'UMFBLD: Done umf_Factor',info,p%iprcparm(umf_numptr_)
|
||||
call blacs_barrier(icontxt,'All')
|
||||
endif
|
||||
call psb_sp_free(blck,info)
|
||||
call psb_sp_free(atmp,info)
|
||||
if(info /= 0) then
|
||||
info=4010
|
||||
ch_err='psb_sp_free'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
info=4010
|
||||
ch_err='psb_sp_free'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
@@ -204,8 +208,8 @@ subroutine psb_dumf_bld(a,desc_a,p,info)
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act.eq.act_abort) then
|
||||
call psb_error()
|
||||
return
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
|
||||
|
||||
@@ -141,11 +141,12 @@ psb_dumf_factor_(int *n, int *nnz,
|
||||
|
||||
if ( *info == UMFPACK_OK ) {
|
||||
*info = 0;
|
||||
*numptr = (fptr) Numeric;
|
||||
} else {
|
||||
printf("umfpack_di_numeric() error returns INFO= %d\n", *info);
|
||||
*numptr = (fptr) NULL;
|
||||
}
|
||||
|
||||
*numptr = (fptr) Numeric;
|
||||
for (i = 0; i <= *n; ++i) ++colptr[i];
|
||||
for (i = 0; i < *nnz; ++i) ++rowind[i];
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user