Fixed bugs in matrix conversions, showing up in dense factors for

multilevel preconditioners.
psblas3-type-indexed
Salvatore Filippone 19 years ago
parent c0526dd9d2
commit 8ca0d6fa93

@ -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

@ -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
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)
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)
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

@ -78,7 +78,7 @@ c
p1(1) = 0
p2(1) = 0
call psb_getifield(nnz,psb_nnz_,infon,psb_ifasize_,ierror)
call psb_getifield(nnz,psb_nnz_,info,psb_ifasize_,ierror)
if (debug) then
write(*,*) 'on entry to dcoco: nnz laux ',
+ nnz,laux,larn,lia1n,lia2n

@ -101,7 +101,7 @@ C ... Construct COO Representation...
ELEM = ELEM + 1
ENDDO
ENDDO
INFON(1) = IA2(M+1)-1
INFON(psb_nnz_) = IA2(M+1)-1
ELSE IF (DESCRA(1:1).EQ.'S' .AND. DESCRA(2:2).EQ.'U') THEN
DO 20 K = 1, M

@ -77,7 +77,7 @@ c
p1(1) = 0
p2(1) = 0
nnz = info(psb_nnz_)
call psb_getifield(nnz,psb_nnz_,info,psb_ifasize_,ierror)
if (debug) then
write(*,*) 'on entry to dcoco: nnz laux ',
+ nnz,laux,larn,lia1n,lia2n

@ -101,7 +101,7 @@ C ... Construct COO Representation...
ELEM = ELEM + 1
ENDDO
ENDDO
INFON(1) = IA2(M+1)-1
INFON(psb_nnz_) = IA2(M+1)-1
ELSE IF (DESCRA(1:1).EQ.'S' .AND. DESCRA(2:2).EQ.'U') THEN
DO 20 K = 1, M

@ -150,8 +150,6 @@ subroutine psb_dcsdp(a, b,info,ifc,check,trans,unitd,upd,dupl)
end if
if (check_/='R') then
if (present(upd)) then
@ -289,7 +287,11 @@ subroutine psb_dcsdp(a, b,info,ifc,check,trans,unitd,upd,dupl)
call psb_errpush(4010,name,a_err='dcrco')
goto 9999
end if
case default
info=4010
call psb_errpush(info,name)
goto 9999
end select
case ('COO','COI')
@ -376,17 +378,22 @@ subroutine psb_dcsdp(a, b,info,ifc,check,trans,unitd,upd,dupl)
goto 9999
end if
case default
info=4010
call psb_errpush(info,name)
goto 9999
end select
case default
info=4010
call psb_errpush(info,name)
goto 9999
end select
!!$ write(0,*) 'End of assembly', psb_sp_getifld(psb_upd_,b,info) ,psb_upd_perm_
if (psb_sp_getifld(psb_upd_,b,info) /= psb_upd_perm_) then
!!$ write(0,*) 'Going for trimsize',size(b%ia1),size(b%ia2),size(b%aspk)
call psb_sp_trimsize(b,i1,i2,ia,info)
!!$ write(0,*) 'From trimsize',i1,i2,ia,info
if (info == 0) call psb_sp_reall(b,i1,i2,ia,info)
!!$ write(0,*) 'From realloc',size(b%ia1),size(b%ia2),size(b%aspk)
endif
else if (check_=='R') then

@ -77,7 +77,9 @@ subroutine psb_dcsprt(iout,a,iv,eirs,eics,head,ivr,ivc)
write(iout,'(a)') '%'
endif
if (toupper(a%fida)=='CSR') then
select case(toupper(a%fida))
case ('CSR')
write(iout,*) a%m,a%k,a%ia2(a%m+1)-1
@ -115,7 +117,45 @@ subroutine psb_dcsprt(iout,a,iv,eirs,eics,head,ivr,ivc)
endif
endif
else if (toupper(a%fida)=='COO') then
case ('CSC')
write(iout,*) a%m,a%k,a%ia2(a%k+1)-1
if (present(iv)) then
do i=1, a%k
do j=a%ia2(i),a%ia2(i+1)-1
write(iout,frmtr) iv(irs+a%ia1(j)),iv(ics+i),a%aspk(j)
enddo
enddo
else
if (present(ivr).and..not.present(ivc)) then
do i=1, a%k
do j=a%ia2(i),a%ia2(i+1)-1
write(iout,frmtr) ivr(irs+a%ia1(j)),(ics+i),a%aspk(j)
enddo
enddo
else if (present(ivr).and.present(ivc)) then
do i=1, a%k
do j=a%ia2(i),a%ia2(i+1)-1
write(iout,frmtr) ivr(irs+a%ia1(j)),ivc(ics+i),a%aspk(j)
enddo
enddo
else if (.not.present(ivr).and.present(ivc)) then
do i=1, a%m
do j=a%ia2(i),a%ia2(i+1)-1
write(iout,frmtr) (irs+a%ia1(j)),ivc(ics+i),a%aspk(j)
enddo
enddo
else if (.not.present(ivr).and..not.present(ivc)) then
do i=1, a%k
do j=a%ia2(i),a%ia2(i+1)-1
write(iout,frmtr) (irs+a%ia1(j)),(ics+i),a%aspk(j)
enddo
enddo
endif
endif
case ('COO')
if (present(ivr).and..not.present(ivc)) then
write(iout,*) a%m,a%k,a%infoa(psb_nnz_)
@ -138,7 +178,7 @@ subroutine psb_dcsprt(iout,a,iv,eirs,eics,head,ivr,ivc)
write(iout,frmtr) a%ia1(j),a%ia2(j),a%aspk(j)
enddo
endif
else
case default
write(0,*) 'Feeling lazy today, format not implemented: "',a%fida,'"'
endif
end select
end subroutine psb_dcsprt

@ -101,7 +101,6 @@ subroutine psb_dipcoo2csc(a,info,clshr)
if (clshr_) then
j = 1
i = 1
icl = itemp(j)

@ -189,7 +189,6 @@ subroutine psb_zcsdp(a, b,info,ifc,check,trans,unitd,upd,dupl)
call psb_cest(b%fida, n_row,n_col,size_req,&
& ia1_size, ia2_size, aspk_size, upd_,info)
!!$ write(0,*) 'ESTIMATE : ',ia1_size,ia2_size,aspk_Size,upd_
if (info /= no_err) then
info=4010
ch_err='psb_cest'
@ -289,7 +288,11 @@ subroutine psb_zcsdp(a, b,info,ifc,check,trans,unitd,upd,dupl)
call psb_errpush(4010,name,a_err='dcrco')
goto 9999
end if
case default
info=4010
call psb_errpush(info,name)
goto 9999
end select
case ('COO','COI')
@ -365,8 +368,6 @@ subroutine psb_zcsdp(a, b,info,ifc,check,trans,unitd,upd,dupl)
end do
case ('COO')
call zcoco(trans_, a%m, a%k, unitd_, d, a%descra, a%aspk,&
@ -378,21 +379,27 @@ subroutine psb_zcsdp(a, b,info,ifc,check,trans,unitd,upd,dupl)
goto 9999
end if
case default
info=4010
call psb_errpush(info,name)
goto 9999
end select
case default
info=4010
call psb_errpush(info,name)
goto 9999
end select
!!$ write(0,*) 'End of assembly', psb_sp_getifld(psb_upd_,b,info) ,psb_upd_perm_
if (psb_sp_getifld(psb_upd_,b,info) /= psb_upd_perm_) then
!!$ write(0,*) 'Going for trimsize',size(b%ia1),size(b%ia2),size(b%aspk)
call psb_sp_trimsize(b,i1,i2,ia,info)
!!$ write(0,*) 'From trimsize',i1,i2,ia,info
if (info == 0) call psb_sp_reall(b,i1,i2,ia,info)
!!$ write(0,*) 'From realloc',size(b%ia1),size(b%ia2),size(b%aspk)
endif
else if (check_=='R') then
!...Regenerating matrix
if (psb_sp_getifld(psb_state_,b,info) /= psb_spmat_upd_) then
info = 8888
call psb_errpush(info,name)

Loading…
Cancel
Save