diff --git a/examples/fileread/mld_cexample_1lev.f90 b/examples/fileread/mld_cexample_1lev.f90 index 171fd99d..e839dd1c 100644 --- a/examples/fileread/mld_cexample_1lev.f90 +++ b/examples/fileread/mld_cexample_1lev.f90 @@ -82,7 +82,8 @@ program mld_cexample_ml integer :: ictxt, iam, np ! other variables - integer :: i,info,j,m_problem,amatsize,descsize,precsize + integer :: i,info,j,m_problem + integer(psb_long_int_k_) :: amatsize, precsize, descsize integer :: ierr, ircode real(psb_dpk_) :: t1, t2, tprec real(psb_spk_) :: resmx, resmxp @@ -186,7 +187,7 @@ program mld_cexample_ml if (iam==psb_root_) then write(*,'(" ")') - write(*,'("Time to read and partition matrix : ",es10.4)')t2 + write(*,'("Time to read and partition matrix : ",es12.5)')t2 write(*,'(" ")') end if @@ -247,16 +248,16 @@ program mld_cexample_ml write(*,'("Matrix: ",A)')mtrx_file write(*,'("Computed solution on ",i8," processors")')np write(*,'("Iterations to convergence : ",i6)')iter - write(*,'("Error estimate on exit : ",es10.4)')err - write(*,'("Time to build prec. : ",es10.4)')tprec - write(*,'("Time to solve system : ",es10.4)')t2 - write(*,'("Time per iteration : ",es10.4)')t2/(iter) - write(*,'("Total time : ",es10.4)')t2+tprec - write(*,'("Residual 2-norm : ",es10.4)')resmx - write(*,'("Residual inf-norm : ",es10.4)')resmxp - write(*,'("Total memory occupation for A : ",i10)')amatsize - write(*,'("Total memory occupation for DESC_A : ",i10)')descsize - write(*,'("Total memory occupation for PREC : ",i10)')precsize + write(*,'("Error estimate on exit : ",es12.5)')err + write(*,'("Time to build prec. : ",es12.5)')tprec + write(*,'("Time to solve system : ",es12.5)')t2 + write(*,'("Time per iteration : ",es12.5)')t2/(iter) + write(*,'("Total time : ",es12.5)')t2+tprec + write(*,'("Residual 2-norm : ",es12.5)')resmx + write(*,'("Residual inf-norm : ",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 end if allocate(x_glob(m_problem),r_glob(m_problem),stat=ierr) diff --git a/examples/fileread/mld_cexample_ml.f90 b/examples/fileread/mld_cexample_ml.f90 index 2396058a..e297ddb5 100644 --- a/examples/fileread/mld_cexample_ml.f90 +++ b/examples/fileread/mld_cexample_ml.f90 @@ -86,8 +86,9 @@ program mld_cexample_ml ! other variables integer :: choice - integer :: i,info,j,m_problem,amatsize,descsize,precsize + integer :: i,info,j,m_problem integer :: ierr, ircode + integer(psb_long_int_k_) :: amatsize, precsize, descsize real(psb_dpk_) :: t1, t2, tprec real(psb_spk_) :: resmx, resmxp character(len=20) :: name @@ -190,7 +191,7 @@ program mld_cexample_ml if (iam==psb_root_) then write(*,'(" ")') - write(*,'("Time to read and partition matrix : ",es10.4)')t2 + write(*,'("Time to read and partition matrix : ",es12.5)')t2 write(*,'(" ")') end if @@ -284,16 +285,16 @@ program mld_cexample_ml write(*,'("Matrix: ",A)')mtrx_file write(*,'("Computed solution on ",i8," processors")')np write(*,'("Iterations to convergence : ",i6)')iter - write(*,'("Error estimate on exit : ",es10.4)')err - write(*,'("Time to build prec. : ",es10.4)')tprec - write(*,'("Time to solve system : ",es10.4)')t2 - write(*,'("Time per iteration : ",es10.4)')t2/(iter) - write(*,'("Total time : ",es10.4)')t2+tprec - write(*,'("Residual 2-norm : ",es10.4)')resmx - write(*,'("Residual inf-norm : ",es10.4)')resmxp - write(*,'("Total memory occupation for A : ",i10)')amatsize - write(*,'("Total memory occupation for DESC_A : ",i10)')descsize - write(*,'("Total memory occupation for PREC : ",i10)')precsize + write(*,'("Error estimate on exit : ",es12.5)')err + write(*,'("Time to build prec. : ",es12.5)')tprec + write(*,'("Time to solve system : ",es12.5)')t2 + write(*,'("Time per iteration : ",es12.5)')t2/(iter) + write(*,'("Total time : ",es12.5)')t2+tprec + write(*,'("Residual 2-norm : ",es12.5)')resmx + write(*,'("Residual inf-norm : ",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 end if allocate(x_glob(m_problem),r_glob(m_problem),stat=ierr) diff --git a/examples/fileread/mld_dexample_1lev.f90 b/examples/fileread/mld_dexample_1lev.f90 index 73ecc9ac..0b8f4179 100644 --- a/examples/fileread/mld_dexample_1lev.f90 +++ b/examples/fileread/mld_dexample_1lev.f90 @@ -82,7 +82,8 @@ program mld_dexample_ml integer :: ictxt, iam, np ! other variables - integer :: i,info,j,m_problem,amatsize,descsize,precsize + integer :: i,info,j,m_problem + integer(psb_long_int_k_) :: amatsize, precsize, descsize integer :: ierr, ircode real(psb_dpk_) :: t1, t2, tprec, resmx, resmxp character(len=20) :: name @@ -185,7 +186,7 @@ program mld_dexample_ml if (iam==psb_root_) then write(*,'(" ")') - write(*,'("Time to read and partition matrix : ",es10.4)')t2 + write(*,'("Time to read and partition matrix : ",es12.5)')t2 write(*,'(" ")') end if @@ -246,16 +247,16 @@ program mld_dexample_ml write(*,'("Matrix: ",A)')mtrx_file write(*,'("Computed solution on ",i8," processors")')np write(*,'("Iterations to convergence : ",i6)')iter - write(*,'("Error estimate on exit : ",es10.4)')err - write(*,'("Time to build prec. : ",es10.4)')tprec - write(*,'("Time to solve system : ",es10.4)')t2 - write(*,'("Time per iteration : ",es10.4)')t2/(iter) - write(*,'("Total time : ",es10.4)')t2+tprec - write(*,'("Residual 2-norm : ",es10.4)')resmx - write(*,'("Residual inf-norm : ",es10.4)')resmxp - write(*,'("Total memory occupation for A : ",i10)')amatsize - write(*,'("Total memory occupation for DESC_A : ",i10)')descsize - write(*,'("Total memory occupation for PREC : ",i10)')precsize + write(*,'("Error estimate on exit : ",es12.5)')err + write(*,'("Time to build prec. : ",es12.5)')tprec + write(*,'("Time to solve system : ",es12.5)')t2 + write(*,'("Time per iteration : ",es12.5)')t2/(iter) + write(*,'("Total time : ",es12.5)')t2+tprec + write(*,'("Residual 2-norm : ",es12.5)')resmx + write(*,'("Residual inf-norm : ",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 end if allocate(x_glob(m_problem),r_glob(m_problem),stat=ierr) diff --git a/examples/fileread/mld_dexample_ml.f90 b/examples/fileread/mld_dexample_ml.f90 index 84b756db..b94147c1 100644 --- a/examples/fileread/mld_dexample_ml.f90 +++ b/examples/fileread/mld_dexample_ml.f90 @@ -86,7 +86,8 @@ program mld_dexample_ml ! other variables integer :: choice - integer :: i,info,j,m_problem,amatsize,descsize,precsize + integer :: i,info,j,m_problem + integer(psb_long_int_k_) :: amatsize, precsize, descsize integer :: ierr, ircode real(psb_dpk_) :: t1, t2, tprec, resmx, resmxp character(len=20) :: name @@ -189,7 +190,7 @@ program mld_dexample_ml if (iam==psb_root_) then write(*,'(" ")') - write(*,'("Time to read and partition matrix : ",es10.4)')t2 + write(*,'("Time to read and partition matrix : ",es12.5)')t2 write(*,'(" ")') end if @@ -283,16 +284,16 @@ program mld_dexample_ml write(*,'("Matrix: ",A)')mtrx_file write(*,'("Computed solution on ",i8," processors")')np write(*,'("Iterations to convergence : ",i6)')iter - write(*,'("Error estimate on exit : ",es10.4)')err - write(*,'("Time to build prec. : ",es10.4)')tprec - write(*,'("Time to solve system : ",es10.4)')t2 - write(*,'("Time per iteration : ",es10.4)')t2/(iter) - write(*,'("Total time : ",es10.4)')t2+tprec - write(*,'("Residual 2-norm : ",es10.4)')resmx - write(*,'("Residual inf-norm : ",es10.4)')resmxp - write(*,'("Total memory occupation for A : ",i10)')amatsize - write(*,'("Total memory occupation for DESC_A : ",i10)')descsize - write(*,'("Total memory occupation for PREC : ",i10)')precsize + write(*,'("Error estimate on exit : ",es12.5)')err + write(*,'("Time to build prec. : ",es12.5)')tprec + write(*,'("Time to solve system : ",es12.5)')t2 + write(*,'("Time per iteration : ",es12.5)')t2/(iter) + write(*,'("Total time : ",es12.5)')t2+tprec + write(*,'("Residual 2-norm : ",es12.5)')resmx + write(*,'("Residual inf-norm : ",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 end if allocate(x_glob(m_problem),r_glob(m_problem),stat=ierr) diff --git a/examples/fileread/mld_sexample_1lev.f90 b/examples/fileread/mld_sexample_1lev.f90 index e3e916cf..d2db0dc6 100644 --- a/examples/fileread/mld_sexample_1lev.f90 +++ b/examples/fileread/mld_sexample_1lev.f90 @@ -82,7 +82,8 @@ program mld_sexample_ml integer :: ictxt, iam, np ! other variables - integer :: i,info,j,m_problem,amatsize,descsize,precsize + integer :: i,info,j,m_problem + integer(psb_long_int_k_) :: amatsize, precsize, descsize integer :: ierr, ircode real(psb_dpk_) :: t1, t2, tprec real(psb_spk_) :: resmx, resmxp @@ -186,7 +187,7 @@ program mld_sexample_ml if (iam==psb_root_) then write(*,'(" ")') - write(*,'("Time to read and partition matrix : ",es10.4)')t2 + write(*,'("Time to read and partition matrix : ",es12.5)')t2 write(*,'(" ")') end if @@ -247,16 +248,16 @@ program mld_sexample_ml write(*,'("Matrix: ",A)')mtrx_file write(*,'("Computed solution on ",i8," processors")')np write(*,'("Iterations to convergence : ",i6)')iter - write(*,'("Error estimate on exit : ",es10.4)')err - write(*,'("Time to build prec. : ",es10.4)')tprec - write(*,'("Time to solve system : ",es10.4)')t2 - write(*,'("Time per iteration : ",es10.4)')t2/(iter) - write(*,'("Total time : ",es10.4)')t2+tprec - write(*,'("Residual 2-norm : ",es10.4)')resmx - write(*,'("Residual inf-norm : ",es10.4)')resmxp - write(*,'("Total memory occupation for A : ",i10)')amatsize - write(*,'("Total memory occupation for DESC_A : ",i10)')descsize - write(*,'("Total memory occupation for PREC : ",i10)')precsize + write(*,'("Error estimate on exit : ",es12.5)')err + write(*,'("Time to build prec. : ",es12.5)')tprec + write(*,'("Time to solve system : ",es12.5)')t2 + write(*,'("Time per iteration : ",es12.5)')t2/(iter) + write(*,'("Total time : ",es12.5)')t2+tprec + write(*,'("Residual 2-norm : ",es12.5)')resmx + write(*,'("Residual inf-norm : ",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 end if allocate(x_glob(m_problem),r_glob(m_problem),stat=ierr) diff --git a/examples/fileread/mld_sexample_ml.f90 b/examples/fileread/mld_sexample_ml.f90 index 01d90ad7..0df93e68 100644 --- a/examples/fileread/mld_sexample_ml.f90 +++ b/examples/fileread/mld_sexample_ml.f90 @@ -86,7 +86,8 @@ program mld_sexample_ml ! other variables integer :: choice - integer :: i,info,j,m_problem,amatsize,descsize,precsize + integer :: i,info,j,m_problem + integer(psb_long_int_k_) :: amatsize, precsize, descsize integer :: ierr, ircode real(psb_dpk_) :: t1, t2, tprec real(psb_spk_) :: resmx, resmxp @@ -190,7 +191,7 @@ program mld_sexample_ml if (iam==psb_root_) then write(*,'(" ")') - write(*,'("Time to read and partition matrix : ",es10.4)')t2 + write(*,'("Time to read and partition matrix : ",es12.5)')t2 write(*,'(" ")') end if @@ -284,16 +285,16 @@ program mld_sexample_ml write(*,'("Matrix: ",A)')mtrx_file write(*,'("Computed solution on ",i8," processors")')np write(*,'("Iterations to convergence : ",i6)')iter - write(*,'("Error estimate on exit : ",es10.4)')err - write(*,'("Time to build prec. : ",es10.4)')tprec - write(*,'("Time to solve system : ",es10.4)')t2 - write(*,'("Time per iteration : ",es10.4)')t2/(iter) - write(*,'("Total time : ",es10.4)')t2+tprec - write(*,'("Residual 2-norm : ",es10.4)')resmx - write(*,'("Residual inf-norm : ",es10.4)')resmxp - write(*,'("Total memory occupation for A : ",i10)')amatsize - write(*,'("Total memory occupation for DESC_A : ",i10)')descsize - write(*,'("Total memory occupation for PREC : ",i10)')precsize + write(*,'("Error estimate on exit : ",es12.5)')err + write(*,'("Time to build prec. : ",es12.5)')tprec + write(*,'("Time to solve system : ",es12.5)')t2 + write(*,'("Time per iteration : ",es12.5)')t2/(iter) + write(*,'("Total time : ",es12.5)')t2+tprec + write(*,'("Residual 2-norm : ",es12.5)')resmx + write(*,'("Residual inf-norm : ",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 end if allocate(x_glob(m_problem),r_glob(m_problem),stat=ierr) diff --git a/examples/fileread/mld_zexample_1lev.f90 b/examples/fileread/mld_zexample_1lev.f90 index e6b1c854..05ae2ec0 100644 --- a/examples/fileread/mld_zexample_1lev.f90 +++ b/examples/fileread/mld_zexample_1lev.f90 @@ -82,7 +82,8 @@ program mld_zexample_ml integer :: ictxt, iam, np ! other variables - integer :: i,info,j,m_problem,amatsize,descsize,precsize + integer :: i,info,j,m_problem + integer(psb_long_int_k_) :: amatsize, precsize, descsize integer :: ierr, ircode real(psb_dpk_) :: t1, t2, tprec, resmx, resmxp character(len=20) :: name @@ -185,7 +186,7 @@ program mld_zexample_ml if (iam==psb_root_) then write(*,'(" ")') - write(*,'("Time to read and partition matrix : ",es10.4)')t2 + write(*,'("Time to read and partition matrix : ",es12.5)')t2 write(*,'(" ")') end if @@ -246,16 +247,16 @@ program mld_zexample_ml write(*,'("Matrix: ",A)')mtrx_file write(*,'("Computed solution on ",i8," processors")')np write(*,'("Iterations to convergence : ",i6)')iter - write(*,'("Error estimate on exit : ",es10.4)')err - write(*,'("Time to build prec. : ",es10.4)')tprec - write(*,'("Time to solve system : ",es10.4)')t2 - write(*,'("Time per iteration : ",es10.4)')t2/(iter) - write(*,'("Total time : ",es10.4)')t2+tprec - write(*,'("Residual 2-norm : ",es10.4)')resmx - write(*,'("Residual inf-norm : ",es10.4)')resmxp - write(*,'("Total memory occupation for A : ",i10)')amatsize - write(*,'("Total memory occupation for DESC_A : ",i10)')descsize - write(*,'("Total memory occupation for PREC : ",i10)')precsize + write(*,'("Error estimate on exit : ",es12.5)')err + write(*,'("Time to build prec. : ",es12.5)')tprec + write(*,'("Time to solve system : ",es12.5)')t2 + write(*,'("Time per iteration : ",es12.5)')t2/(iter) + write(*,'("Total time : ",es12.5)')t2+tprec + write(*,'("Residual 2-norm : ",es12.5)')resmx + write(*,'("Residual inf-norm : ",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 end if allocate(x_glob(m_problem),r_glob(m_problem),stat=ierr) diff --git a/examples/fileread/mld_zexample_ml.f90 b/examples/fileread/mld_zexample_ml.f90 index 52f24bb6..bfea0f50 100644 --- a/examples/fileread/mld_zexample_ml.f90 +++ b/examples/fileread/mld_zexample_ml.f90 @@ -86,7 +86,8 @@ program mld_zexample_ml ! other variables integer :: choice - integer :: i,info,j,m_problem,amatsize,descsize,precsize + integer :: i,info,j,m_problem + integer(psb_long_int_k_) :: amatsize, precsize, descsize integer :: ierr, ircode real(psb_dpk_) :: t1, t2, tprec, resmx, resmxp character(len=20) :: name @@ -189,7 +190,7 @@ program mld_zexample_ml if (iam==psb_root_) then write(*,'(" ")') - write(*,'("Time to read and partition matrix : ",es10.4)')t2 + write(*,'("Time to read and partition matrix : ",es12.5)')t2 write(*,'(" ")') end if @@ -283,16 +284,16 @@ program mld_zexample_ml write(*,'("Matrix: ",A)')mtrx_file write(*,'("Computed solution on ",i8," processors")')np write(*,'("Iterations to convergence : ",i6)')iter - write(*,'("Error estimate on exit : ",es10.4)')err - write(*,'("Time to build prec. : ",es10.4)')tprec - write(*,'("Time to solve system : ",es10.4)')t2 - write(*,'("Time per iteration : ",es10.4)')t2/(iter) - write(*,'("Total time : ",es10.4)')t2+tprec - write(*,'("Residual 2-norm : ",es10.4)')resmx - write(*,'("Residual inf-norm : ",es10.4)')resmxp - write(*,'("Total memory occupation for A : ",i10)')amatsize - write(*,'("Total memory occupation for DESC_A : ",i10)')descsize - write(*,'("Total memory occupation for PREC : ",i10)')precsize + write(*,'("Error estimate on exit : ",es12.5)')err + write(*,'("Time to build prec. : ",es12.5)')tprec + write(*,'("Time to solve system : ",es12.5)')t2 + write(*,'("Time per iteration : ",es12.5)')t2/(iter) + write(*,'("Total time : ",es12.5)')t2+tprec + write(*,'("Residual 2-norm : ",es12.5)')resmx + write(*,'("Residual inf-norm : ",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 end if allocate(x_glob(m_problem),r_glob(m_problem),stat=ierr) diff --git a/examples/pdegen/mld_dexample_1lev.f90 b/examples/pdegen/mld_dexample_1lev.f90 index 69407721..f52404f9 100644 --- a/examples/pdegen/mld_dexample_1lev.f90 +++ b/examples/pdegen/mld_dexample_1lev.f90 @@ -101,7 +101,8 @@ program mld_dexample_1lev integer :: ictxt, iam, np ! other variables - integer :: i,info,j,amatsize,descsize,precsize + integer :: i,info,j + integer(psb_long_int_k_) :: amatsize, precsize, descsize integer :: idim, nlev, ierr, ircode real(psb_dpk_) :: t1, t2, tprec, resmx, resmxp character(len=20) :: name @@ -129,7 +130,7 @@ program mld_dexample_1lev call psb_barrier(ictxt) t1 = psb_wtime() - call create_matrix(idim,a,b,x,desc_a,part_block,ictxt,info) + call create_matrix(idim,a,b,x,desc_a,ictxt,info) call psb_barrier(ictxt) t2 = psb_wtime() - t1 if(info /= 0) then @@ -206,9 +207,9 @@ program mld_dexample_1lev write(*,'("Total time : ",es12.5)')t2+tprec write(*,'("Residual 2-norm : ",es12.5)')resmx write(*,'("Residual inf-norm : ",es12.5)')resmxp - write(*,'("Total memory occupation for A : ",i10)')amatsize - write(*,'("Total memory occupation for DESC_A : ",i10)')descsize - write(*,'("Total memory occupation for PREC : ",i10)')precsize + 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 end if call psb_gefree(b, desc_A,info) @@ -256,7 +257,7 @@ contains ! subroutine to allocate and fill in the coefficient matrix and ! the rhs ! - subroutine create_matrix(idim,a,b,xv,desc_a,parts,ictxt,info) + subroutine create_matrix(idim,a,b,xv,desc_a,ictxt,info) ! ! Discretize the partial diferential equation ! @@ -280,21 +281,12 @@ contains real(psb_dpk_), allocatable :: b(:),xv(:) type(psb_desc_type) :: desc_a integer :: ictxt, info - interface - ! .....user passed subroutine..... - subroutine parts(global_indx,n,np,pv,nv) - implicit none - integer, intent(in) :: global_indx, n, np - integer, intent(out) :: nv - integer, intent(out) :: pv(*) - end subroutine parts - end interface ! local variables type(psb_dspmat_type) :: a real(psb_dpk_) :: zt(nb),glob_x,glob_y,glob_z integer :: m,n,nnz,glob_row,nlr,i,ii,ib,k,ipoints integer :: x,y,z,ia,indx_owner - integer :: np, iam + integer :: np, iam, nr, nt integer :: element integer, allocatable :: irow(:),icol(:),myidx(:) real(psb_dpk_), allocatable :: val(:) @@ -326,9 +318,18 @@ contains nnz = ((n*9)/(np)) if(iam == psb_root_) write(0,'("Generating Matrix (size=",i0x,")...")')n + ! + ! Using a simple BLOCK distribution. + ! + nt = (m+np-1)/np + nr = min(nt,m-(iam*nt)) + + nt = nr + call psb_sum(ictxt,nt) + if (nt /= m) write(0,*) iam, 'Initialization error ',nr,nt,m call psb_barrier(ictxt) t0 = psb_wtime() - call psb_cdall(ictxt,desc_a,info,mg=n,parts=parts) + call psb_cdall(ictxt,desc_a,info,nl=nr) if (info == 0) call psb_spall(a,desc_a,info,nnz=nnz) ! define rhs from boundary conditions; also build initial guess if (info == 0) call psb_geall(b,desc_a,info) @@ -564,7 +565,7 @@ contains end if return end subroutine create_matrix -end program +end program mld_dexample_1lev ! ! functions parametrizing the differential equation ! diff --git a/examples/pdegen/mld_dexample_ml.f90 b/examples/pdegen/mld_dexample_ml.f90 index 43daa2c3..56eeb3de 100644 --- a/examples/pdegen/mld_dexample_ml.f90 +++ b/examples/pdegen/mld_dexample_ml.f90 @@ -104,7 +104,8 @@ program mld_dexample_ml ! other variables integer :: choice - integer :: i,info,j,amatsize,descsize,precsize + integer :: i,info,j + integer(psb_long_int_k_) :: amatsize, precsize, descsize integer :: idim, ierr, ircode real(psb_dpk_) :: t1, t2, tprec, resmx, resmxp character(len=20) :: name @@ -133,7 +134,7 @@ program mld_dexample_ml call psb_barrier(ictxt) t1 = psb_wtime() - call create_matrix(idim,A,b,x,desc_A,part_block,ictxt,info) + call create_matrix(idim,a,b,x,desc_a,ictxt,info) call psb_barrier(ictxt) t2 = psb_wtime() - t1 if(info /= 0) then @@ -242,9 +243,9 @@ program mld_dexample_ml write(*,'("Total time : ",es12.5)')t2+tprec write(*,'("Residual 2-norm : ",es12.5)')resmx write(*,'("Residual inf-norm : ",es12.5)')resmxp - write(*,'("Total memory occupation for A : ",i10)')amatsize - write(*,'("Total memory occupation for DESC_A : ",i10)')descsize - write(*,'("Total memory occupation for PREC : ",i10)')precsize + 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 end if call psb_gefree(b, desc_A,info) @@ -294,7 +295,7 @@ contains ! subroutine to allocate and fill in the coefficient matrix and ! the rhs ! - subroutine create_matrix(idim,a,b,xv,desc_a,parts,ictxt,info) + subroutine create_matrix(idim,a,b,xv,desc_a,ictxt,info) ! ! Discretize the partial diferential equation ! @@ -318,21 +319,12 @@ contains real(psb_dpk_), allocatable :: b(:),xv(:) type(psb_desc_type) :: desc_a integer :: ictxt, info - interface - ! .....user passed subroutine..... - subroutine parts(global_indx,n,np,pv,nv) - implicit none - integer, intent(in) :: global_indx, n, np - integer, intent(out) :: nv - integer, intent(out) :: pv(*) - end subroutine parts - end interface ! local variables type(psb_dspmat_type) :: a real(psb_dpk_) :: zt(nb),glob_x,glob_y,glob_z integer :: m,n,nnz,glob_row,nlr,i,ii,ib,k,ipoints integer :: x,y,z,ia,indx_owner - integer :: np, iam + integer :: np, iam, nr, nt integer :: element integer, allocatable :: irow(:),icol(:),myidx(:) real(psb_dpk_), allocatable :: val(:) @@ -364,9 +356,18 @@ contains nnz = ((n*9)/(np)) if(iam == psb_root_) write(0,'("Generating Matrix (size=",i0x,")...")')n + ! + ! Using a simple BLOCK distribution. + ! + nt = (m+np-1)/np + nr = min(nt,m-(iam*nt)) + + nt = nr + call psb_sum(ictxt,nt) + if (nt /= m) write(0,*) iam, 'Initialization error ',nr,nt,m call psb_barrier(ictxt) t0 = psb_wtime() - call psb_cdall(ictxt,desc_a,info,mg=n,parts=parts) + call psb_cdall(ictxt,desc_a,info,nl=nr) if (info == 0) call psb_spall(a,desc_a,info,nnz=nnz) ! define rhs from boundary conditions; also build initial guess if (info == 0) call psb_geall(b,desc_a,info) diff --git a/examples/pdegen/mld_sexample_1lev.f90 b/examples/pdegen/mld_sexample_1lev.f90 index 1824d9f8..fe6f5aeb 100644 --- a/examples/pdegen/mld_sexample_1lev.f90 +++ b/examples/pdegen/mld_sexample_1lev.f90 @@ -101,7 +101,8 @@ program mld_sexample_1lev integer :: ictxt, iam, np ! other variables - integer :: i,info,j,amatsize,descsize,precsize + integer :: i,info,j + integer(psb_long_int_k_) :: amatsize, precsize, descsize integer :: idim, nlev, ierr, ircode real(psb_dpk_) :: t1, t2, tprec real(psb_spk_) :: resmx, resmxp @@ -130,7 +131,7 @@ program mld_sexample_1lev call psb_barrier(ictxt) t1 = psb_wtime() - call create_matrix(idim,a,b,x,desc_a,part_block,ictxt,info) + call create_matrix(idim,a,b,x,desc_a,ictxt,info) call psb_barrier(ictxt) t2 = psb_wtime() - t1 if(info /= 0) then @@ -207,9 +208,9 @@ program mld_sexample_1lev write(*,'("Total time : ",es12.5)')t2+tprec write(*,'("Residual 2-norm : ",es12.5)')resmx write(*,'("Residual inf-norm : ",es12.5)')resmxp - write(*,'("Total memory occupation for A : ",i10)')amatsize - write(*,'("Total memory occupation for DESC_A : ",i10)')descsize - write(*,'("Total memory occupation for PREC : ",i10)')precsize + 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 end if call psb_gefree(b, desc_A,info) @@ -257,7 +258,7 @@ contains ! subroutine to allocate and fill in the coefficient matrix and ! the rhs ! - subroutine create_matrix(idim,a,b,xv,desc_a,parts,ictxt,info) + subroutine create_matrix(idim,a,b,xv,desc_a,ictxt,info) ! ! Discretize the partial diferential equation ! @@ -281,21 +282,12 @@ contains real(psb_spk_), allocatable :: b(:),xv(:) type(psb_desc_type) :: desc_a integer :: ictxt, info - interface - ! .....user passed subroutine..... - subroutine parts(global_indx,n,np,pv,nv) - implicit none - integer, intent(in) :: global_indx, n, np - integer, intent(out) :: nv - integer, intent(out) :: pv(*) - end subroutine parts - end interface ! local variables type(psb_sspmat_type) :: a real(psb_spk_) :: zt(nb),glob_x,glob_y,glob_z integer :: m,n,nnz,glob_row,nlr,i,ii,ib,k,ipoints integer :: x,y,z,ia,indx_owner - integer :: np, iam + integer :: np, iam, nr, nt integer :: element integer, allocatable :: irow(:),icol(:),myidx(:) real(psb_spk_), allocatable :: val(:) @@ -327,9 +319,18 @@ contains nnz = ((n*9)/(np)) if(iam == psb_root_) write(0,'("Generating Matrix (size=",i0x,")...")')n + ! + ! Using a simple BLOCK distribution. + ! + nt = (m+np-1)/np + nr = min(nt,m-(iam*nt)) + + nt = nr + call psb_sum(ictxt,nt) + if (nt /= m) write(0,*) iam, 'Initialization error ',nr,nt,m call psb_barrier(ictxt) t0 = psb_wtime() - call psb_cdall(ictxt,desc_a,info,mg=n,parts=parts) + call psb_cdall(ictxt,desc_a,info,nl=nr) if (info == 0) call psb_spall(a,desc_a,info,nnz=nnz) ! define rhs from boundary conditions; also build initial guess if (info == 0) call psb_geall(b,desc_a,info) diff --git a/examples/pdegen/mld_sexample_ml.f90 b/examples/pdegen/mld_sexample_ml.f90 index a089f06d..721be329 100644 --- a/examples/pdegen/mld_sexample_ml.f90 +++ b/examples/pdegen/mld_sexample_ml.f90 @@ -104,7 +104,8 @@ program mld_sexample_ml ! other variables integer :: choice - integer :: i,info,j,amatsize,descsize,precsize + integer :: i,info,j + integer(psb_long_int_k_) :: amatsize, precsize, descsize integer :: idim, ierr, ircode real(psb_dpk_) :: t1, t2, tprec real(psb_spk_) :: resmx, resmxp @@ -134,7 +135,7 @@ program mld_sexample_ml call psb_barrier(ictxt) t1 = psb_wtime() - call create_matrix(idim,a,b,x,desc_a,part_block,ictxt,info) + call create_matrix(idim,a,b,x,desc_a,ictxt,info) call psb_barrier(ictxt) t2 = psb_wtime() - t1 if(info /= 0) then @@ -243,9 +244,9 @@ program mld_sexample_ml write(*,'("Total time : ",es12.5)')t2+tprec write(*,'("Residual 2-norm : ",es12.5)')resmx write(*,'("Residual inf-norm : ",es12.5)')resmxp - write(*,'("Total memory occupation for A : ",i10)')amatsize - write(*,'("Total memory occupation for DESC_A : ",i10)')descsize - write(*,'("Total memory occupation for PREC : ",i10)')precsize + 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 end if call psb_gefree(b, desc_A,info) @@ -295,7 +296,7 @@ contains ! subroutine to allocate and fill in the coefficient matrix and ! the rhs ! - subroutine create_matrix(idim,a,b,xv,desc_a,parts,ictxt,info) + subroutine create_matrix(idim,a,b,xv,desc_a,ictxt,info) ! ! Discretize the partial diferential equation ! @@ -319,21 +320,12 @@ contains real(psb_spk_), allocatable :: b(:),xv(:) type(psb_desc_type) :: desc_a integer :: ictxt, info - interface - ! .....user passed subroutine..... - subroutine parts(global_indx,n,np,pv,nv) - implicit none - integer, intent(in) :: global_indx, n, np - integer, intent(out) :: nv - integer, intent(out) :: pv(*) - end subroutine parts - end interface ! local variables type(psb_sspmat_type) :: a real(psb_spk_) :: zt(nb),glob_x,glob_y,glob_z integer :: m,n,nnz,glob_row,nlr,i,ii,ib,k,ipoints integer :: x,y,z,ia,indx_owner - integer :: np, iam + integer :: np, iam, nr, nt integer :: element integer, allocatable :: irow(:),icol(:),myidx(:) real(psb_spk_), allocatable :: val(:) @@ -365,9 +357,18 @@ contains nnz = ((n*9)/(np)) if(iam == psb_root_) write(0,'("Generating Matrix (size=",i0x,")...")')n + ! + ! Using a simple BLOCK distribution. + ! + nt = (m+np-1)/np + nr = min(nt,m-(iam*nt)) + + nt = nr + call psb_sum(ictxt,nt) + if (nt /= m) write(0,*) iam, 'Initialization error ',nr,nt,m call psb_barrier(ictxt) t0 = psb_wtime() - call psb_cdall(ictxt,desc_a,info,mg=n,parts=parts) + call psb_cdall(ictxt,desc_a,info,nl=nr) if (info == 0) call psb_spall(a,desc_a,info,nnz=nnz) ! define rhs from boundary conditions; also build initial guess if (info == 0) call psb_geall(b,desc_a,info) diff --git a/mlprec/mld_prec_type.f90 b/mlprec/mld_prec_type.f90 index e6010fc4..2129bdf3 100644 --- a/mlprec/mld_prec_type.f90 +++ b/mlprec/mld_prec_type.f90 @@ -65,10 +65,11 @@ module mld_prec_type use psb_base_mod, only :& & psb_dspmat_type, psb_zspmat_type,& & psb_sspmat_type, psb_cspmat_type,& - & psb_desc_type, psb_inter_desc_type, psb_sizeof, psb_dpk_, psb_spk_,& + & psb_desc_type, psb_inter_desc_type,& + & psb_dpk_, psb_spk_, psb_long_int_k_, & & psb_sp_free, psb_cdfree, psb_halo_, psb_none_, psb_sum_, psb_avg_, & & psb_nohalo_, psb_square_root_, psb_toupper, psb_root_,& - & psb_sizeof_int, psb_sizeof_sp, psb_sizeof_dp, psb_sizeof,& + & psb_sizeof_int, psb_sizeof_long_int, psb_sizeof_sp, psb_sizeof_dp, psb_sizeof,& & psb_cd_get_context, psb_info ! @@ -507,71 +508,67 @@ contains ! Function returning the size of the mld_prec_type data structure ! - function mld_sprec_sizeof(prec) + function mld_sprec_sizeof(prec) result(val) implicit none type(mld_sprec_type), intent(in) :: prec - integer :: mld_sprec_sizeof - integer :: val,i + integer(psb_long_int_k_) :: val + integer :: i val = 0 if (allocated(prec%baseprecv)) then do i=1, size(prec%baseprecv) val = val + mld_sizeof(prec%baseprecv(i)) end do end if - mld_sprec_sizeof = val end function mld_sprec_sizeof - function mld_dprec_sizeof(prec) + function mld_dprec_sizeof(prec) result(val) implicit none type(mld_dprec_type), intent(in) :: prec - integer :: mld_dprec_sizeof - integer :: val,i + integer(psb_long_int_k_) :: val + integer :: i val = 0 if (allocated(prec%baseprecv)) then do i=1, size(prec%baseprecv) val = val + mld_sizeof(prec%baseprecv(i)) end do end if - mld_dprec_sizeof = val end function mld_dprec_sizeof - function mld_cprec_sizeof(prec) + function mld_cprec_sizeof(prec) result(val) implicit none type(mld_cprec_type), intent(in) :: prec - integer :: mld_cprec_sizeof - integer :: val,i + integer(psb_long_int_k_) :: val + integer :: i val = 0 if (allocated(prec%baseprecv)) then do i=1, size(prec%baseprecv) val = val + mld_sizeof(prec%baseprecv(i)) end do end if - mld_cprec_sizeof = val end function mld_cprec_sizeof - function mld_zprec_sizeof(prec) + function mld_zprec_sizeof(prec) result(val) implicit none type(mld_zprec_type), intent(in) :: prec - integer :: mld_zprec_sizeof - integer :: val,i - val = 8 + integer(psb_long_int_k_) :: val + integer :: i + val = 0 if (allocated(prec%baseprecv)) then do i=1, size(prec%baseprecv) val = val + mld_sizeof(prec%baseprecv(i)) end do end if - mld_zprec_sizeof = val end function mld_zprec_sizeof ! ! Function returning the size of the mld_baseprc_type data structure ! - function mld_sbaseprc_sizeof(prec) + function mld_sbaseprc_sizeof(prec) result(val) implicit none type(mld_sbaseprc_type), intent(in) :: prec - integer :: mld_sbaseprc_sizeof - integer :: val,i + integer(psb_long_int_k_) :: val + integer :: i val = 0 if (allocated(prec%iprcparm)) then @@ -599,16 +596,14 @@ contains end do end if val = val + psb_sizeof(prec%map_desc) - - mld_sbaseprc_sizeof = val end function mld_sbaseprc_sizeof - function mld_dbaseprc_sizeof(prec) + function mld_dbaseprc_sizeof(prec) result(val) implicit none type(mld_dbaseprc_type), intent(in) :: prec - integer :: mld_dbaseprc_sizeof - integer :: val,i + integer(psb_long_int_k_) :: val + integer :: i val = 0 if (allocated(prec%iprcparm)) then @@ -637,15 +632,13 @@ contains end if val = val + psb_sizeof(prec%map_desc) - mld_dbaseprc_sizeof = val - end function mld_dbaseprc_sizeof - function mld_cbaseprc_sizeof(prec) + function mld_cbaseprc_sizeof(prec) result(val) implicit none type(mld_cbaseprc_type), intent(in) :: prec - integer :: mld_cbaseprc_sizeof - integer :: val,i + integer(psb_long_int_k_) :: val + integer :: i val = 0 if (allocated(prec%iprcparm)) then @@ -674,15 +667,13 @@ contains end if val = val + psb_sizeof(prec%map_desc) - mld_cbaseprc_sizeof = val - end function mld_cbaseprc_sizeof - function mld_zbaseprc_sizeof(prec) + function mld_zbaseprc_sizeof(prec) result(val) implicit none type(mld_zbaseprc_type), intent(in) :: prec - integer :: mld_zbaseprc_sizeof - integer :: val,i + integer(psb_long_int_k_) :: val + integer :: i val = 0 if (allocated(prec%iprcparm)) then @@ -711,8 +702,6 @@ contains end if val = val + psb_sizeof(prec%map_desc) - mld_zbaseprc_sizeof = val - end function mld_zbaseprc_sizeof ! diff --git a/tests/fileread/cf_sample.f90 b/tests/fileread/cf_sample.f90 index 06dde492..fd6b5f47 100644 --- a/tests/fileread/cf_sample.f90 +++ b/tests/fileread/cf_sample.f90 @@ -91,7 +91,8 @@ program cf_sample ! solver paramters integer :: iter, itmax, ierr, itrace, ircode, ipart,& - & methd, istopc, irst,amatsize,precsize,descsize, nlv + & methd, istopc, irst, nlv + integer(psb_long_int_k_) :: amatsize, precsize, descsize real(psb_spk_) :: err, eps character(len=5) :: afmt @@ -235,7 +236,7 @@ program cf_sample if (iam==psb_root_) then write(*,'(" ")') - write(*,'("Time to read and partition matrix : ",es10.4)')t2 + write(*,'("Time to read and partition matrix : ",es12.5)')t2 write(*,'(" ")') write(*,*) 'Preconditioner: ',prec_choice%descr end if @@ -281,7 +282,7 @@ program cf_sample call psb_amx(ictxt, tprec) if(iam==psb_root_) then - write(*,'("Preconditioner time: ",es10.4)')tprec + write(*,'("Preconditioner time: ",es12.5)')tprec write(*,'(" ")') end if @@ -310,16 +311,16 @@ program cf_sample write(*,'("Matrix: ",a)')mtrx_file write(*,'("Computed solution on ",i8," processors")')np write(*,'("Iterations to convergence : ",i6)')iter - write(*,'("Error estimate on exit : ",es10.4)')err - write(*,'("Time to buil prec. : ",es10.4)')tprec - write(*,'("Time to solve matrix : ",es10.4)')t2 - write(*,'("Time per iteration : ",es10.4)')t2/(iter) - write(*,'("Total time : ",es10.4)')t2+tprec - write(*,'("Residual norm 2 : ",es10.4)')resmx - write(*,'("Residual norm inf : ",es10.4)')resmxp - write(*,'("Total memory occupation for A : ",i10)')amatsize - write(*,'("Total memory occupation for DESC_A : ",i10)')descsize - write(*,'("Total memory occupation for PREC : ",i10)')precsize + 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 end if allocate(x_col_glob(m_problem),r_col_glob(m_problem),stat=ierr) diff --git a/tests/fileread/df_sample.f90 b/tests/fileread/df_sample.f90 index c4aa58ed..939c1121 100644 --- a/tests/fileread/df_sample.f90 +++ b/tests/fileread/df_sample.f90 @@ -91,7 +91,8 @@ program df_sample ! solver paramters integer :: iter, itmax, ierr, itrace, ircode, ipart,& - & methd, istopc, irst,amatsize,precsize,descsize, nlv + & methd, istopc, irst, nlv + integer(psb_long_int_k_) :: amatsize, precsize, descsize real(psb_dpk_) :: err, eps character(len=5) :: afmt @@ -235,7 +236,7 @@ program df_sample if (iam==psb_root_) then write(*,'(" ")') - write(*,'("Time to read and partition matrix : ",es10.4)')t2 + write(*,'("Time to read and partition matrix : ",es12.5)')t2 write(*,'(" ")') write(*,*) 'Preconditioner: ',prec_choice%descr end if @@ -281,7 +282,7 @@ program df_sample call psb_amx(ictxt, tprec) if(iam==psb_root_) then - write(*,'("Preconditioner time: ",es10.4)')tprec + write(*,'("Preconditioner time: ",es12.5)')tprec write(*,'(" ")') end if @@ -310,16 +311,16 @@ program df_sample write(*,'("Matrix: ",a)')mtrx_file write(*,'("Computed solution on ",i8," processors")')np write(*,'("Iterations to convergence : ",i6)')iter - write(*,'("Error estimate on exit : ",es10.4)')err - write(*,'("Time to buil prec. : ",es10.4)')tprec - write(*,'("Time to solve matrix : ",es10.4)')t2 - write(*,'("Time per iteration : ",es10.4)')t2/(iter) - write(*,'("Total time : ",es10.4)')t2+tprec - write(*,'("Residual norm 2 : ",es10.4)')resmx - write(*,'("Residual norm inf : ",es10.4)')resmxp - write(*,'("Total memory occupation for A : ",i10)')amatsize - write(*,'("Total memory occupation for DESC_A : ",i10)')descsize - write(*,'("Total memory occupation for PREC : ",i10)')precsize + 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 end if allocate(x_col_glob(m_problem),r_col_glob(m_problem),stat=ierr) diff --git a/tests/fileread/sf_sample.f90 b/tests/fileread/sf_sample.f90 index a6bf71a6..d39243ae 100644 --- a/tests/fileread/sf_sample.f90 +++ b/tests/fileread/sf_sample.f90 @@ -91,7 +91,8 @@ program sf_sample ! solver paramters integer :: iter, itmax, ierr, itrace, ircode, ipart,& - & methd, istopc, irst,amatsize,precsize,descsize, nlv + & methd, istopc, irst, nlv + integer(psb_long_int_k_) :: amatsize, precsize, descsize real(psb_spk_) :: err, eps character(len=5) :: afmt @@ -235,7 +236,7 @@ program sf_sample if (iam==psb_root_) then write(*,'(" ")') - write(*,'("Time to read and partition matrix : ",es10.4)')t2 + write(*,'("Time to read and partition matrix : ",es12.5)')t2 write(*,'(" ")') write(*,*) 'Preconditioner: ',prec_choice%descr end if @@ -281,7 +282,7 @@ program sf_sample call psb_amx(ictxt, tprec) if(iam==psb_root_) then - write(*,'("Preconditioner time: ",es10.4)')tprec + write(*,'("Preconditioner time: ",es12.5)')tprec write(*,'(" ")') end if @@ -310,16 +311,16 @@ program sf_sample write(*,'("Matrix: ",a)')mtrx_file write(*,'("Computed solution on ",i8," processors")')np write(*,'("Iterations to convergence : ",i6)')iter - write(*,'("Error estimate on exit : ",es10.4)')err - write(*,'("Time to buil prec. : ",es10.4)')tprec - write(*,'("Time to solve matrix : ",es10.4)')t2 - write(*,'("Time per iteration : ",es10.4)')t2/(iter) - write(*,'("Total time : ",es10.4)')t2+tprec - write(*,'("Residual norm 2 : ",es10.4)')resmx - write(*,'("Residual norm inf : ",es10.4)')resmxp - write(*,'("Total memory occupation for A : ",i10)')amatsize - write(*,'("Total memory occupation for DESC_A : ",i10)')descsize - write(*,'("Total memory occupation for PREC : ",i10)')precsize + 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 end if allocate(x_col_glob(m_problem),r_col_glob(m_problem),stat=ierr) diff --git a/tests/fileread/zf_sample.f90 b/tests/fileread/zf_sample.f90 index 2bde9cc6..d8951322 100644 --- a/tests/fileread/zf_sample.f90 +++ b/tests/fileread/zf_sample.f90 @@ -91,7 +91,8 @@ program zf_sample ! solver paramters integer :: iter, itmax, ierr, itrace, ircode, ipart,& - & methd, istopc, irst,amatsize,precsize,descsize, nlv + & methd, istopc, irst, nlv + integer(psb_long_int_k_) :: amatsize, precsize, descsize real(psb_dpk_) :: err, eps character(len=5) :: afmt @@ -235,7 +236,7 @@ program zf_sample if (iam==psb_root_) then write(*,'(" ")') - write(*,'("Time to read and partition matrix : ",es10.4)')t2 + write(*,'("Time to read and partition matrix : ",es12.5)')t2 write(*,'(" ")') write(*,*) 'Preconditioner: ',prec_choice%descr end if @@ -281,7 +282,7 @@ program zf_sample call psb_amx(ictxt, tprec) if(iam==psb_root_) then - write(*,'("Preconditioner time: ",es10.4)')tprec + write(*,'("Preconditioner time: ",es12.5)')tprec write(*,'(" ")') end if @@ -310,16 +311,16 @@ program zf_sample write(*,'("Matrix: ",a)')mtrx_file write(*,'("Computed solution on ",i8," processors")')np write(*,'("Iterations to convergence : ",i6)')iter - write(*,'("Error estimate on exit : ",es10.4)')err - write(*,'("Time to buil prec. : ",es10.4)')tprec - write(*,'("Time to solve matrix : ",es10.4)')t2 - write(*,'("Time per iteration : ",es10.4)')t2/(iter) - write(*,'("Total time : ",es10.4)')t2+tprec - write(*,'("Residual norm 2 : ",es10.4)')resmx - write(*,'("Residual norm inf : ",es10.4)')resmxp - write(*,'("Total memory occupation for A : ",i10)')amatsize - write(*,'("Total memory occupation for DESC_A : ",i10)')descsize - write(*,'("Total memory occupation for PREC : ",i10)')precsize + 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 end if allocate(x_col_glob(m_problem),r_col_glob(m_problem),stat=ierr) diff --git a/tests/pdegen/ppde.f90 b/tests/pdegen/ppde.f90 index 3efb902f..caa80fe1 100644 --- a/tests/pdegen/ppde.f90 +++ b/tests/pdegen/ppde.f90 @@ -97,6 +97,7 @@ program ppde ! solver parameters integer :: iter, itmax,itrace, istopc, irst, nlv + integer(psb_long_int_k_) :: amatsize, precsize, descsize real(psb_dpk_) :: err, eps type precdata @@ -152,7 +153,7 @@ program ppde call psb_barrier(ictxt) t1 = psb_wtime() - call create_matrix(idim,a,b,x,desc_a,part_block,ictxt,afmt,info) + call create_matrix(idim,a,b,x,desc_a,ictxt,afmt,info) call psb_barrier(ictxt) t2 = psb_wtime() - t1 if(info /= 0) then @@ -233,6 +234,12 @@ program ppde t2 = psb_wtime() - t1 call psb_amx(ictxt,t2) + amatsize = psb_sizeof(a) + descsize = psb_sizeof(desc_a) + precsize = mld_sizeof(prec) + call psb_sum(ictxt,amatsize) + call psb_sum(ictxt,descsize) + call psb_sum(ictxt,precsize) if (iam == psb_root_) then write(*,'(" ")') write(*,'("Time to solve matrix : ",es12.5)')t2 @@ -240,6 +247,9 @@ program ppde write(*,'("Number of iterations : ",i0)')iter write(*,'("Convergence indicator on exit : ",es12.5)')err write(*,'("Info on exit : ",i0)')info + 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 end if ! @@ -382,7 +392,7 @@ contains ! subroutine to allocate and fill in the coefficient matrix and ! the rhs. ! - subroutine create_matrix(idim,a,b,xv,desc_a,parts,ictxt,afmt,info) + subroutine create_matrix(idim,a,b,xv,desc_a,ictxt,afmt,info) ! ! discretize the partial diferential equation ! @@ -407,20 +417,11 @@ contains type(psb_desc_type) :: desc_a integer :: ictxt, info character :: afmt*5 - interface - ! .....user passed subroutine..... - subroutine parts(global_indx,n,np,pv,nv) - implicit none - integer, intent(in) :: global_indx, n, np - integer, intent(out) :: nv - integer, intent(out) :: pv(*) - end subroutine parts - end interface ! local variables type(psb_dspmat_type) :: a real(psb_dpk_) :: zt(nb),glob_x,glob_y,glob_z integer :: m,n,nnz,glob_row,nlr,i,ii,ib,k integer :: x,y,z,ia,indx_owner - integer :: np, iam + integer :: np, iam, nr, nt integer :: element integer, allocatable :: irow(:),icol(:),myidx(:) real(psb_dpk_), allocatable :: val(:) @@ -451,9 +452,18 @@ contains nnz = ((n*9)/(np)) if(iam == psb_root_) write(0,'("Generating Matrix (size=",i0x,")...")')n + ! + ! Using a simple BLOCK distribution. + ! + nt = (m+np-1)/np + nr = min(nt,m-(iam*nt)) + + nt = nr + call psb_sum(ictxt,nt) + if (nt /= m) write(0,*) iam, 'Initialization error ',nr,nt,m call psb_barrier(ictxt) t0 = psb_wtime() - call psb_cdall(ictxt,desc_a,info,mg=n,parts=parts) + call psb_cdall(ictxt,desc_a,info,nl=nr) if (info == 0) call psb_spall(a,desc_a,info,nnz=nnz) ! define rhs from boundary conditions; also build initial guess if (info == 0) call psb_geall(b,desc_a,info) diff --git a/tests/pdegen/spde.f90 b/tests/pdegen/spde.f90 index 14b4286c..f8ffc16c 100644 --- a/tests/pdegen/spde.f90 +++ b/tests/pdegen/spde.f90 @@ -97,6 +97,7 @@ program spde ! solver parameters integer :: iter, itmax,itrace, istopc, irst, nlv + integer(psb_long_int_k_) :: amatsize, precsize, descsize real(psb_spk_) :: err, eps type precdata @@ -152,7 +153,7 @@ program spde call psb_barrier(ictxt) t1 = psb_wtime() - call create_matrix(idim,a,b,x,desc_a,part_block,ictxt,afmt,info) + call create_matrix(idim,a,b,x,desc_a,ictxt,afmt,info) call psb_barrier(ictxt) t2 = psb_wtime() - t1 if(info /= 0) then @@ -233,6 +234,12 @@ program spde t2 = psb_wtime() - t1 call psb_amx(ictxt,t2) + amatsize = psb_sizeof(a) + descsize = psb_sizeof(desc_a) + precsize = mld_sizeof(prec) + call psb_sum(ictxt,amatsize) + call psb_sum(ictxt,descsize) + call psb_sum(ictxt,precsize) if (iam == psb_root_) then write(*,'(" ")') write(*,'("Time to solve matrix : ",es12.5)')t2 @@ -240,6 +247,9 @@ program spde write(*,'("Number of iterations : ",i0)')iter write(*,'("Convergence indicator on exit : ",es12.5)')err write(*,'("Info on exit : ",i0)')info + 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 end if ! @@ -382,7 +392,7 @@ contains ! subroutine to allocate and fill in the coefficient matrix and ! the rhs. ! - subroutine create_matrix(idim,a,b,xv,desc_a,parts,ictxt,afmt,info) + subroutine create_matrix(idim,a,b,xv,desc_a,ictxt,afmt,info) ! ! discretize the partial diferential equation ! @@ -407,20 +417,11 @@ contains type(psb_desc_type) :: desc_a integer :: ictxt, info character :: afmt*5 - interface - ! .....user passed subroutine..... - subroutine parts(global_indx,n,np,pv,nv) - implicit none - integer, intent(in) :: global_indx, n, np - integer, intent(out) :: nv - integer, intent(out) :: pv(*) - end subroutine parts - end interface ! local variables type(psb_sspmat_type) :: a real(psb_spk_) :: zt(nb),glob_x,glob_y,glob_z integer :: m,n,nnz,glob_row,nlr,i,ii,ib,k integer :: x,y,z,ia,indx_owner - integer :: np, iam + integer :: np, iam, nr, nt integer :: element integer, allocatable :: irow(:),icol(:),myidx(:) real(psb_spk_), allocatable :: val(:) @@ -432,7 +433,6 @@ contains real(psb_spk_) :: a1, a2, a3, a4, b1, b2, b3 external :: a1, a2, a3, a4, b1, b2, b3 integer :: err_act - ! common area character(len=20) :: name, ch_err @@ -452,9 +452,18 @@ contains nnz = ((n*9)/(np)) if(iam == psb_root_) write(0,'("Generating Matrix (size=",i0x,")...")')n + ! + ! Using a simple BLOCK distribution. + ! + nt = (m+np-1)/np + nr = min(nt,m-(iam*nt)) + + nt = nr + call psb_sum(ictxt,nt) + if (nt /= m) write(0,*) iam, 'Initialization error ',nr,nt,m call psb_barrier(ictxt) t0 = psb_wtime() - call psb_cdall(ictxt,desc_a,info,mg=n,parts=parts) + call psb_cdall(ictxt,desc_a,info,nl=nr) if (info == 0) call psb_spall(a,desc_a,info,nnz=nnz) ! define rhs from boundary conditions; also build initial guess if (info == 0) call psb_geall(b,desc_a,info) @@ -607,9 +616,9 @@ contains val(element)=-b2(glob_x,glob_y,glob_z) val(element) = val(element)/(deltah*& & deltah) - icol(element)=(x-1)*idim*idim+(y)*idim+(z) + icol(element) = (x-1)*idim*idim+(y)*idim+(z) irow(element) = glob_row - element=element+1 + element = element+1 endif ! term depending on (x+1,y,z) if (x