|
|
|
@ -52,11 +52,13 @@ program zf_sample
|
|
|
|
|
character(len=20) :: descr ! verbose description of the prec
|
|
|
|
|
character(len=10) :: prec ! overall prectype
|
|
|
|
|
integer :: novr ! number of overlap layers
|
|
|
|
|
integer :: jsweeps ! Jacobi/smoother sweeps
|
|
|
|
|
character(len=16) :: restr ! restriction over application of AS
|
|
|
|
|
character(len=16) :: prol ! prolongation over application of AS
|
|
|
|
|
character(len=16) :: solve ! factorization type: ILU, SuperLU, UMFPACK
|
|
|
|
|
integer :: fill ! fillin for factorization
|
|
|
|
|
real(psb_dpk_) :: thr ! threshold for fact. ILU(T)
|
|
|
|
|
character(len=16) :: smther ! Smoother
|
|
|
|
|
integer :: nlev ! number of levels in multilevel prec.
|
|
|
|
|
character(len=16) :: aggrkind ! smoothed, raw aggregation
|
|
|
|
|
character(len=16) :: aggr_alg ! aggregation algorithm (currently only decoupled)
|
|
|
|
@ -103,8 +105,8 @@ program zf_sample
|
|
|
|
|
! other variables
|
|
|
|
|
integer :: i,info,j,m_problem
|
|
|
|
|
integer :: internal, m,ii,nnzero
|
|
|
|
|
real(psb_dpk_) :: t1, t2, tprec, r_amax, b_amax,&
|
|
|
|
|
&scale,resmx,resmxp
|
|
|
|
|
real(psb_dpk_) :: t1, t2, tprec
|
|
|
|
|
real(psb_dpk_) :: r_amax, b_amax, scale,resmx,resmxp
|
|
|
|
|
integer :: nrhs, nrow, n_row, dim, nv, ne
|
|
|
|
|
integer, allocatable :: ivg(:), ipv(:)
|
|
|
|
|
|
|
|
|
@ -153,24 +155,24 @@ program zf_sample
|
|
|
|
|
|
|
|
|
|
case default
|
|
|
|
|
info = -1
|
|
|
|
|
write(0,*) 'Wrong choice for fileformat ', filefmt
|
|
|
|
|
write(psb_err_unit,*) 'Wrong choice for fileformat ', filefmt
|
|
|
|
|
end select
|
|
|
|
|
if (info /= psb_success_) then
|
|
|
|
|
write(0,*) 'Error while reading input matrix '
|
|
|
|
|
write(psb_err_unit,*) 'Error while reading input matrix '
|
|
|
|
|
call psb_abort(ictxt)
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
m_problem = aux_a%m
|
|
|
|
|
m_problem = aux_a%get_nrows()
|
|
|
|
|
call psb_bcast(ictxt,m_problem)
|
|
|
|
|
|
|
|
|
|
! At this point aux_b may still be unallocated
|
|
|
|
|
if (psb_size(aux_b,dim=1) == m_problem) then
|
|
|
|
|
! if any rhs were present, broadcast the first one
|
|
|
|
|
write(0,'("Ok, got an rhs ")')
|
|
|
|
|
write(psb_err_unit,'("Ok, got an rhs ")')
|
|
|
|
|
b_col_glob =>aux_b(:,1)
|
|
|
|
|
else
|
|
|
|
|
write(*,'("Generating an rhs...")')
|
|
|
|
|
write(*,'(" ")')
|
|
|
|
|
write(psb_out_unit,'("Generating an rhs...")')
|
|
|
|
|
write(psb_out_unit,'(" ")')
|
|
|
|
|
call psb_realloc(m_problem,1,aux_b,ircode)
|
|
|
|
|
if (ircode /= 0) then
|
|
|
|
|
call psb_errpush(psb_err_alloc_dealloc_,name)
|
|
|
|
@ -197,7 +199,7 @@ program zf_sample
|
|
|
|
|
! switch over different partition types
|
|
|
|
|
if (ipart == 0) then
|
|
|
|
|
call psb_barrier(ictxt)
|
|
|
|
|
if (iam == psb_root_) write(*,'("Partition type: block")')
|
|
|
|
|
if (iam == psb_root_) write(psb_out_unit,'("Partition type: block")')
|
|
|
|
|
allocate(ivg(m_problem),ipv(np))
|
|
|
|
|
do i=1,m_problem
|
|
|
|
|
call part_block(i,m_problem,np,ipv,nv)
|
|
|
|
@ -207,19 +209,19 @@ program zf_sample
|
|
|
|
|
& desc_a,b_col_glob,b_col,info,fmt=afmt,v=ivg)
|
|
|
|
|
else if (ipart == 2) then
|
|
|
|
|
if (iam == psb_root_) then
|
|
|
|
|
write(*,'("Partition type: graph")')
|
|
|
|
|
write(*,'(" ")')
|
|
|
|
|
! write(0,'("Build type: graph")')
|
|
|
|
|
call build_mtpart(aux_a%m,aux_a%fida,aux_a%ia1,aux_a%ia2,np)
|
|
|
|
|
write(psb_out_unit,'("Partition type: graph")')
|
|
|
|
|
write(psb_out_unit,'(" ")')
|
|
|
|
|
! write(psb_err_unit,'("Build type: graph")')
|
|
|
|
|
call build_mtpart(aux_a,np)
|
|
|
|
|
endif
|
|
|
|
|
call psb_barrier(ictxt)
|
|
|
|
|
!!$ call psb_barrier(ictxt)
|
|
|
|
|
call distr_mtpart(psb_root_,ictxt)
|
|
|
|
|
call getv_mtpart(ivg)
|
|
|
|
|
call psb_matdist(aux_a, a, ictxt, &
|
|
|
|
|
& desc_a,b_col_glob,b_col,info,fmt=afmt,v=ivg)
|
|
|
|
|
else
|
|
|
|
|
if (iam == psb_root_) write(*,'("Partition type: block")')
|
|
|
|
|
call psb_matdist(aux_a, a, ictxt, &
|
|
|
|
|
if (iam == psb_root_) write(psb_out_unit,'("Partition type: block")')
|
|
|
|
|
call psb_matdist(aux_a, a, ictxt, &
|
|
|
|
|
& desc_a,b_col_glob,b_col,info,fmt=afmt,parts=part_block)
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
@ -235,27 +237,25 @@ program zf_sample
|
|
|
|
|
call psb_amx(ictxt, t2)
|
|
|
|
|
|
|
|
|
|
if (iam == psb_root_) then
|
|
|
|
|
write(*,'(" ")')
|
|
|
|
|
write(*,'("Time to read and partition matrix : ",es12.5)')t2
|
|
|
|
|
write(*,'(" ")')
|
|
|
|
|
write(*,*) 'Preconditioner: ',prec_choice%descr
|
|
|
|
|
write(psb_out_unit,'(" ")')
|
|
|
|
|
write(psb_out_unit,'("Time to read and partition matrix : ",es12.5)')t2
|
|
|
|
|
write(psb_out_unit,'(" ")')
|
|
|
|
|
write(psb_out_unit,*) 'Preconditioner: ',prec_choice%descr
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
|
|
|
|
|
|
if (psb_toupper(prec_choice%prec) == 'ML') then
|
|
|
|
|
nlv = prec_choice%nlev
|
|
|
|
|
else
|
|
|
|
|
nlv = 1
|
|
|
|
|
end if
|
|
|
|
|
call mld_precinit(prec,prec_choice%prec,info,nlev=nlv)
|
|
|
|
|
call mld_precset(prec,mld_sub_ovr_, prec_choice%novr, info)
|
|
|
|
|
call mld_precset(prec,mld_sub_restr_, prec_choice%restr,info)
|
|
|
|
|
call mld_precset(prec,mld_sub_prol_, prec_choice%prol, info)
|
|
|
|
|
call mld_precset(prec,mld_sub_solve_, prec_choice%solve,info)
|
|
|
|
|
call mld_precset(prec,mld_sub_fillin_,prec_choice%fill,info)
|
|
|
|
|
call mld_precset(prec,mld_sub_iluthrs_, prec_choice%thr, info)
|
|
|
|
|
if (psb_toupper(prec_choice%prec) == 'ML') then
|
|
|
|
|
call mld_precinit(prec,prec_choice%prec,info,nlev=nlv)
|
|
|
|
|
call mld_precset(prec,mld_smoother_type_, prec_choice%smther, info)
|
|
|
|
|
call mld_precset(prec,mld_smoother_sweeps_, prec_choice%jsweeps, info)
|
|
|
|
|
call mld_precset(prec,mld_sub_ovr_, prec_choice%novr, info)
|
|
|
|
|
call mld_precset(prec,mld_sub_restr_, prec_choice%restr, info)
|
|
|
|
|
call mld_precset(prec,mld_sub_prol_, prec_choice%prol, info)
|
|
|
|
|
call mld_precset(prec,mld_sub_solve_, prec_choice%solve, info)
|
|
|
|
|
call mld_precset(prec,mld_sub_fillin_, prec_choice%fill, info)
|
|
|
|
|
call mld_precset(prec,mld_sub_iluthrs_, prec_choice%thr, info)
|
|
|
|
|
call mld_precset(prec,mld_aggr_kind_, prec_choice%aggrkind,info)
|
|
|
|
|
call mld_precset(prec,mld_aggr_alg_, prec_choice%aggr_alg,info)
|
|
|
|
|
call mld_precset(prec,mld_ml_type_, prec_choice%mltype, info)
|
|
|
|
@ -267,6 +267,16 @@ program zf_sample
|
|
|
|
|
call mld_precset(prec,mld_coarse_fillin_, prec_choice%cfill, info)
|
|
|
|
|
call mld_precset(prec,mld_coarse_iluthrs_, prec_choice%cthres, info)
|
|
|
|
|
call mld_precset(prec,mld_coarse_sweeps_, prec_choice%cjswp, info)
|
|
|
|
|
else
|
|
|
|
|
nlv = 1
|
|
|
|
|
call mld_precinit(prec,prec_choice%prec,info)
|
|
|
|
|
call mld_precset(prec,mld_smoother_sweeps_, prec_choice%jsweeps, info)
|
|
|
|
|
call mld_precset(prec,mld_sub_ovr_, prec_choice%novr, info)
|
|
|
|
|
call mld_precset(prec,mld_sub_restr_, prec_choice%restr, info)
|
|
|
|
|
call mld_precset(prec,mld_sub_prol_, prec_choice%prol, info)
|
|
|
|
|
call mld_precset(prec,mld_sub_solve_, prec_choice%solve, info)
|
|
|
|
|
call mld_precset(prec,mld_sub_fillin_, prec_choice%fill, info)
|
|
|
|
|
call mld_precset(prec,mld_sub_iluthrs_, prec_choice%thr, info)
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
! building the preconditioner
|
|
|
|
@ -278,12 +288,11 @@ program zf_sample
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
call psb_amx(ictxt, tprec)
|
|
|
|
|
|
|
|
|
|
if(iam == psb_root_) then
|
|
|
|
|
write(*,'("Preconditioner time: ",es12.5)')tprec
|
|
|
|
|
write(*,'(" ")')
|
|
|
|
|
write(psb_out_unit,'("Preconditioner time: ",es12.5)')tprec
|
|
|
|
|
write(psb_out_unit,'(" ")')
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
iparm = 0
|
|
|
|
@ -308,36 +317,37 @@ program zf_sample
|
|
|
|
|
call psb_sum(ictxt,precsize)
|
|
|
|
|
if (iam == psb_root_) then
|
|
|
|
|
call mld_precdescr(prec,info)
|
|
|
|
|
write(*,'("Matrix: ",a)')mtrx_file
|
|
|
|
|
write(*,'("Computed solution on ",i8," processors")')np
|
|
|
|
|
write(*,'("Iterations to convergence : ",i6)')iter
|
|
|
|
|
write(*,'("Error estimate on exit : ",es12.5)')err
|
|
|
|
|
write(*,'("Time to buil prec. : ",es12.5)')tprec
|
|
|
|
|
write(*,'("Time to solve matrix : ",es12.5)')t2
|
|
|
|
|
write(*,'("Time per iteration : ",es12.5)')t2/(iter)
|
|
|
|
|
write(*,'("Total time : ",es12.5)')t2+tprec
|
|
|
|
|
write(*,'("Residual norm 2 : ",es12.5)')resmx
|
|
|
|
|
write(*,'("Residual norm inf : ",es12.5)')resmxp
|
|
|
|
|
write(*,'("Total memory occupation for A : ",i12)')amatsize
|
|
|
|
|
write(*,'("Total memory occupation for DESC_A : ",i12)')descsize
|
|
|
|
|
write(*,'("Total memory occupation for PREC : ",i12)')precsize
|
|
|
|
|
write(psb_out_unit,'("Matrix: ",a)')mtrx_file
|
|
|
|
|
write(psb_out_unit,'("Computed solution on ",i8," processors")')np
|
|
|
|
|
write(psb_out_unit,'("Iterations to convergence : ",i6)')iter
|
|
|
|
|
write(psb_out_unit,'("Error estimate on exit : ",es12.5)')err
|
|
|
|
|
write(psb_out_unit,'("Time to buil prec. : ",es12.5)')tprec
|
|
|
|
|
write(psb_out_unit,'("Time to solve matrix : ",es12.5)')t2
|
|
|
|
|
write(psb_out_unit,'("Time per iteration : ",es12.5)')t2/(iter)
|
|
|
|
|
write(psb_out_unit,'("Total time : ",es12.5)')t2+tprec
|
|
|
|
|
write(psb_out_unit,'("Residual norm 2 : ",es12.5)')resmx
|
|
|
|
|
write(psb_out_unit,'("Residual norm inf : ",es12.5)')resmxp
|
|
|
|
|
write(psb_out_unit,'("Total memory occupation for A : ",i12)')amatsize
|
|
|
|
|
write(psb_out_unit,'("Total memory occupation for DESC_A : ",i12)')descsize
|
|
|
|
|
write(psb_out_unit,'("Total memory occupation for PREC : ",i12)')precsize
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
allocate(x_col_glob(m_problem),r_col_glob(m_problem),stat=ierr)
|
|
|
|
|
if (ierr /= 0) then
|
|
|
|
|
write(0,*) 'allocation error: no data collection'
|
|
|
|
|
write(psb_err_unit,*) 'allocation error: no data collection'
|
|
|
|
|
else
|
|
|
|
|
call psb_gather(x_col_glob,x_col,desc_a,info,root=psb_root_)
|
|
|
|
|
call psb_gather(r_col_glob,r_col,desc_a,info,root=psb_root_)
|
|
|
|
|
if (iam == psb_root_) then
|
|
|
|
|
write(0,'(" ")')
|
|
|
|
|
write(0,'("Saving x on file")')
|
|
|
|
|
write(psb_err_unit,'(" ")')
|
|
|
|
|
write(psb_err_unit,'("Saving x on file")')
|
|
|
|
|
write(20,*) 'matrix: ',mtrx_file
|
|
|
|
|
write(20,*) 'computed solution on ',np,' processors.'
|
|
|
|
|
write(20,*) 'iterations to convergence: ',iter
|
|
|
|
|
write(20,*) 'error estimate (infinity norm) on exit:', &
|
|
|
|
|
& ' ||r||/(||a||||x||+||b||) = ',err
|
|
|
|
|
write(20,*) 'max residual = ',resmx, resmxp
|
|
|
|
|
write(20,'("Residual norm 2 : ",es12.5)')resmx
|
|
|
|
|
write(20,'("Residual norm inf : ",es12.5)')resmxp
|
|
|
|
|
write(20,'(a8,4(2x,a20))') 'I','X(I)','R(I)','B(I)'
|
|
|
|
|
do i=1,m_problem
|
|
|
|
|
write(20,998) i,x_col_glob(i),r_col_glob(i),b_col_glob(i)
|
|
|
|
@ -401,7 +411,9 @@ contains
|
|
|
|
|
call read_data(prec%solve,5) ! Factorization type: ILU, SuperLU, UMFPACK.
|
|
|
|
|
call read_data(prec%fill,5) ! Fill-in for factorization
|
|
|
|
|
call read_data(prec%thr,5) ! Threshold for fact. ILU(T)
|
|
|
|
|
call read_data(prec%jsweeps,5) ! Jacobi sweeps for PJAC
|
|
|
|
|
if (psb_toupper(prec%prec) == 'ML') then
|
|
|
|
|
call read_data(prec%smther,5) ! Smoother type.
|
|
|
|
|
call read_data(prec%nlev,5) ! Number of levels in multilevel prec.
|
|
|
|
|
call read_data(prec%aggrkind,5) ! smoothed/raw aggregatin
|
|
|
|
|
call read_data(prec%aggr_alg,5) ! local or global aggregation
|
|
|
|
@ -437,7 +449,9 @@ contains
|
|
|
|
|
call psb_bcast(icontxt,prec%solve) ! Factorization type: ILU, SuperLU, UMFPACK.
|
|
|
|
|
call psb_bcast(icontxt,prec%fill) ! Fill-in for factorization
|
|
|
|
|
call psb_bcast(icontxt,prec%thr) ! Threshold for fact. ILU(T)
|
|
|
|
|
call psb_bcast(icontxt,prec%jsweeps) ! Jacobi sweeps
|
|
|
|
|
if (psb_toupper(prec%prec) == 'ML') then
|
|
|
|
|
call psb_bcast(icontxt,prec%smther) ! Smoother type.
|
|
|
|
|
call psb_bcast(icontxt,prec%nlev) ! Number of levels in multilevel prec.
|
|
|
|
|
call psb_bcast(icontxt,prec%aggrkind) ! smoothed/raw aggregatin
|
|
|
|
|
call psb_bcast(icontxt,prec%aggr_alg) ! local or global aggregation
|
|
|
|
|