diff --git a/examples/fileread/mld_cexample_1lev.f90 b/examples/fileread/mld_cexample_1lev.f90 index 2ecca22a..7d34d95d 100644 --- a/examples/fileread/mld_cexample_1lev.f90 +++ b/examples/fileread/mld_cexample_1lev.f90 @@ -85,7 +85,7 @@ program mld_cexample_1lev integer :: ierr, ircode real(psb_spk_) :: resmx, resmxp real(psb_dpk_) :: t1, t2, tprec - character(len=20) :: name + character(len=20) :: name, kmethod integer, parameter :: iunit=12 ! initialize the parallel environment @@ -189,7 +189,7 @@ program mld_cexample_1lev end if -! START SETTING PARAMETER + ! START SETTING PARAMETER ! set RAS @@ -219,12 +219,13 @@ program mld_cexample_1lev call x%zero() call psb_geasb(x,desc_A,info) - ! solve Ax=b with preconditioned BiCGSTAB + ! solve Ax=b with preconditioned Krylov method: BiCGSTAB + kmethod = 'BiCGSTAB' call psb_barrier(ictxt) t1 = psb_wtime() - call psb_krylov('BiCGSTAB',A,P,b,x,tol,desc_A,info,itmax,iter,err,istop=2) + call psb_krylov(kmethod,A,P,b,x,tol,desc_A,info,itmax,iter,err,istop=2) t2 = psb_wtime() - t1 call psb_amx(ictxt,t2) @@ -247,6 +248,7 @@ program mld_cexample_1lev write(*,'(" ")') write(*,'("Matrix: ",A)')mtrx_file write(*,'("Computed solution on ",i8," processors")')np + write(*,'("Krylov method : ",a)') kmethod write(*,'("Iterations to convergence : ",i6)')iter write(*,'("Error estimate on exit : ",es12.5)')err write(*,'("Time to build prec. : ",es12.5)')tprec @@ -306,17 +308,35 @@ contains integer :: ictxt, itmax real(psb_spk_) :: tol character(len=*) :: mtrx, rhs,filefmt - integer :: iam, np + integer :: iam, np, inp_unit + character(len=1024) :: filename call psb_info(ictxt,iam,np) if (iam == psb_root_) then + if (command_argument_count()>0) then + call get_command_argument(1,filename) + inp_unit = 30 + open(inp_unit,file=filename,action='read',iostat=info) + if (info /= 0) then + write(psb_err_unit,*) 'Could not open file ',filename,' for input' + call psb_abort(ictxt) + stop + else + write(psb_err_unit,*) 'Opened file ',trim(filename),' for input' + end if + else + inp_unit=psb_inp_unit + end if ! read input parameters - call read_data(mtrx,5) - call read_data(rhs,5) - call read_data(filefmt,5) - call read_data(itmax,5) - call read_data(tol,5) + call read_data(mtrx,inp_unit) + call read_data(rhs,inp_unit) + call read_data(filefmt,inp_unit) + call read_data(itmax,inp_unit) + call read_data(tol,inp_unit) + if (inp_unit /= psb_inp_unit) then + close(inp_unit) + end if end if call psb_bcast(ictxt,mtrx) diff --git a/examples/fileread/mld_cexample_ml.f90 b/examples/fileread/mld_cexample_ml.f90 index 241b13d9..1f2535ed 100644 --- a/examples/fileread/mld_cexample_ml.f90 +++ b/examples/fileread/mld_cexample_ml.f90 @@ -292,6 +292,7 @@ program mld_cexample_ml write(*,'(" ")') write(*,'("Matrix: ",A)')mtrx_file write(*,'("Computed solution on ",i8," processors")')np + write(*,'("Krylov method : ",a)') kmethod write(*,'("Iterations to convergence : ",i6)')iter write(*,'("Error estimate on exit : ",es12.5)')err write(*,'("Time to build prec. : ",es12.5)')tprec @@ -351,18 +352,36 @@ contains integer :: ictxt, choice, itmax real(psb_spk_) :: tol character(len=*) :: mtrx, rhs,filefmt - integer :: iam, np + integer :: iam, np, inp_unit + character(len=1024) :: filename call psb_info(ictxt,iam,np) if (iam == psb_root_) then + if (command_argument_count()>0) then + call get_command_argument(1,filename) + inp_unit = 30 + open(inp_unit,file=filename,action='read',iostat=info) + if (info /= 0) then + write(psb_err_unit,*) 'Could not open file ',filename,' for input' + call psb_abort(ictxt) + stop + else + write(psb_err_unit,*) 'Opened file ',trim(filename),' for input' + end if + else + inp_unit=psb_inp_unit + end if ! read input parameters - call read_data(mtrx,5) - call read_data(rhs,5) - call read_data(filefmt,5) - call read_data(choice,5) - call read_data(itmax,5) - call read_data(tol,5) + call read_data(mtrx,inp_unit) + call read_data(rhs,inp_unit) + call read_data(filefmt,inp_unit) + call read_data(choice,inp_unit) + call read_data(itmax,inp_unit) + call read_data(tol,inp_unit) + if (inp_unit /= psb_inp_unit) then + close(inp_unit) + end if end if call psb_bcast(ictxt,mtrx) diff --git a/examples/fileread/mld_dexample_1lev.f90 b/examples/fileread/mld_dexample_1lev.f90 index 8a0bd716..a178f596 100644 --- a/examples/fileread/mld_dexample_1lev.f90 +++ b/examples/fileread/mld_dexample_1lev.f90 @@ -85,7 +85,7 @@ program mld_dexample_1lev integer :: ierr, ircode real(psb_dpk_) :: resmx, resmxp real(psb_dpk_) :: t1, t2, tprec - character(len=20) :: name + character(len=20) :: name, kmethod integer, parameter :: iunit=12 ! initialize the parallel environment @@ -189,19 +189,16 @@ program mld_dexample_1lev end if -! START SETTING PARAMETER + ! START SETTING PARAMETER ! set RAS -!!$ call P%init('AS',info) -!!$ -!!$ ! set number of overlaps -!!$ -!!$ call P%set('SUB_OVR',2,info) -!!$ - call P%init('FBGS',info) - !call prec%set('smoother_sweeps', p_choice%outer_sweeps, info) - + call P%init('AS',info) + + ! set number of overlaps + + call P%set('SUB_OVR',2,info) + ! build the preconditioner t1 = psb_wtime() @@ -222,12 +219,13 @@ program mld_dexample_1lev call x%zero() call psb_geasb(x,desc_A,info) - ! solve Ax=b with preconditioned BiCGSTAB + ! solve Ax=b with preconditioned Krylov method: BiCGSTAB + kmethod = 'BiCGSTAB' call psb_barrier(ictxt) t1 = psb_wtime() - call psb_krylov('BiCGSTAB',A,P,b,x,tol,desc_A,info,itmax,iter,err,istop=2) + call psb_krylov(kmethod,A,P,b,x,tol,desc_A,info,itmax,iter,err,istop=2) t2 = psb_wtime() - t1 call psb_amx(ictxt,t2) @@ -250,6 +248,7 @@ program mld_dexample_1lev write(*,'(" ")') write(*,'("Matrix: ",A)')mtrx_file write(*,'("Computed solution on ",i8," processors")')np + write(*,'("Krylov method : ",a)') kmethod write(*,'("Iterations to convergence : ",i6)')iter write(*,'("Error estimate on exit : ",es12.5)')err write(*,'("Time to build prec. : ",es12.5)')tprec @@ -309,17 +308,35 @@ contains integer :: ictxt, itmax real(psb_dpk_) :: tol character(len=*) :: mtrx, rhs,filefmt - integer :: iam, np + integer :: iam, np, inp_unit + character(len=1024) :: filename call psb_info(ictxt,iam,np) if (iam == psb_root_) then + if (command_argument_count()>0) then + call get_command_argument(1,filename) + inp_unit = 30 + open(inp_unit,file=filename,action='read',iostat=info) + if (info /= 0) then + write(psb_err_unit,*) 'Could not open file ',filename,' for input' + call psb_abort(ictxt) + stop + else + write(psb_err_unit,*) 'Opened file ',trim(filename),' for input' + end if + else + inp_unit=psb_inp_unit + end if ! read input parameters - call read_data(mtrx,5) - call read_data(rhs,5) - call read_data(filefmt,5) - call read_data(itmax,5) - call read_data(tol,5) + call read_data(mtrx,inp_unit) + call read_data(rhs,inp_unit) + call read_data(filefmt,inp_unit) + call read_data(itmax,inp_unit) + call read_data(tol,inp_unit) + if (inp_unit /= psb_inp_unit) then + close(inp_unit) + end if end if call psb_bcast(ictxt,mtrx) diff --git a/examples/fileread/mld_dexample_ml.f90 b/examples/fileread/mld_dexample_ml.f90 index f01e1dd6..be0bbd48 100644 --- a/examples/fileread/mld_dexample_ml.f90 +++ b/examples/fileread/mld_dexample_ml.f90 @@ -292,6 +292,7 @@ program mld_dexample_ml write(*,'(" ")') write(*,'("Matrix: ",A)')mtrx_file write(*,'("Computed solution on ",i8," processors")')np + write(*,'("Krylov method : ",a)') kmethod write(*,'("Iterations to convergence : ",i6)')iter write(*,'("Error estimate on exit : ",es12.5)')err write(*,'("Time to build prec. : ",es12.5)')tprec @@ -351,18 +352,36 @@ contains integer :: ictxt, choice, itmax real(psb_dpk_) :: tol character(len=*) :: mtrx, rhs,filefmt - integer :: iam, np + integer :: iam, np, inp_unit + character(len=1024) :: filename call psb_info(ictxt,iam,np) if (iam == psb_root_) then + if (command_argument_count()>0) then + call get_command_argument(1,filename) + inp_unit = 30 + open(inp_unit,file=filename,action='read',iostat=info) + if (info /= 0) then + write(psb_err_unit,*) 'Could not open file ',filename,' for input' + call psb_abort(ictxt) + stop + else + write(psb_err_unit,*) 'Opened file ',trim(filename),' for input' + end if + else + inp_unit=psb_inp_unit + end if ! read input parameters - call read_data(mtrx,5) - call read_data(rhs,5) - call read_data(filefmt,5) - call read_data(choice,5) - call read_data(itmax,5) - call read_data(tol,5) + call read_data(mtrx,inp_unit) + call read_data(rhs,inp_unit) + call read_data(filefmt,inp_unit) + call read_data(choice,inp_unit) + call read_data(itmax,inp_unit) + call read_data(tol,inp_unit) + if (inp_unit /= psb_inp_unit) then + close(inp_unit) + end if end if call psb_bcast(ictxt,mtrx) diff --git a/examples/fileread/mld_sexample_1lev.f90 b/examples/fileread/mld_sexample_1lev.f90 index 987586fd..ca39e65d 100644 --- a/examples/fileread/mld_sexample_1lev.f90 +++ b/examples/fileread/mld_sexample_1lev.f90 @@ -85,7 +85,7 @@ program mld_sexample_1lev integer :: ierr, ircode real(psb_spk_) :: resmx, resmxp real(psb_dpk_) :: t1, t2, tprec - character(len=20) :: name + character(len=20) :: name, kmethod integer, parameter :: iunit=12 ! initialize the parallel environment @@ -189,7 +189,7 @@ program mld_sexample_1lev end if -! START SETTING PARAMETER + ! START SETTING PARAMETER ! set RAS @@ -219,12 +219,13 @@ program mld_sexample_1lev call x%zero() call psb_geasb(x,desc_A,info) - ! solve Ax=b with preconditioned BiCGSTAB + ! solve Ax=b with preconditioned Krylov method: BiCGSTAB + kmethod = 'BiCGSTAB' call psb_barrier(ictxt) t1 = psb_wtime() - call psb_krylov('BiCGSTAB',A,P,b,x,tol,desc_A,info,itmax,iter,err,istop=2) + call psb_krylov(kmethod,A,P,b,x,tol,desc_A,info,itmax,iter,err,istop=2) t2 = psb_wtime() - t1 call psb_amx(ictxt,t2) @@ -247,6 +248,7 @@ program mld_sexample_1lev write(*,'(" ")') write(*,'("Matrix: ",A)')mtrx_file write(*,'("Computed solution on ",i8," processors")')np + write(*,'("Krylov method : ",a)') kmethod write(*,'("Iterations to convergence : ",i6)')iter write(*,'("Error estimate on exit : ",es12.5)')err write(*,'("Time to build prec. : ",es12.5)')tprec @@ -306,17 +308,35 @@ contains integer :: ictxt, itmax real(psb_spk_) :: tol character(len=*) :: mtrx, rhs,filefmt - integer :: iam, np + integer :: iam, np, inp_unit + character(len=1024) :: filename call psb_info(ictxt,iam,np) if (iam == psb_root_) then + if (command_argument_count()>0) then + call get_command_argument(1,filename) + inp_unit = 30 + open(inp_unit,file=filename,action='read',iostat=info) + if (info /= 0) then + write(psb_err_unit,*) 'Could not open file ',filename,' for input' + call psb_abort(ictxt) + stop + else + write(psb_err_unit,*) 'Opened file ',trim(filename),' for input' + end if + else + inp_unit=psb_inp_unit + end if ! read input parameters - call read_data(mtrx,5) - call read_data(rhs,5) - call read_data(filefmt,5) - call read_data(itmax,5) - call read_data(tol,5) + call read_data(mtrx,inp_unit) + call read_data(rhs,inp_unit) + call read_data(filefmt,inp_unit) + call read_data(itmax,inp_unit) + call read_data(tol,inp_unit) + if (inp_unit /= psb_inp_unit) then + close(inp_unit) + end if end if call psb_bcast(ictxt,mtrx) diff --git a/examples/fileread/mld_sexample_ml.f90 b/examples/fileread/mld_sexample_ml.f90 index 0e7a46de..027ed6f3 100644 --- a/examples/fileread/mld_sexample_ml.f90 +++ b/examples/fileread/mld_sexample_ml.f90 @@ -292,6 +292,7 @@ program mld_sexample_ml write(*,'(" ")') write(*,'("Matrix: ",A)')mtrx_file write(*,'("Computed solution on ",i8," processors")')np + write(*,'("Krylov method : ",a)') kmethod write(*,'("Iterations to convergence : ",i6)')iter write(*,'("Error estimate on exit : ",es12.5)')err write(*,'("Time to build prec. : ",es12.5)')tprec @@ -351,18 +352,36 @@ contains integer :: ictxt, choice, itmax real(psb_spk_) :: tol character(len=*) :: mtrx, rhs,filefmt - integer :: iam, np + integer :: iam, np, inp_unit + character(len=1024) :: filename call psb_info(ictxt,iam,np) if (iam == psb_root_) then + if (command_argument_count()>0) then + call get_command_argument(1,filename) + inp_unit = 30 + open(inp_unit,file=filename,action='read',iostat=info) + if (info /= 0) then + write(psb_err_unit,*) 'Could not open file ',filename,' for input' + call psb_abort(ictxt) + stop + else + write(psb_err_unit,*) 'Opened file ',trim(filename),' for input' + end if + else + inp_unit=psb_inp_unit + end if ! read input parameters - call read_data(mtrx,5) - call read_data(rhs,5) - call read_data(filefmt,5) - call read_data(choice,5) - call read_data(itmax,5) - call read_data(tol,5) + call read_data(mtrx,inp_unit) + call read_data(rhs,inp_unit) + call read_data(filefmt,inp_unit) + call read_data(choice,inp_unit) + call read_data(itmax,inp_unit) + call read_data(tol,inp_unit) + if (inp_unit /= psb_inp_unit) then + close(inp_unit) + end if end if call psb_bcast(ictxt,mtrx) diff --git a/examples/fileread/mld_zexample_1lev.f90 b/examples/fileread/mld_zexample_1lev.f90 index 6aac1d87..1a5da26d 100644 --- a/examples/fileread/mld_zexample_1lev.f90 +++ b/examples/fileread/mld_zexample_1lev.f90 @@ -85,7 +85,7 @@ program mld_zexample_1lev integer :: ierr, ircode real(psb_dpk_) :: resmx, resmxp real(psb_dpk_) :: t1, t2, tprec - character(len=20) :: name + character(len=20) :: name, kmethod integer, parameter :: iunit=12 ! initialize the parallel environment @@ -189,7 +189,7 @@ program mld_zexample_1lev end if -! START SETTING PARAMETER + ! START SETTING PARAMETER ! set RAS @@ -219,12 +219,13 @@ program mld_zexample_1lev call x%zero() call psb_geasb(x,desc_A,info) - ! solve Ax=b with preconditioned BiCGSTAB + ! solve Ax=b with preconditioned Krylov method: BiCGSTAB + kmethod = 'BiCGSTAB' call psb_barrier(ictxt) t1 = psb_wtime() - call psb_krylov('BiCGSTAB',A,P,b,x,tol,desc_A,info,itmax,iter,err,istop=2) + call psb_krylov(kmethod,A,P,b,x,tol,desc_A,info,itmax,iter,err,istop=2) t2 = psb_wtime() - t1 call psb_amx(ictxt,t2) @@ -247,6 +248,7 @@ program mld_zexample_1lev write(*,'(" ")') write(*,'("Matrix: ",A)')mtrx_file write(*,'("Computed solution on ",i8," processors")')np + write(*,'("Krylov method : ",a)') kmethod write(*,'("Iterations to convergence : ",i6)')iter write(*,'("Error estimate on exit : ",es12.5)')err write(*,'("Time to build prec. : ",es12.5)')tprec @@ -306,17 +308,35 @@ contains integer :: ictxt, itmax real(psb_dpk_) :: tol character(len=*) :: mtrx, rhs,filefmt - integer :: iam, np + integer :: iam, np, inp_unit + character(len=1024) :: filename call psb_info(ictxt,iam,np) if (iam == psb_root_) then + if (command_argument_count()>0) then + call get_command_argument(1,filename) + inp_unit = 30 + open(inp_unit,file=filename,action='read',iostat=info) + if (info /= 0) then + write(psb_err_unit,*) 'Could not open file ',filename,' for input' + call psb_abort(ictxt) + stop + else + write(psb_err_unit,*) 'Opened file ',trim(filename),' for input' + end if + else + inp_unit=psb_inp_unit + end if ! read input parameters - call read_data(mtrx,5) - call read_data(rhs,5) - call read_data(filefmt,5) - call read_data(itmax,5) - call read_data(tol,5) + call read_data(mtrx,inp_unit) + call read_data(rhs,inp_unit) + call read_data(filefmt,inp_unit) + call read_data(itmax,inp_unit) + call read_data(tol,inp_unit) + if (inp_unit /= psb_inp_unit) then + close(inp_unit) + end if end if call psb_bcast(ictxt,mtrx) diff --git a/examples/fileread/mld_zexample_ml.f90 b/examples/fileread/mld_zexample_ml.f90 index 3d82b4af..453d3ecd 100644 --- a/examples/fileread/mld_zexample_ml.f90 +++ b/examples/fileread/mld_zexample_ml.f90 @@ -292,6 +292,7 @@ program mld_zexample_ml write(*,'(" ")') write(*,'("Matrix: ",A)')mtrx_file write(*,'("Computed solution on ",i8," processors")')np + write(*,'("Krylov method : ",a)') kmethod write(*,'("Iterations to convergence : ",i6)')iter write(*,'("Error estimate on exit : ",es12.5)')err write(*,'("Time to build prec. : ",es12.5)')tprec @@ -351,18 +352,36 @@ contains integer :: ictxt, choice, itmax real(psb_dpk_) :: tol character(len=*) :: mtrx, rhs,filefmt - integer :: iam, np + integer :: iam, np, inp_unit + character(len=1024) :: filename call psb_info(ictxt,iam,np) if (iam == psb_root_) then + if (command_argument_count()>0) then + call get_command_argument(1,filename) + inp_unit = 30 + open(inp_unit,file=filename,action='read',iostat=info) + if (info /= 0) then + write(psb_err_unit,*) 'Could not open file ',filename,' for input' + call psb_abort(ictxt) + stop + else + write(psb_err_unit,*) 'Opened file ',trim(filename),' for input' + end if + else + inp_unit=psb_inp_unit + end if ! read input parameters - call read_data(mtrx,5) - call read_data(rhs,5) - call read_data(filefmt,5) - call read_data(choice,5) - call read_data(itmax,5) - call read_data(tol,5) + call read_data(mtrx,inp_unit) + call read_data(rhs,inp_unit) + call read_data(filefmt,inp_unit) + call read_data(choice,inp_unit) + call read_data(itmax,inp_unit) + call read_data(tol,inp_unit) + if (inp_unit /= psb_inp_unit) then + close(inp_unit) + end if end if call psb_bcast(ictxt,mtrx) diff --git a/examples/pdegen/mld_dexample_1lev.f90 b/examples/pdegen/mld_dexample_1lev.f90 index cf4adff3..9dd1a443 100644 --- a/examples/pdegen/mld_dexample_1lev.f90 +++ b/examples/pdegen/mld_dexample_1lev.f90 @@ -234,15 +234,34 @@ contains integer :: idim, ictxt, itmax real(psb_dpk_) :: tol - integer :: iam, np + integer :: iam, np, inp_unit + character(len=1024) :: filename call psb_info(ictxt,iam,np) - + if (iam == psb_root_) then + if (command_argument_count()>0) then + call get_command_argument(1,filename) + inp_unit = 30 + open(inp_unit,file=filename,action='read',iostat=info) + if (info /= 0) then + write(psb_err_unit,*) 'Could not open file ',filename,' for input' + call psb_abort(ictxt) + stop + else + write(psb_err_unit,*) 'Opened file ',trim(filename),' for input' + end if + else + inp_unit=psb_inp_unit + end if + ! read input parameters - call read_data(idim,5) - call read_data(itmax,5) - call read_data(tol,5) + call read_data(idim,inp_unit) + call read_data(itmax,inp_unit) + call read_data(tol,inp_unit) + if (inp_unit /= psb_inp_unit) then + close(inp_unit) + end if end if call psb_bcast(ictxt,idim) diff --git a/examples/pdegen/mld_dexample_ml.f90 b/examples/pdegen/mld_dexample_ml.f90 index 780a2e32..4d924ac8 100644 --- a/examples/pdegen/mld_dexample_ml.f90 +++ b/examples/pdegen/mld_dexample_ml.f90 @@ -286,16 +286,34 @@ contains integer :: choice, idim, ictxt, itmax real(psb_dpk_) :: tol - integer :: iam, np + integer :: iam, np, inp_unit + character(len=1024) :: filename call psb_info(ictxt,iam,np) if (iam == psb_root_) then + if (command_argument_count()>0) then + call get_command_argument(1,filename) + inp_unit = 30 + open(inp_unit,file=filename,action='read',iostat=info) + if (info /= 0) then + write(psb_err_unit,*) 'Could not open file ',filename,' for input' + call psb_abort(ictxt) + stop + else + write(psb_err_unit,*) 'Opened file ',trim(filename),' for input' + end if + else + inp_unit=psb_inp_unit + end if ! read input parameters - call read_data(choice,5) - call read_data(idim,5) - call read_data(itmax,5) - call read_data(tol,5) + call read_data(choice,inp_unit) + call read_data(idim,inp_unit) + call read_data(itmax,inp_unit) + call read_data(tol,inp_unit) + if (inp_unit /= psb_inp_unit) then + close(inp_unit) + end if end if call psb_bcast(ictxt,choice) diff --git a/examples/pdegen/mld_sexample_1lev.f90 b/examples/pdegen/mld_sexample_1lev.f90 index 7a201fca..a60d61fd 100644 --- a/examples/pdegen/mld_sexample_1lev.f90 +++ b/examples/pdegen/mld_sexample_1lev.f90 @@ -234,15 +234,34 @@ contains integer :: idim, ictxt, itmax real(psb_spk_) :: tol - integer :: iam, np + integer :: iam, np, inp_unit + character(len=1024) :: filename call psb_info(ictxt,iam,np) - + if (iam == psb_root_) then + if (command_argument_count()>0) then + call get_command_argument(1,filename) + inp_unit = 30 + open(inp_unit,file=filename,action='read',iostat=info) + if (info /= 0) then + write(psb_err_unit,*) 'Could not open file ',filename,' for input' + call psb_abort(ictxt) + stop + else + write(psb_err_unit,*) 'Opened file ',trim(filename),' for input' + end if + else + inp_unit=psb_inp_unit + end if + ! read input parameters - call read_data(idim,5) - call read_data(itmax,5) - call read_data(tol,5) + call read_data(idim,inp_unit) + call read_data(itmax,inp_unit) + call read_data(tol,inp_unit) + if (inp_unit /= psb_inp_unit) then + close(inp_unit) + end if end if call psb_bcast(ictxt,idim) diff --git a/examples/pdegen/mld_sexample_ml.f90 b/examples/pdegen/mld_sexample_ml.f90 index c478347c..ccd7c9c9 100644 --- a/examples/pdegen/mld_sexample_ml.f90 +++ b/examples/pdegen/mld_sexample_ml.f90 @@ -286,16 +286,34 @@ contains integer :: choice, idim, ictxt, itmax real(psb_spk_) :: tol - integer :: iam, np + integer :: iam, np, inp_unit + character(len=1024) :: filename call psb_info(ictxt,iam,np) if (iam == psb_root_) then + if (command_argument_count()>0) then + call get_command_argument(1,filename) + inp_unit = 30 + open(inp_unit,file=filename,action='read',iostat=info) + if (info /= 0) then + write(psb_err_unit,*) 'Could not open file ',filename,' for input' + call psb_abort(ictxt) + stop + else + write(psb_err_unit,*) 'Opened file ',trim(filename),' for input' + end if + else + inp_unit=psb_inp_unit + end if ! read input parameters - call read_data(choice,5) - call read_data(idim,5) - call read_data(itmax,5) - call read_data(tol,5) + call read_data(choice,inp_unit) + call read_data(idim,inp_unit) + call read_data(itmax,inp_unit) + call read_data(tol,inp_unit) + if (inp_unit /= psb_inp_unit) then + close(inp_unit) + end if end if call psb_bcast(ictxt,choice) diff --git a/tests/fileread/mld_cf_sample.f90 b/tests/fileread/mld_cf_sample.f90 index 4d4106a9..8883d18a 100644 --- a/tests/fileread/mld_cf_sample.f90 +++ b/tests/fileread/mld_cf_sample.f90 @@ -603,75 +603,93 @@ contains character(len=*) :: mtrx, rhs, guess, sol, filefmt, afmt, part type(solverdata) :: solve type(precdata) :: prec - integer(psb_ipk_) :: iam, nm, np + integer(psb_ipk_) :: iam, nm, np, inp_unit + character(len=1024) :: filename call psb_info(icontxt,iam,np) if (iam == psb_root_) then ! read input data + if (command_argument_count()>0) then + call get_command_argument(1,filename) + inp_unit = 30 + open(inp_unit,file=filename,action='read',iostat=info) + if (info /= 0) then + write(psb_err_unit,*) 'Could not open file ',filename,' for input' + call psb_abort(icontxt) + stop + else + write(psb_err_unit,*) 'Opened file ',trim(filename),' for input' + end if + else + inp_unit=psb_inp_unit + end if ! ! input files - call read_data(mtrx,psb_inp_unit) ! matrix file - call read_data(rhs,psb_inp_unit) ! rhs file - call read_data(guess,psb_inp_unit) ! starting guess file - call read_data(sol,psb_inp_unit) ! solution file (for comparison) - call read_data(filefmt,psb_inp_unit) ! format of files - call read_data(afmt,psb_inp_unit) ! matrix storage format - call read_data(part,psb_inp_unit) ! partition type + call read_data(mtrx,inp_unit) ! matrix file + call read_data(rhs,inp_unit) ! rhs file + call read_data(guess,inp_unit) ! starting guess file + call read_data(sol,inp_unit) ! solution file (for comparison) + call read_data(filefmt,inp_unit) ! format of files + call read_data(afmt,inp_unit) ! matrix storage format + call read_data(part,inp_unit) ! partition type ! Krylov solver data - call read_data(solve%kmethd,psb_inp_unit) ! Krylov solver - call read_data(solve%istopc,psb_inp_unit) ! stopping criterion - call read_data(solve%itmax,psb_inp_unit) ! max num iterations - call read_data(solve%itrace,psb_inp_unit) ! tracing - call read_data(solve%irst,psb_inp_unit) ! restart - call read_data(solve%eps,psb_inp_unit) ! tolerance + call read_data(solve%kmethd,inp_unit) ! Krylov solver + call read_data(solve%istopc,inp_unit) ! stopping criterion + call read_data(solve%itmax,inp_unit) ! max num iterations + call read_data(solve%itrace,inp_unit) ! tracing + call read_data(solve%irst,inp_unit) ! restart + call read_data(solve%eps,inp_unit) ! tolerance ! preconditioner type - call read_data(prec%descr,psb_inp_unit) ! verbose description of the prec - call read_data(prec%ptype,psb_inp_unit) ! preconditioner type + call read_data(prec%descr,inp_unit) ! verbose description of the prec + call read_data(prec%ptype,inp_unit) ! preconditioner type ! First smoother / 1-lev preconditioner - call read_data(prec%smther,psb_inp_unit) ! smoother type - call read_data(prec%jsweeps,psb_inp_unit) ! (pre-)smoother / 1-lev prec sweeps - call read_data(prec%novr,psb_inp_unit) ! number of overlap layers - call read_data(prec%restr,psb_inp_unit) ! restriction over application of AS - call read_data(prec%prol,psb_inp_unit) ! prolongation over application of AS - call read_data(prec%solve,psb_inp_unit) ! local subsolver - call read_data(prec%fill,psb_inp_unit) ! fill-in for incomplete LU - call read_data(prec%thr,psb_inp_unit) ! threshold for ILUT + call read_data(prec%smther,inp_unit) ! smoother type + call read_data(prec%jsweeps,inp_unit) ! (pre-)smoother / 1-lev prec sweeps + call read_data(prec%novr,inp_unit) ! number of overlap layers + call read_data(prec%restr,inp_unit) ! restriction over application of AS + call read_data(prec%prol,inp_unit) ! prolongation over application of AS + call read_data(prec%solve,inp_unit) ! local subsolver + call read_data(prec%fill,inp_unit) ! fill-in for incomplete LU + call read_data(prec%thr,inp_unit) ! threshold for ILUT ! Second smoother/ AMG post-smoother (if NONE ignored in main) - call read_data(prec%smther2,psb_inp_unit) ! smoother type - call read_data(prec%jsweeps2,psb_inp_unit) ! (post-)smoother sweeps - call read_data(prec%novr2,psb_inp_unit) ! number of overlap layers - call read_data(prec%restr2,psb_inp_unit) ! restriction over application of AS - call read_data(prec%prol2,psb_inp_unit) ! prolongation over application of AS - call read_data(prec%solve2,psb_inp_unit) ! local subsolver - call read_data(prec%fill2,psb_inp_unit) ! fill-in for incomplete LU - call read_data(prec%thr2,psb_inp_unit) ! threshold for ILUT + call read_data(prec%smther2,inp_unit) ! smoother type + call read_data(prec%jsweeps2,inp_unit) ! (post-)smoother sweeps + call read_data(prec%novr2,inp_unit) ! number of overlap layers + call read_data(prec%restr2,inp_unit) ! restriction over application of AS + call read_data(prec%prol2,inp_unit) ! prolongation over application of AS + call read_data(prec%solve2,inp_unit) ! local subsolver + call read_data(prec%fill2,inp_unit) ! fill-in for incomplete LU + call read_data(prec%thr2,inp_unit) ! threshold for ILUT ! general AMG data - call read_data(prec%mlcycle,psb_inp_unit) ! AMG cycle type - call read_data(prec%outer_sweeps,psb_inp_unit) ! number of 1lev/outer sweeps - call read_data(prec%maxlevs,psb_inp_unit) ! max number of levels in AMG prec - call read_data(prec%csize,psb_inp_unit) ! min size coarsest mat + call read_data(prec%mlcycle,inp_unit) ! AMG cycle type + call read_data(prec%outer_sweeps,inp_unit) ! number of 1lev/outer sweeps + call read_data(prec%maxlevs,inp_unit) ! max number of levels in AMG prec + call read_data(prec%csize,inp_unit) ! min size coarsest mat ! aggregation - call read_data(prec%aggr_prol,psb_inp_unit) ! aggregation type - call read_data(prec%par_aggr_alg,psb_inp_unit) ! parallel aggregation alg - call read_data(prec%aggr_ord,psb_inp_unit) ! ordering for aggregation - call read_data(prec%aggr_filter,psb_inp_unit) ! filtering - call read_data(prec%mncrratio,psb_inp_unit) ! minimum aggregation ratio - call read_data(prec%thrvsz,psb_inp_unit) ! size of aggr thresh vector + call read_data(prec%aggr_prol,inp_unit) ! aggregation type + call read_data(prec%par_aggr_alg,inp_unit) ! parallel aggregation alg + call read_data(prec%aggr_ord,inp_unit) ! ordering for aggregation + call read_data(prec%aggr_filter,inp_unit) ! filtering + call read_data(prec%mncrratio,inp_unit) ! minimum aggregation ratio + call read_data(prec%thrvsz,inp_unit) ! size of aggr thresh vector if (prec%thrvsz > 0) then call psb_realloc(prec%thrvsz,prec%athresv,info) - call read_data(prec%athresv,psb_inp_unit) ! aggr thresh vector + call read_data(prec%athresv,inp_unit) ! aggr thresh vector else - read(psb_inp_unit,*) ! dummy read to skip a record + read(inp_unit,*) ! dummy read to skip a record end if - call read_data(prec%athres,psb_inp_unit) ! smoothed aggr thresh + call read_data(prec%athres,inp_unit) ! smoothed aggr thresh ! coasest-level solver - call read_data(prec%csolve,psb_inp_unit) ! coarsest-lev solver - call read_data(prec%csbsolve,psb_inp_unit) ! coarsest-lev subsolver - call read_data(prec%cmat,psb_inp_unit) ! coarsest mat layout - call read_data(prec%cfill,psb_inp_unit) ! fill-in for incompl LU - call read_data(prec%cthres,psb_inp_unit) ! Threshold for ILUT - call read_data(prec%cjswp,psb_inp_unit) ! sweeps for GS/JAC subsolver + call read_data(prec%csolve,inp_unit) ! coarsest-lev solver + call read_data(prec%csbsolve,inp_unit) ! coarsest-lev subsolver + call read_data(prec%cmat,inp_unit) ! coarsest mat layout + call read_data(prec%cfill,inp_unit) ! fill-in for incompl LU + call read_data(prec%cthres,inp_unit) ! Threshold for ILUT + call read_data(prec%cjswp,inp_unit) ! sweeps for GS/JAC subsolver + if (inp_unit /= psb_inp_unit) then + close(inp_unit) + end if end if call psb_bcast(icontxt,mtrx) diff --git a/tests/fileread/mld_df_sample.f90 b/tests/fileread/mld_df_sample.f90 index 65fbcba2..3a9a77dd 100644 --- a/tests/fileread/mld_df_sample.f90 +++ b/tests/fileread/mld_df_sample.f90 @@ -603,75 +603,93 @@ contains character(len=*) :: mtrx, rhs, guess, sol, filefmt, afmt, part type(solverdata) :: solve type(precdata) :: prec - integer(psb_ipk_) :: iam, nm, np + integer(psb_ipk_) :: iam, nm, np, inp_unit + character(len=1024) :: filename call psb_info(icontxt,iam,np) if (iam == psb_root_) then ! read input data + if (command_argument_count()>0) then + call get_command_argument(1,filename) + inp_unit = 30 + open(inp_unit,file=filename,action='read',iostat=info) + if (info /= 0) then + write(psb_err_unit,*) 'Could not open file ',filename,' for input' + call psb_abort(icontxt) + stop + else + write(psb_err_unit,*) 'Opened file ',trim(filename),' for input' + end if + else + inp_unit=psb_inp_unit + end if ! ! input files - call read_data(mtrx,psb_inp_unit) ! matrix file - call read_data(rhs,psb_inp_unit) ! rhs file - call read_data(guess,psb_inp_unit) ! starting guess file - call read_data(sol,psb_inp_unit) ! solution file (for comparison) - call read_data(filefmt,psb_inp_unit) ! format of files - call read_data(afmt,psb_inp_unit) ! matrix storage format - call read_data(part,psb_inp_unit) ! partition type + call read_data(mtrx,inp_unit) ! matrix file + call read_data(rhs,inp_unit) ! rhs file + call read_data(guess,inp_unit) ! starting guess file + call read_data(sol,inp_unit) ! solution file (for comparison) + call read_data(filefmt,inp_unit) ! format of files + call read_data(afmt,inp_unit) ! matrix storage format + call read_data(part,inp_unit) ! partition type ! Krylov solver data - call read_data(solve%kmethd,psb_inp_unit) ! Krylov solver - call read_data(solve%istopc,psb_inp_unit) ! stopping criterion - call read_data(solve%itmax,psb_inp_unit) ! max num iterations - call read_data(solve%itrace,psb_inp_unit) ! tracing - call read_data(solve%irst,psb_inp_unit) ! restart - call read_data(solve%eps,psb_inp_unit) ! tolerance + call read_data(solve%kmethd,inp_unit) ! Krylov solver + call read_data(solve%istopc,inp_unit) ! stopping criterion + call read_data(solve%itmax,inp_unit) ! max num iterations + call read_data(solve%itrace,inp_unit) ! tracing + call read_data(solve%irst,inp_unit) ! restart + call read_data(solve%eps,inp_unit) ! tolerance ! preconditioner type - call read_data(prec%descr,psb_inp_unit) ! verbose description of the prec - call read_data(prec%ptype,psb_inp_unit) ! preconditioner type + call read_data(prec%descr,inp_unit) ! verbose description of the prec + call read_data(prec%ptype,inp_unit) ! preconditioner type ! First smoother / 1-lev preconditioner - call read_data(prec%smther,psb_inp_unit) ! smoother type - call read_data(prec%jsweeps,psb_inp_unit) ! (pre-)smoother / 1-lev prec sweeps - call read_data(prec%novr,psb_inp_unit) ! number of overlap layers - call read_data(prec%restr,psb_inp_unit) ! restriction over application of AS - call read_data(prec%prol,psb_inp_unit) ! prolongation over application of AS - call read_data(prec%solve,psb_inp_unit) ! local subsolver - call read_data(prec%fill,psb_inp_unit) ! fill-in for incomplete LU - call read_data(prec%thr,psb_inp_unit) ! threshold for ILUT + call read_data(prec%smther,inp_unit) ! smoother type + call read_data(prec%jsweeps,inp_unit) ! (pre-)smoother / 1-lev prec sweeps + call read_data(prec%novr,inp_unit) ! number of overlap layers + call read_data(prec%restr,inp_unit) ! restriction over application of AS + call read_data(prec%prol,inp_unit) ! prolongation over application of AS + call read_data(prec%solve,inp_unit) ! local subsolver + call read_data(prec%fill,inp_unit) ! fill-in for incomplete LU + call read_data(prec%thr,inp_unit) ! threshold for ILUT ! Second smoother/ AMG post-smoother (if NONE ignored in main) - call read_data(prec%smther2,psb_inp_unit) ! smoother type - call read_data(prec%jsweeps2,psb_inp_unit) ! (post-)smoother sweeps - call read_data(prec%novr2,psb_inp_unit) ! number of overlap layers - call read_data(prec%restr2,psb_inp_unit) ! restriction over application of AS - call read_data(prec%prol2,psb_inp_unit) ! prolongation over application of AS - call read_data(prec%solve2,psb_inp_unit) ! local subsolver - call read_data(prec%fill2,psb_inp_unit) ! fill-in for incomplete LU - call read_data(prec%thr2,psb_inp_unit) ! threshold for ILUT + call read_data(prec%smther2,inp_unit) ! smoother type + call read_data(prec%jsweeps2,inp_unit) ! (post-)smoother sweeps + call read_data(prec%novr2,inp_unit) ! number of overlap layers + call read_data(prec%restr2,inp_unit) ! restriction over application of AS + call read_data(prec%prol2,inp_unit) ! prolongation over application of AS + call read_data(prec%solve2,inp_unit) ! local subsolver + call read_data(prec%fill2,inp_unit) ! fill-in for incomplete LU + call read_data(prec%thr2,inp_unit) ! threshold for ILUT ! general AMG data - call read_data(prec%mlcycle,psb_inp_unit) ! AMG cycle type - call read_data(prec%outer_sweeps,psb_inp_unit) ! number of 1lev/outer sweeps - call read_data(prec%maxlevs,psb_inp_unit) ! max number of levels in AMG prec - call read_data(prec%csize,psb_inp_unit) ! min size coarsest mat + call read_data(prec%mlcycle,inp_unit) ! AMG cycle type + call read_data(prec%outer_sweeps,inp_unit) ! number of 1lev/outer sweeps + call read_data(prec%maxlevs,inp_unit) ! max number of levels in AMG prec + call read_data(prec%csize,inp_unit) ! min size coarsest mat ! aggregation - call read_data(prec%aggr_prol,psb_inp_unit) ! aggregation type - call read_data(prec%par_aggr_alg,psb_inp_unit) ! parallel aggregation alg - call read_data(prec%aggr_ord,psb_inp_unit) ! ordering for aggregation - call read_data(prec%aggr_filter,psb_inp_unit) ! filtering - call read_data(prec%mncrratio,psb_inp_unit) ! minimum aggregation ratio - call read_data(prec%thrvsz,psb_inp_unit) ! size of aggr thresh vector + call read_data(prec%aggr_prol,inp_unit) ! aggregation type + call read_data(prec%par_aggr_alg,inp_unit) ! parallel aggregation alg + call read_data(prec%aggr_ord,inp_unit) ! ordering for aggregation + call read_data(prec%aggr_filter,inp_unit) ! filtering + call read_data(prec%mncrratio,inp_unit) ! minimum aggregation ratio + call read_data(prec%thrvsz,inp_unit) ! size of aggr thresh vector if (prec%thrvsz > 0) then call psb_realloc(prec%thrvsz,prec%athresv,info) - call read_data(prec%athresv,psb_inp_unit) ! aggr thresh vector + call read_data(prec%athresv,inp_unit) ! aggr thresh vector else - read(psb_inp_unit,*) ! dummy read to skip a record + read(inp_unit,*) ! dummy read to skip a record end if - call read_data(prec%athres,psb_inp_unit) ! smoothed aggr thresh + call read_data(prec%athres,inp_unit) ! smoothed aggr thresh ! coasest-level solver - call read_data(prec%csolve,psb_inp_unit) ! coarsest-lev solver - call read_data(prec%csbsolve,psb_inp_unit) ! coarsest-lev subsolver - call read_data(prec%cmat,psb_inp_unit) ! coarsest mat layout - call read_data(prec%cfill,psb_inp_unit) ! fill-in for incompl LU - call read_data(prec%cthres,psb_inp_unit) ! Threshold for ILUT - call read_data(prec%cjswp,psb_inp_unit) ! sweeps for GS/JAC subsolver + call read_data(prec%csolve,inp_unit) ! coarsest-lev solver + call read_data(prec%csbsolve,inp_unit) ! coarsest-lev subsolver + call read_data(prec%cmat,inp_unit) ! coarsest mat layout + call read_data(prec%cfill,inp_unit) ! fill-in for incompl LU + call read_data(prec%cthres,inp_unit) ! Threshold for ILUT + call read_data(prec%cjswp,inp_unit) ! sweeps for GS/JAC subsolver + if (inp_unit /= psb_inp_unit) then + close(inp_unit) + end if end if call psb_bcast(icontxt,mtrx) diff --git a/tests/fileread/mld_sf_sample.f90 b/tests/fileread/mld_sf_sample.f90 index 134dab48..f08aa486 100644 --- a/tests/fileread/mld_sf_sample.f90 +++ b/tests/fileread/mld_sf_sample.f90 @@ -603,75 +603,93 @@ contains character(len=*) :: mtrx, rhs, guess, sol, filefmt, afmt, part type(solverdata) :: solve type(precdata) :: prec - integer(psb_ipk_) :: iam, nm, np + integer(psb_ipk_) :: iam, nm, np, inp_unit + character(len=1024) :: filename call psb_info(icontxt,iam,np) if (iam == psb_root_) then ! read input data + if (command_argument_count()>0) then + call get_command_argument(1,filename) + inp_unit = 30 + open(inp_unit,file=filename,action='read',iostat=info) + if (info /= 0) then + write(psb_err_unit,*) 'Could not open file ',filename,' for input' + call psb_abort(icontxt) + stop + else + write(psb_err_unit,*) 'Opened file ',trim(filename),' for input' + end if + else + inp_unit=psb_inp_unit + end if ! ! input files - call read_data(mtrx,psb_inp_unit) ! matrix file - call read_data(rhs,psb_inp_unit) ! rhs file - call read_data(guess,psb_inp_unit) ! starting guess file - call read_data(sol,psb_inp_unit) ! solution file (for comparison) - call read_data(filefmt,psb_inp_unit) ! format of files - call read_data(afmt,psb_inp_unit) ! matrix storage format - call read_data(part,psb_inp_unit) ! partition type + call read_data(mtrx,inp_unit) ! matrix file + call read_data(rhs,inp_unit) ! rhs file + call read_data(guess,inp_unit) ! starting guess file + call read_data(sol,inp_unit) ! solution file (for comparison) + call read_data(filefmt,inp_unit) ! format of files + call read_data(afmt,inp_unit) ! matrix storage format + call read_data(part,inp_unit) ! partition type ! Krylov solver data - call read_data(solve%kmethd,psb_inp_unit) ! Krylov solver - call read_data(solve%istopc,psb_inp_unit) ! stopping criterion - call read_data(solve%itmax,psb_inp_unit) ! max num iterations - call read_data(solve%itrace,psb_inp_unit) ! tracing - call read_data(solve%irst,psb_inp_unit) ! restart - call read_data(solve%eps,psb_inp_unit) ! tolerance + call read_data(solve%kmethd,inp_unit) ! Krylov solver + call read_data(solve%istopc,inp_unit) ! stopping criterion + call read_data(solve%itmax,inp_unit) ! max num iterations + call read_data(solve%itrace,inp_unit) ! tracing + call read_data(solve%irst,inp_unit) ! restart + call read_data(solve%eps,inp_unit) ! tolerance ! preconditioner type - call read_data(prec%descr,psb_inp_unit) ! verbose description of the prec - call read_data(prec%ptype,psb_inp_unit) ! preconditioner type + call read_data(prec%descr,inp_unit) ! verbose description of the prec + call read_data(prec%ptype,inp_unit) ! preconditioner type ! First smoother / 1-lev preconditioner - call read_data(prec%smther,psb_inp_unit) ! smoother type - call read_data(prec%jsweeps,psb_inp_unit) ! (pre-)smoother / 1-lev prec sweeps - call read_data(prec%novr,psb_inp_unit) ! number of overlap layers - call read_data(prec%restr,psb_inp_unit) ! restriction over application of AS - call read_data(prec%prol,psb_inp_unit) ! prolongation over application of AS - call read_data(prec%solve,psb_inp_unit) ! local subsolver - call read_data(prec%fill,psb_inp_unit) ! fill-in for incomplete LU - call read_data(prec%thr,psb_inp_unit) ! threshold for ILUT + call read_data(prec%smther,inp_unit) ! smoother type + call read_data(prec%jsweeps,inp_unit) ! (pre-)smoother / 1-lev prec sweeps + call read_data(prec%novr,inp_unit) ! number of overlap layers + call read_data(prec%restr,inp_unit) ! restriction over application of AS + call read_data(prec%prol,inp_unit) ! prolongation over application of AS + call read_data(prec%solve,inp_unit) ! local subsolver + call read_data(prec%fill,inp_unit) ! fill-in for incomplete LU + call read_data(prec%thr,inp_unit) ! threshold for ILUT ! Second smoother/ AMG post-smoother (if NONE ignored in main) - call read_data(prec%smther2,psb_inp_unit) ! smoother type - call read_data(prec%jsweeps2,psb_inp_unit) ! (post-)smoother sweeps - call read_data(prec%novr2,psb_inp_unit) ! number of overlap layers - call read_data(prec%restr2,psb_inp_unit) ! restriction over application of AS - call read_data(prec%prol2,psb_inp_unit) ! prolongation over application of AS - call read_data(prec%solve2,psb_inp_unit) ! local subsolver - call read_data(prec%fill2,psb_inp_unit) ! fill-in for incomplete LU - call read_data(prec%thr2,psb_inp_unit) ! threshold for ILUT + call read_data(prec%smther2,inp_unit) ! smoother type + call read_data(prec%jsweeps2,inp_unit) ! (post-)smoother sweeps + call read_data(prec%novr2,inp_unit) ! number of overlap layers + call read_data(prec%restr2,inp_unit) ! restriction over application of AS + call read_data(prec%prol2,inp_unit) ! prolongation over application of AS + call read_data(prec%solve2,inp_unit) ! local subsolver + call read_data(prec%fill2,inp_unit) ! fill-in for incomplete LU + call read_data(prec%thr2,inp_unit) ! threshold for ILUT ! general AMG data - call read_data(prec%mlcycle,psb_inp_unit) ! AMG cycle type - call read_data(prec%outer_sweeps,psb_inp_unit) ! number of 1lev/outer sweeps - call read_data(prec%maxlevs,psb_inp_unit) ! max number of levels in AMG prec - call read_data(prec%csize,psb_inp_unit) ! min size coarsest mat + call read_data(prec%mlcycle,inp_unit) ! AMG cycle type + call read_data(prec%outer_sweeps,inp_unit) ! number of 1lev/outer sweeps + call read_data(prec%maxlevs,inp_unit) ! max number of levels in AMG prec + call read_data(prec%csize,inp_unit) ! min size coarsest mat ! aggregation - call read_data(prec%aggr_prol,psb_inp_unit) ! aggregation type - call read_data(prec%par_aggr_alg,psb_inp_unit) ! parallel aggregation alg - call read_data(prec%aggr_ord,psb_inp_unit) ! ordering for aggregation - call read_data(prec%aggr_filter,psb_inp_unit) ! filtering - call read_data(prec%mncrratio,psb_inp_unit) ! minimum aggregation ratio - call read_data(prec%thrvsz,psb_inp_unit) ! size of aggr thresh vector + call read_data(prec%aggr_prol,inp_unit) ! aggregation type + call read_data(prec%par_aggr_alg,inp_unit) ! parallel aggregation alg + call read_data(prec%aggr_ord,inp_unit) ! ordering for aggregation + call read_data(prec%aggr_filter,inp_unit) ! filtering + call read_data(prec%mncrratio,inp_unit) ! minimum aggregation ratio + call read_data(prec%thrvsz,inp_unit) ! size of aggr thresh vector if (prec%thrvsz > 0) then call psb_realloc(prec%thrvsz,prec%athresv,info) - call read_data(prec%athresv,psb_inp_unit) ! aggr thresh vector + call read_data(prec%athresv,inp_unit) ! aggr thresh vector else - read(psb_inp_unit,*) ! dummy read to skip a record + read(inp_unit,*) ! dummy read to skip a record end if - call read_data(prec%athres,psb_inp_unit) ! smoothed aggr thresh + call read_data(prec%athres,inp_unit) ! smoothed aggr thresh ! coasest-level solver - call read_data(prec%csolve,psb_inp_unit) ! coarsest-lev solver - call read_data(prec%csbsolve,psb_inp_unit) ! coarsest-lev subsolver - call read_data(prec%cmat,psb_inp_unit) ! coarsest mat layout - call read_data(prec%cfill,psb_inp_unit) ! fill-in for incompl LU - call read_data(prec%cthres,psb_inp_unit) ! Threshold for ILUT - call read_data(prec%cjswp,psb_inp_unit) ! sweeps for GS/JAC subsolver + call read_data(prec%csolve,inp_unit) ! coarsest-lev solver + call read_data(prec%csbsolve,inp_unit) ! coarsest-lev subsolver + call read_data(prec%cmat,inp_unit) ! coarsest mat layout + call read_data(prec%cfill,inp_unit) ! fill-in for incompl LU + call read_data(prec%cthres,inp_unit) ! Threshold for ILUT + call read_data(prec%cjswp,inp_unit) ! sweeps for GS/JAC subsolver + if (inp_unit /= psb_inp_unit) then + close(inp_unit) + end if end if call psb_bcast(icontxt,mtrx) diff --git a/tests/fileread/mld_zf_sample.f90 b/tests/fileread/mld_zf_sample.f90 index 5ef5c661..3f6533ce 100644 --- a/tests/fileread/mld_zf_sample.f90 +++ b/tests/fileread/mld_zf_sample.f90 @@ -603,75 +603,93 @@ contains character(len=*) :: mtrx, rhs, guess, sol, filefmt, afmt, part type(solverdata) :: solve type(precdata) :: prec - integer(psb_ipk_) :: iam, nm, np + integer(psb_ipk_) :: iam, nm, np, inp_unit + character(len=1024) :: filename call psb_info(icontxt,iam,np) if (iam == psb_root_) then ! read input data + if (command_argument_count()>0) then + call get_command_argument(1,filename) + inp_unit = 30 + open(inp_unit,file=filename,action='read',iostat=info) + if (info /= 0) then + write(psb_err_unit,*) 'Could not open file ',filename,' for input' + call psb_abort(icontxt) + stop + else + write(psb_err_unit,*) 'Opened file ',trim(filename),' for input' + end if + else + inp_unit=psb_inp_unit + end if ! ! input files - call read_data(mtrx,psb_inp_unit) ! matrix file - call read_data(rhs,psb_inp_unit) ! rhs file - call read_data(guess,psb_inp_unit) ! starting guess file - call read_data(sol,psb_inp_unit) ! solution file (for comparison) - call read_data(filefmt,psb_inp_unit) ! format of files - call read_data(afmt,psb_inp_unit) ! matrix storage format - call read_data(part,psb_inp_unit) ! partition type + call read_data(mtrx,inp_unit) ! matrix file + call read_data(rhs,inp_unit) ! rhs file + call read_data(guess,inp_unit) ! starting guess file + call read_data(sol,inp_unit) ! solution file (for comparison) + call read_data(filefmt,inp_unit) ! format of files + call read_data(afmt,inp_unit) ! matrix storage format + call read_data(part,inp_unit) ! partition type ! Krylov solver data - call read_data(solve%kmethd,psb_inp_unit) ! Krylov solver - call read_data(solve%istopc,psb_inp_unit) ! stopping criterion - call read_data(solve%itmax,psb_inp_unit) ! max num iterations - call read_data(solve%itrace,psb_inp_unit) ! tracing - call read_data(solve%irst,psb_inp_unit) ! restart - call read_data(solve%eps,psb_inp_unit) ! tolerance + call read_data(solve%kmethd,inp_unit) ! Krylov solver + call read_data(solve%istopc,inp_unit) ! stopping criterion + call read_data(solve%itmax,inp_unit) ! max num iterations + call read_data(solve%itrace,inp_unit) ! tracing + call read_data(solve%irst,inp_unit) ! restart + call read_data(solve%eps,inp_unit) ! tolerance ! preconditioner type - call read_data(prec%descr,psb_inp_unit) ! verbose description of the prec - call read_data(prec%ptype,psb_inp_unit) ! preconditioner type + call read_data(prec%descr,inp_unit) ! verbose description of the prec + call read_data(prec%ptype,inp_unit) ! preconditioner type ! First smoother / 1-lev preconditioner - call read_data(prec%smther,psb_inp_unit) ! smoother type - call read_data(prec%jsweeps,psb_inp_unit) ! (pre-)smoother / 1-lev prec sweeps - call read_data(prec%novr,psb_inp_unit) ! number of overlap layers - call read_data(prec%restr,psb_inp_unit) ! restriction over application of AS - call read_data(prec%prol,psb_inp_unit) ! prolongation over application of AS - call read_data(prec%solve,psb_inp_unit) ! local subsolver - call read_data(prec%fill,psb_inp_unit) ! fill-in for incomplete LU - call read_data(prec%thr,psb_inp_unit) ! threshold for ILUT + call read_data(prec%smther,inp_unit) ! smoother type + call read_data(prec%jsweeps,inp_unit) ! (pre-)smoother / 1-lev prec sweeps + call read_data(prec%novr,inp_unit) ! number of overlap layers + call read_data(prec%restr,inp_unit) ! restriction over application of AS + call read_data(prec%prol,inp_unit) ! prolongation over application of AS + call read_data(prec%solve,inp_unit) ! local subsolver + call read_data(prec%fill,inp_unit) ! fill-in for incomplete LU + call read_data(prec%thr,inp_unit) ! threshold for ILUT ! Second smoother/ AMG post-smoother (if NONE ignored in main) - call read_data(prec%smther2,psb_inp_unit) ! smoother type - call read_data(prec%jsweeps2,psb_inp_unit) ! (post-)smoother sweeps - call read_data(prec%novr2,psb_inp_unit) ! number of overlap layers - call read_data(prec%restr2,psb_inp_unit) ! restriction over application of AS - call read_data(prec%prol2,psb_inp_unit) ! prolongation over application of AS - call read_data(prec%solve2,psb_inp_unit) ! local subsolver - call read_data(prec%fill2,psb_inp_unit) ! fill-in for incomplete LU - call read_data(prec%thr2,psb_inp_unit) ! threshold for ILUT + call read_data(prec%smther2,inp_unit) ! smoother type + call read_data(prec%jsweeps2,inp_unit) ! (post-)smoother sweeps + call read_data(prec%novr2,inp_unit) ! number of overlap layers + call read_data(prec%restr2,inp_unit) ! restriction over application of AS + call read_data(prec%prol2,inp_unit) ! prolongation over application of AS + call read_data(prec%solve2,inp_unit) ! local subsolver + call read_data(prec%fill2,inp_unit) ! fill-in for incomplete LU + call read_data(prec%thr2,inp_unit) ! threshold for ILUT ! general AMG data - call read_data(prec%mlcycle,psb_inp_unit) ! AMG cycle type - call read_data(prec%outer_sweeps,psb_inp_unit) ! number of 1lev/outer sweeps - call read_data(prec%maxlevs,psb_inp_unit) ! max number of levels in AMG prec - call read_data(prec%csize,psb_inp_unit) ! min size coarsest mat + call read_data(prec%mlcycle,inp_unit) ! AMG cycle type + call read_data(prec%outer_sweeps,inp_unit) ! number of 1lev/outer sweeps + call read_data(prec%maxlevs,inp_unit) ! max number of levels in AMG prec + call read_data(prec%csize,inp_unit) ! min size coarsest mat ! aggregation - call read_data(prec%aggr_prol,psb_inp_unit) ! aggregation type - call read_data(prec%par_aggr_alg,psb_inp_unit) ! parallel aggregation alg - call read_data(prec%aggr_ord,psb_inp_unit) ! ordering for aggregation - call read_data(prec%aggr_filter,psb_inp_unit) ! filtering - call read_data(prec%mncrratio,psb_inp_unit) ! minimum aggregation ratio - call read_data(prec%thrvsz,psb_inp_unit) ! size of aggr thresh vector + call read_data(prec%aggr_prol,inp_unit) ! aggregation type + call read_data(prec%par_aggr_alg,inp_unit) ! parallel aggregation alg + call read_data(prec%aggr_ord,inp_unit) ! ordering for aggregation + call read_data(prec%aggr_filter,inp_unit) ! filtering + call read_data(prec%mncrratio,inp_unit) ! minimum aggregation ratio + call read_data(prec%thrvsz,inp_unit) ! size of aggr thresh vector if (prec%thrvsz > 0) then call psb_realloc(prec%thrvsz,prec%athresv,info) - call read_data(prec%athresv,psb_inp_unit) ! aggr thresh vector + call read_data(prec%athresv,inp_unit) ! aggr thresh vector else - read(psb_inp_unit,*) ! dummy read to skip a record + read(inp_unit,*) ! dummy read to skip a record end if - call read_data(prec%athres,psb_inp_unit) ! smoothed aggr thresh + call read_data(prec%athres,inp_unit) ! smoothed aggr thresh ! coasest-level solver - call read_data(prec%csolve,psb_inp_unit) ! coarsest-lev solver - call read_data(prec%csbsolve,psb_inp_unit) ! coarsest-lev subsolver - call read_data(prec%cmat,psb_inp_unit) ! coarsest mat layout - call read_data(prec%cfill,psb_inp_unit) ! fill-in for incompl LU - call read_data(prec%cthres,psb_inp_unit) ! Threshold for ILUT - call read_data(prec%cjswp,psb_inp_unit) ! sweeps for GS/JAC subsolver + call read_data(prec%csolve,inp_unit) ! coarsest-lev solver + call read_data(prec%csbsolve,inp_unit) ! coarsest-lev subsolver + call read_data(prec%cmat,inp_unit) ! coarsest mat layout + call read_data(prec%cfill,inp_unit) ! fill-in for incompl LU + call read_data(prec%cthres,inp_unit) ! Threshold for ILUT + call read_data(prec%cjswp,inp_unit) ! sweeps for GS/JAC subsolver + if (inp_unit /= psb_inp_unit) then + close(inp_unit) + end if end if call psb_bcast(icontxt,mtrx) diff --git a/tests/pdegen/mld_d_pde2d.f90 b/tests/pdegen/mld_d_pde2d.f90 index eff68145..67be3884 100644 --- a/tests/pdegen/mld_d_pde2d.f90 +++ b/tests/pdegen/mld_d_pde2d.f90 @@ -790,69 +790,87 @@ contains character(len=*) :: afmt type(solverdata) :: solve type(precdata) :: prec - integer(psb_ipk_) :: iam, nm, np + integer(psb_ipk_) :: iam, nm, np, inp_unit + character(len=1024) :: filename call psb_info(icontxt,iam,np) if (iam == psb_root_) then + if (command_argument_count()>0) then + call get_command_argument(1,filename) + inp_unit = 30 + open(inp_unit,file=filename,action='read',iostat=info) + if (info /= 0) then + write(psb_err_unit,*) 'Could not open file ',filename,' for input' + call psb_abort(icontxt) + stop + else + write(psb_err_unit,*) 'Opened file ',trim(filename),' for input' + end if + else + inp_unit=psb_inp_unit + end if ! read input data ! - call read_data(afmt,psb_inp_unit) ! matrix storage format - call read_data(idim,psb_inp_unit) ! Discretization grid size + call read_data(afmt,inp_unit) ! matrix storage format + call read_data(idim,inp_unit) ! Discretization grid size ! Krylov solver data - call read_data(solve%kmethd,psb_inp_unit) ! Krylov solver - call read_data(solve%istopc,psb_inp_unit) ! stopping criterion - call read_data(solve%itmax,psb_inp_unit) ! max num iterations - call read_data(solve%itrace,psb_inp_unit) ! tracing - call read_data(solve%irst,psb_inp_unit) ! restart - call read_data(solve%eps,psb_inp_unit) ! tolerance + call read_data(solve%kmethd,inp_unit) ! Krylov solver + call read_data(solve%istopc,inp_unit) ! stopping criterion + call read_data(solve%itmax,inp_unit) ! max num iterations + call read_data(solve%itrace,inp_unit) ! tracing + call read_data(solve%irst,inp_unit) ! restart + call read_data(solve%eps,inp_unit) ! tolerance ! preconditioner type - call read_data(prec%descr,psb_inp_unit) ! verbose description of the prec - call read_data(prec%ptype,psb_inp_unit) ! preconditioner type + call read_data(prec%descr,inp_unit) ! verbose description of the prec + call read_data(prec%ptype,inp_unit) ! preconditioner type ! First smoother / 1-lev preconditioner - call read_data(prec%smther,psb_inp_unit) ! smoother type - call read_data(prec%jsweeps,psb_inp_unit) ! (pre-)smoother / 1-lev prec sweeps - call read_data(prec%novr,psb_inp_unit) ! number of overlap layers - call read_data(prec%restr,psb_inp_unit) ! restriction over application of AS - call read_data(prec%prol,psb_inp_unit) ! prolongation over application of AS - call read_data(prec%solve,psb_inp_unit) ! local subsolver - call read_data(prec%fill,psb_inp_unit) ! fill-in for incomplete LU - call read_data(prec%thr,psb_inp_unit) ! threshold for ILUT + call read_data(prec%smther,inp_unit) ! smoother type + call read_data(prec%jsweeps,inp_unit) ! (pre-)smoother / 1-lev prec sweeps + call read_data(prec%novr,inp_unit) ! number of overlap layers + call read_data(prec%restr,inp_unit) ! restriction over application of AS + call read_data(prec%prol,inp_unit) ! prolongation over application of AS + call read_data(prec%solve,inp_unit) ! local subsolver + call read_data(prec%fill,inp_unit) ! fill-in for incomplete LU + call read_data(prec%thr,inp_unit) ! threshold for ILUT ! Second smoother/ AMG post-smoother (if NONE ignored in main) - call read_data(prec%smther2,psb_inp_unit) ! smoother type - call read_data(prec%jsweeps2,psb_inp_unit) ! (post-)smoother sweeps - call read_data(prec%novr2,psb_inp_unit) ! number of overlap layers - call read_data(prec%restr2,psb_inp_unit) ! restriction over application of AS - call read_data(prec%prol2,psb_inp_unit) ! prolongation over application of AS - call read_data(prec%solve2,psb_inp_unit) ! local subsolver - call read_data(prec%fill2,psb_inp_unit) ! fill-in for incomplete LU - call read_data(prec%thr2,psb_inp_unit) ! threshold for ILUT + call read_data(prec%smther2,inp_unit) ! smoother type + call read_data(prec%jsweeps2,inp_unit) ! (post-)smoother sweeps + call read_data(prec%novr2,inp_unit) ! number of overlap layers + call read_data(prec%restr2,inp_unit) ! restriction over application of AS + call read_data(prec%prol2,inp_unit) ! prolongation over application of AS + call read_data(prec%solve2,inp_unit) ! local subsolver + call read_data(prec%fill2,inp_unit) ! fill-in for incomplete LU + call read_data(prec%thr2,inp_unit) ! threshold for ILUT ! general AMG data - call read_data(prec%mlcycle,psb_inp_unit) ! AMG cycle type - call read_data(prec%outer_sweeps,psb_inp_unit) ! number of 1lev/outer sweeps - call read_data(prec%maxlevs,psb_inp_unit) ! max number of levels in AMG prec - call read_data(prec%csize,psb_inp_unit) ! min size coarsest mat + call read_data(prec%mlcycle,inp_unit) ! AMG cycle type + call read_data(prec%outer_sweeps,inp_unit) ! number of 1lev/outer sweeps + call read_data(prec%maxlevs,inp_unit) ! max number of levels in AMG prec + call read_data(prec%csize,inp_unit) ! min size coarsest mat ! aggregation - call read_data(prec%aggr_prol,psb_inp_unit) ! aggregation type - call read_data(prec%par_aggr_alg,psb_inp_unit) ! parallel aggregation alg - call read_data(prec%aggr_ord,psb_inp_unit) ! ordering for aggregation - call read_data(prec%aggr_filter,psb_inp_unit) ! filtering - call read_data(prec%mncrratio,psb_inp_unit) ! minimum aggregation ratio - call read_data(prec%thrvsz,psb_inp_unit) ! size of aggr thresh vector + call read_data(prec%aggr_prol,inp_unit) ! aggregation type + call read_data(prec%par_aggr_alg,inp_unit) ! parallel aggregation alg + call read_data(prec%aggr_ord,inp_unit) ! ordering for aggregation + call read_data(prec%aggr_filter,inp_unit) ! filtering + call read_data(prec%mncrratio,inp_unit) ! minimum aggregation ratio + call read_data(prec%thrvsz,inp_unit) ! size of aggr thresh vector if (prec%thrvsz > 0) then call psb_realloc(prec%thrvsz,prec%athresv,info) - call read_data(prec%athresv,psb_inp_unit) ! aggr thresh vector + call read_data(prec%athresv,inp_unit) ! aggr thresh vector else - read(psb_inp_unit,*) ! dummy read to skip a record + read(inp_unit,*) ! dummy read to skip a record end if - call read_data(prec%athres,psb_inp_unit) ! smoothed aggr thresh + call read_data(prec%athres,inp_unit) ! smoothed aggr thresh ! coasest-level solver - call read_data(prec%csolve,psb_inp_unit) ! coarsest-lev solver - call read_data(prec%csbsolve,psb_inp_unit) ! coarsest-lev subsolver - call read_data(prec%cmat,psb_inp_unit) ! coarsest mat layout - call read_data(prec%cfill,psb_inp_unit) ! fill-in for incompl LU - call read_data(prec%cthres,psb_inp_unit) ! Threshold for ILUT - call read_data(prec%cjswp,psb_inp_unit) ! sweeps for GS/JAC subsolver + call read_data(prec%csolve,inp_unit) ! coarsest-lev solver + call read_data(prec%csbsolve,inp_unit) ! coarsest-lev subsolver + call read_data(prec%cmat,inp_unit) ! coarsest mat layout + call read_data(prec%cfill,inp_unit) ! fill-in for incompl LU + call read_data(prec%cthres,inp_unit) ! Threshold for ILUT + call read_data(prec%cjswp,inp_unit) ! sweeps for GS/JAC subsolver + if (inp_unit /= psb_inp_unit) then + close(inp_unit) + end if end if call psb_bcast(icontxt,afmt) diff --git a/tests/pdegen/mld_d_pde3d.f90 b/tests/pdegen/mld_d_pde3d.f90 index 2f17513c..63cb0ac3 100644 --- a/tests/pdegen/mld_d_pde3d.f90 +++ b/tests/pdegen/mld_d_pde3d.f90 @@ -844,69 +844,87 @@ contains character(len=*) :: afmt type(solverdata) :: solve type(precdata) :: prec - integer(psb_ipk_) :: iam, nm, np + integer(psb_ipk_) :: iam, nm, np, inp_unit + character(len=1024) :: filename call psb_info(icontxt,iam,np) if (iam == psb_root_) then + if (command_argument_count()>0) then + call get_command_argument(1,filename) + inp_unit = 30 + open(inp_unit,file=filename,action='read',iostat=info) + if (info /= 0) then + write(psb_err_unit,*) 'Could not open file ',filename,' for input' + call psb_abort(icontxt) + stop + else + write(psb_err_unit,*) 'Opened file ',trim(filename),' for input' + end if + else + inp_unit=psb_inp_unit + end if ! read input data ! - call read_data(afmt,psb_inp_unit) ! matrix storage format - call read_data(idim,psb_inp_unit) ! Discretization grid size + call read_data(afmt,inp_unit) ! matrix storage format + call read_data(idim,inp_unit) ! Discretization grid size ! Krylov solver data - call read_data(solve%kmethd,psb_inp_unit) ! Krylov solver - call read_data(solve%istopc,psb_inp_unit) ! stopping criterion - call read_data(solve%itmax,psb_inp_unit) ! max num iterations - call read_data(solve%itrace,psb_inp_unit) ! tracing - call read_data(solve%irst,psb_inp_unit) ! restart - call read_data(solve%eps,psb_inp_unit) ! tolerance + call read_data(solve%kmethd,inp_unit) ! Krylov solver + call read_data(solve%istopc,inp_unit) ! stopping criterion + call read_data(solve%itmax,inp_unit) ! max num iterations + call read_data(solve%itrace,inp_unit) ! tracing + call read_data(solve%irst,inp_unit) ! restart + call read_data(solve%eps,inp_unit) ! tolerance ! preconditioner type - call read_data(prec%descr,psb_inp_unit) ! verbose description of the prec - call read_data(prec%ptype,psb_inp_unit) ! preconditioner type + call read_data(prec%descr,inp_unit) ! verbose description of the prec + call read_data(prec%ptype,inp_unit) ! preconditioner type ! First smoother / 1-lev preconditioner - call read_data(prec%smther,psb_inp_unit) ! smoother type - call read_data(prec%jsweeps,psb_inp_unit) ! (pre-)smoother / 1-lev prec sweeps - call read_data(prec%novr,psb_inp_unit) ! number of overlap layers - call read_data(prec%restr,psb_inp_unit) ! restriction over application of AS - call read_data(prec%prol,psb_inp_unit) ! prolongation over application of AS - call read_data(prec%solve,psb_inp_unit) ! local subsolver - call read_data(prec%fill,psb_inp_unit) ! fill-in for incomplete LU - call read_data(prec%thr,psb_inp_unit) ! threshold for ILUT + call read_data(prec%smther,inp_unit) ! smoother type + call read_data(prec%jsweeps,inp_unit) ! (pre-)smoother / 1-lev prec sweeps + call read_data(prec%novr,inp_unit) ! number of overlap layers + call read_data(prec%restr,inp_unit) ! restriction over application of AS + call read_data(prec%prol,inp_unit) ! prolongation over application of AS + call read_data(prec%solve,inp_unit) ! local subsolver + call read_data(prec%fill,inp_unit) ! fill-in for incomplete LU + call read_data(prec%thr,inp_unit) ! threshold for ILUT ! Second smoother/ AMG post-smoother (if NONE ignored in main) - call read_data(prec%smther2,psb_inp_unit) ! smoother type - call read_data(prec%jsweeps2,psb_inp_unit) ! (post-)smoother sweeps - call read_data(prec%novr2,psb_inp_unit) ! number of overlap layers - call read_data(prec%restr2,psb_inp_unit) ! restriction over application of AS - call read_data(prec%prol2,psb_inp_unit) ! prolongation over application of AS - call read_data(prec%solve2,psb_inp_unit) ! local subsolver - call read_data(prec%fill2,psb_inp_unit) ! fill-in for incomplete LU - call read_data(prec%thr2,psb_inp_unit) ! threshold for ILUT + call read_data(prec%smther2,inp_unit) ! smoother type + call read_data(prec%jsweeps2,inp_unit) ! (post-)smoother sweeps + call read_data(prec%novr2,inp_unit) ! number of overlap layers + call read_data(prec%restr2,inp_unit) ! restriction over application of AS + call read_data(prec%prol2,inp_unit) ! prolongation over application of AS + call read_data(prec%solve2,inp_unit) ! local subsolver + call read_data(prec%fill2,inp_unit) ! fill-in for incomplete LU + call read_data(prec%thr2,inp_unit) ! threshold for ILUT ! general AMG data - call read_data(prec%mlcycle,psb_inp_unit) ! AMG cycle type - call read_data(prec%outer_sweeps,psb_inp_unit) ! number of 1lev/outer sweeps - call read_data(prec%maxlevs,psb_inp_unit) ! max number of levels in AMG prec - call read_data(prec%csize,psb_inp_unit) ! min size coarsest mat + call read_data(prec%mlcycle,inp_unit) ! AMG cycle type + call read_data(prec%outer_sweeps,inp_unit) ! number of 1lev/outer sweeps + call read_data(prec%maxlevs,inp_unit) ! max number of levels in AMG prec + call read_data(prec%csize,inp_unit) ! min size coarsest mat ! aggregation - call read_data(prec%aggr_prol,psb_inp_unit) ! aggregation type - call read_data(prec%par_aggr_alg,psb_inp_unit) ! parallel aggregation alg - call read_data(prec%aggr_ord,psb_inp_unit) ! ordering for aggregation - call read_data(prec%aggr_filter,psb_inp_unit) ! filtering - call read_data(prec%mncrratio,psb_inp_unit) ! minimum aggregation ratio - call read_data(prec%thrvsz,psb_inp_unit) ! size of aggr thresh vector + call read_data(prec%aggr_prol,inp_unit) ! aggregation type + call read_data(prec%par_aggr_alg,inp_unit) ! parallel aggregation alg + call read_data(prec%aggr_ord,inp_unit) ! ordering for aggregation + call read_data(prec%aggr_filter,inp_unit) ! filtering + call read_data(prec%mncrratio,inp_unit) ! minimum aggregation ratio + call read_data(prec%thrvsz,inp_unit) ! size of aggr thresh vector if (prec%thrvsz > 0) then call psb_realloc(prec%thrvsz,prec%athresv,info) - call read_data(prec%athresv,psb_inp_unit) ! aggr thresh vector + call read_data(prec%athresv,inp_unit) ! aggr thresh vector else - read(psb_inp_unit,*) ! dummy read to skip a record + read(inp_unit,*) ! dummy read to skip a record end if - call read_data(prec%athres,psb_inp_unit) ! smoothed aggr thresh + call read_data(prec%athres,inp_unit) ! smoothed aggr thresh ! coasest-level solver - call read_data(prec%csolve,psb_inp_unit) ! coarsest-lev solver - call read_data(prec%csbsolve,psb_inp_unit) ! coarsest-lev subsolver - call read_data(prec%cmat,psb_inp_unit) ! coarsest mat layout - call read_data(prec%cfill,psb_inp_unit) ! fill-in for incompl LU - call read_data(prec%cthres,psb_inp_unit) ! Threshold for ILUT - call read_data(prec%cjswp,psb_inp_unit) ! sweeps for GS/JAC subsolver + call read_data(prec%csolve,inp_unit) ! coarsest-lev solver + call read_data(prec%csbsolve,inp_unit) ! coarsest-lev subsolver + call read_data(prec%cmat,inp_unit) ! coarsest mat layout + call read_data(prec%cfill,inp_unit) ! fill-in for incompl LU + call read_data(prec%cthres,inp_unit) ! Threshold for ILUT + call read_data(prec%cjswp,inp_unit) ! sweeps for GS/JAC subsolver + if (inp_unit /= psb_inp_unit) then + close(inp_unit) + end if end if call psb_bcast(icontxt,afmt) diff --git a/tests/pdegen/mld_s_pde2d.f90 b/tests/pdegen/mld_s_pde2d.f90 index ef3e825f..01bd11d7 100644 --- a/tests/pdegen/mld_s_pde2d.f90 +++ b/tests/pdegen/mld_s_pde2d.f90 @@ -790,69 +790,87 @@ contains character(len=*) :: afmt type(solverdata) :: solve type(precdata) :: prec - integer(psb_ipk_) :: iam, nm, np + integer(psb_ipk_) :: iam, nm, np, inp_unit + character(len=1024) :: filename call psb_info(icontxt,iam,np) if (iam == psb_root_) then + if (command_argument_count()>0) then + call get_command_argument(1,filename) + inp_unit = 30 + open(inp_unit,file=filename,action='read',iostat=info) + if (info /= 0) then + write(psb_err_unit,*) 'Could not open file ',filename,' for input' + call psb_abort(icontxt) + stop + else + write(psb_err_unit,*) 'Opened file ',trim(filename),' for input' + end if + else + inp_unit=psb_inp_unit + end if ! read input data ! - call read_data(afmt,psb_inp_unit) ! matrix storage format - call read_data(idim,psb_inp_unit) ! Discretization grid size + call read_data(afmt,inp_unit) ! matrix storage format + call read_data(idim,inp_unit) ! Discretization grid size ! Krylov solver data - call read_data(solve%kmethd,psb_inp_unit) ! Krylov solver - call read_data(solve%istopc,psb_inp_unit) ! stopping criterion - call read_data(solve%itmax,psb_inp_unit) ! max num iterations - call read_data(solve%itrace,psb_inp_unit) ! tracing - call read_data(solve%irst,psb_inp_unit) ! restart - call read_data(solve%eps,psb_inp_unit) ! tolerance + call read_data(solve%kmethd,inp_unit) ! Krylov solver + call read_data(solve%istopc,inp_unit) ! stopping criterion + call read_data(solve%itmax,inp_unit) ! max num iterations + call read_data(solve%itrace,inp_unit) ! tracing + call read_data(solve%irst,inp_unit) ! restart + call read_data(solve%eps,inp_unit) ! tolerance ! preconditioner type - call read_data(prec%descr,psb_inp_unit) ! verbose description of the prec - call read_data(prec%ptype,psb_inp_unit) ! preconditioner type + call read_data(prec%descr,inp_unit) ! verbose description of the prec + call read_data(prec%ptype,inp_unit) ! preconditioner type ! First smoother / 1-lev preconditioner - call read_data(prec%smther,psb_inp_unit) ! smoother type - call read_data(prec%jsweeps,psb_inp_unit) ! (pre-)smoother / 1-lev prec sweeps - call read_data(prec%novr,psb_inp_unit) ! number of overlap layers - call read_data(prec%restr,psb_inp_unit) ! restriction over application of AS - call read_data(prec%prol,psb_inp_unit) ! prolongation over application of AS - call read_data(prec%solve,psb_inp_unit) ! local subsolver - call read_data(prec%fill,psb_inp_unit) ! fill-in for incomplete LU - call read_data(prec%thr,psb_inp_unit) ! threshold for ILUT + call read_data(prec%smther,inp_unit) ! smoother type + call read_data(prec%jsweeps,inp_unit) ! (pre-)smoother / 1-lev prec sweeps + call read_data(prec%novr,inp_unit) ! number of overlap layers + call read_data(prec%restr,inp_unit) ! restriction over application of AS + call read_data(prec%prol,inp_unit) ! prolongation over application of AS + call read_data(prec%solve,inp_unit) ! local subsolver + call read_data(prec%fill,inp_unit) ! fill-in for incomplete LU + call read_data(prec%thr,inp_unit) ! threshold for ILUT ! Second smoother/ AMG post-smoother (if NONE ignored in main) - call read_data(prec%smther2,psb_inp_unit) ! smoother type - call read_data(prec%jsweeps2,psb_inp_unit) ! (post-)smoother sweeps - call read_data(prec%novr2,psb_inp_unit) ! number of overlap layers - call read_data(prec%restr2,psb_inp_unit) ! restriction over application of AS - call read_data(prec%prol2,psb_inp_unit) ! prolongation over application of AS - call read_data(prec%solve2,psb_inp_unit) ! local subsolver - call read_data(prec%fill2,psb_inp_unit) ! fill-in for incomplete LU - call read_data(prec%thr2,psb_inp_unit) ! threshold for ILUT + call read_data(prec%smther2,inp_unit) ! smoother type + call read_data(prec%jsweeps2,inp_unit) ! (post-)smoother sweeps + call read_data(prec%novr2,inp_unit) ! number of overlap layers + call read_data(prec%restr2,inp_unit) ! restriction over application of AS + call read_data(prec%prol2,inp_unit) ! prolongation over application of AS + call read_data(prec%solve2,inp_unit) ! local subsolver + call read_data(prec%fill2,inp_unit) ! fill-in for incomplete LU + call read_data(prec%thr2,inp_unit) ! threshold for ILUT ! general AMG data - call read_data(prec%mlcycle,psb_inp_unit) ! AMG cycle type - call read_data(prec%outer_sweeps,psb_inp_unit) ! number of 1lev/outer sweeps - call read_data(prec%maxlevs,psb_inp_unit) ! max number of levels in AMG prec - call read_data(prec%csize,psb_inp_unit) ! min size coarsest mat + call read_data(prec%mlcycle,inp_unit) ! AMG cycle type + call read_data(prec%outer_sweeps,inp_unit) ! number of 1lev/outer sweeps + call read_data(prec%maxlevs,inp_unit) ! max number of levels in AMG prec + call read_data(prec%csize,inp_unit) ! min size coarsest mat ! aggregation - call read_data(prec%aggr_prol,psb_inp_unit) ! aggregation type - call read_data(prec%par_aggr_alg,psb_inp_unit) ! parallel aggregation alg - call read_data(prec%aggr_ord,psb_inp_unit) ! ordering for aggregation - call read_data(prec%aggr_filter,psb_inp_unit) ! filtering - call read_data(prec%mncrratio,psb_inp_unit) ! minimum aggregation ratio - call read_data(prec%thrvsz,psb_inp_unit) ! size of aggr thresh vector + call read_data(prec%aggr_prol,inp_unit) ! aggregation type + call read_data(prec%par_aggr_alg,inp_unit) ! parallel aggregation alg + call read_data(prec%aggr_ord,inp_unit) ! ordering for aggregation + call read_data(prec%aggr_filter,inp_unit) ! filtering + call read_data(prec%mncrratio,inp_unit) ! minimum aggregation ratio + call read_data(prec%thrvsz,inp_unit) ! size of aggr thresh vector if (prec%thrvsz > 0) then call psb_realloc(prec%thrvsz,prec%athresv,info) - call read_data(prec%athresv,psb_inp_unit) ! aggr thresh vector + call read_data(prec%athresv,inp_unit) ! aggr thresh vector else - read(psb_inp_unit,*) ! dummy read to skip a record + read(inp_unit,*) ! dummy read to skip a record end if - call read_data(prec%athres,psb_inp_unit) ! smoothed aggr thresh + call read_data(prec%athres,inp_unit) ! smoothed aggr thresh ! coasest-level solver - call read_data(prec%csolve,psb_inp_unit) ! coarsest-lev solver - call read_data(prec%csbsolve,psb_inp_unit) ! coarsest-lev subsolver - call read_data(prec%cmat,psb_inp_unit) ! coarsest mat layout - call read_data(prec%cfill,psb_inp_unit) ! fill-in for incompl LU - call read_data(prec%cthres,psb_inp_unit) ! Threshold for ILUT - call read_data(prec%cjswp,psb_inp_unit) ! sweeps for GS/JAC subsolver + call read_data(prec%csolve,inp_unit) ! coarsest-lev solver + call read_data(prec%csbsolve,inp_unit) ! coarsest-lev subsolver + call read_data(prec%cmat,inp_unit) ! coarsest mat layout + call read_data(prec%cfill,inp_unit) ! fill-in for incompl LU + call read_data(prec%cthres,inp_unit) ! Threshold for ILUT + call read_data(prec%cjswp,inp_unit) ! sweeps for GS/JAC subsolver + if (inp_unit /= psb_inp_unit) then + close(inp_unit) + end if end if call psb_bcast(icontxt,afmt) diff --git a/tests/pdegen/mld_s_pde3d.f90 b/tests/pdegen/mld_s_pde3d.f90 index 7879e29a..6c7384d9 100644 --- a/tests/pdegen/mld_s_pde3d.f90 +++ b/tests/pdegen/mld_s_pde3d.f90 @@ -844,69 +844,87 @@ contains character(len=*) :: afmt type(solverdata) :: solve type(precdata) :: prec - integer(psb_ipk_) :: iam, nm, np + integer(psb_ipk_) :: iam, nm, np, inp_unit + character(len=1024) :: filename call psb_info(icontxt,iam,np) if (iam == psb_root_) then + if (command_argument_count()>0) then + call get_command_argument(1,filename) + inp_unit = 30 + open(inp_unit,file=filename,action='read',iostat=info) + if (info /= 0) then + write(psb_err_unit,*) 'Could not open file ',filename,' for input' + call psb_abort(icontxt) + stop + else + write(psb_err_unit,*) 'Opened file ',trim(filename),' for input' + end if + else + inp_unit=psb_inp_unit + end if ! read input data ! - call read_data(afmt,psb_inp_unit) ! matrix storage format - call read_data(idim,psb_inp_unit) ! Discretization grid size + call read_data(afmt,inp_unit) ! matrix storage format + call read_data(idim,inp_unit) ! Discretization grid size ! Krylov solver data - call read_data(solve%kmethd,psb_inp_unit) ! Krylov solver - call read_data(solve%istopc,psb_inp_unit) ! stopping criterion - call read_data(solve%itmax,psb_inp_unit) ! max num iterations - call read_data(solve%itrace,psb_inp_unit) ! tracing - call read_data(solve%irst,psb_inp_unit) ! restart - call read_data(solve%eps,psb_inp_unit) ! tolerance + call read_data(solve%kmethd,inp_unit) ! Krylov solver + call read_data(solve%istopc,inp_unit) ! stopping criterion + call read_data(solve%itmax,inp_unit) ! max num iterations + call read_data(solve%itrace,inp_unit) ! tracing + call read_data(solve%irst,inp_unit) ! restart + call read_data(solve%eps,inp_unit) ! tolerance ! preconditioner type - call read_data(prec%descr,psb_inp_unit) ! verbose description of the prec - call read_data(prec%ptype,psb_inp_unit) ! preconditioner type + call read_data(prec%descr,inp_unit) ! verbose description of the prec + call read_data(prec%ptype,inp_unit) ! preconditioner type ! First smoother / 1-lev preconditioner - call read_data(prec%smther,psb_inp_unit) ! smoother type - call read_data(prec%jsweeps,psb_inp_unit) ! (pre-)smoother / 1-lev prec sweeps - call read_data(prec%novr,psb_inp_unit) ! number of overlap layers - call read_data(prec%restr,psb_inp_unit) ! restriction over application of AS - call read_data(prec%prol,psb_inp_unit) ! prolongation over application of AS - call read_data(prec%solve,psb_inp_unit) ! local subsolver - call read_data(prec%fill,psb_inp_unit) ! fill-in for incomplete LU - call read_data(prec%thr,psb_inp_unit) ! threshold for ILUT + call read_data(prec%smther,inp_unit) ! smoother type + call read_data(prec%jsweeps,inp_unit) ! (pre-)smoother / 1-lev prec sweeps + call read_data(prec%novr,inp_unit) ! number of overlap layers + call read_data(prec%restr,inp_unit) ! restriction over application of AS + call read_data(prec%prol,inp_unit) ! prolongation over application of AS + call read_data(prec%solve,inp_unit) ! local subsolver + call read_data(prec%fill,inp_unit) ! fill-in for incomplete LU + call read_data(prec%thr,inp_unit) ! threshold for ILUT ! Second smoother/ AMG post-smoother (if NONE ignored in main) - call read_data(prec%smther2,psb_inp_unit) ! smoother type - call read_data(prec%jsweeps2,psb_inp_unit) ! (post-)smoother sweeps - call read_data(prec%novr2,psb_inp_unit) ! number of overlap layers - call read_data(prec%restr2,psb_inp_unit) ! restriction over application of AS - call read_data(prec%prol2,psb_inp_unit) ! prolongation over application of AS - call read_data(prec%solve2,psb_inp_unit) ! local subsolver - call read_data(prec%fill2,psb_inp_unit) ! fill-in for incomplete LU - call read_data(prec%thr2,psb_inp_unit) ! threshold for ILUT + call read_data(prec%smther2,inp_unit) ! smoother type + call read_data(prec%jsweeps2,inp_unit) ! (post-)smoother sweeps + call read_data(prec%novr2,inp_unit) ! number of overlap layers + call read_data(prec%restr2,inp_unit) ! restriction over application of AS + call read_data(prec%prol2,inp_unit) ! prolongation over application of AS + call read_data(prec%solve2,inp_unit) ! local subsolver + call read_data(prec%fill2,inp_unit) ! fill-in for incomplete LU + call read_data(prec%thr2,inp_unit) ! threshold for ILUT ! general AMG data - call read_data(prec%mlcycle,psb_inp_unit) ! AMG cycle type - call read_data(prec%outer_sweeps,psb_inp_unit) ! number of 1lev/outer sweeps - call read_data(prec%maxlevs,psb_inp_unit) ! max number of levels in AMG prec - call read_data(prec%csize,psb_inp_unit) ! min size coarsest mat + call read_data(prec%mlcycle,inp_unit) ! AMG cycle type + call read_data(prec%outer_sweeps,inp_unit) ! number of 1lev/outer sweeps + call read_data(prec%maxlevs,inp_unit) ! max number of levels in AMG prec + call read_data(prec%csize,inp_unit) ! min size coarsest mat ! aggregation - call read_data(prec%aggr_prol,psb_inp_unit) ! aggregation type - call read_data(prec%par_aggr_alg,psb_inp_unit) ! parallel aggregation alg - call read_data(prec%aggr_ord,psb_inp_unit) ! ordering for aggregation - call read_data(prec%aggr_filter,psb_inp_unit) ! filtering - call read_data(prec%mncrratio,psb_inp_unit) ! minimum aggregation ratio - call read_data(prec%thrvsz,psb_inp_unit) ! size of aggr thresh vector + call read_data(prec%aggr_prol,inp_unit) ! aggregation type + call read_data(prec%par_aggr_alg,inp_unit) ! parallel aggregation alg + call read_data(prec%aggr_ord,inp_unit) ! ordering for aggregation + call read_data(prec%aggr_filter,inp_unit) ! filtering + call read_data(prec%mncrratio,inp_unit) ! minimum aggregation ratio + call read_data(prec%thrvsz,inp_unit) ! size of aggr thresh vector if (prec%thrvsz > 0) then call psb_realloc(prec%thrvsz,prec%athresv,info) - call read_data(prec%athresv,psb_inp_unit) ! aggr thresh vector + call read_data(prec%athresv,inp_unit) ! aggr thresh vector else - read(psb_inp_unit,*) ! dummy read to skip a record + read(inp_unit,*) ! dummy read to skip a record end if - call read_data(prec%athres,psb_inp_unit) ! smoothed aggr thresh + call read_data(prec%athres,inp_unit) ! smoothed aggr thresh ! coasest-level solver - call read_data(prec%csolve,psb_inp_unit) ! coarsest-lev solver - call read_data(prec%csbsolve,psb_inp_unit) ! coarsest-lev subsolver - call read_data(prec%cmat,psb_inp_unit) ! coarsest mat layout - call read_data(prec%cfill,psb_inp_unit) ! fill-in for incompl LU - call read_data(prec%cthres,psb_inp_unit) ! Threshold for ILUT - call read_data(prec%cjswp,psb_inp_unit) ! sweeps for GS/JAC subsolver + call read_data(prec%csolve,inp_unit) ! coarsest-lev solver + call read_data(prec%csbsolve,inp_unit) ! coarsest-lev subsolver + call read_data(prec%cmat,inp_unit) ! coarsest mat layout + call read_data(prec%cfill,inp_unit) ! fill-in for incompl LU + call read_data(prec%cthres,inp_unit) ! Threshold for ILUT + call read_data(prec%cjswp,inp_unit) ! sweeps for GS/JAC subsolver + if (inp_unit /= psb_inp_unit) then + close(inp_unit) + end if end if call psb_bcast(icontxt,afmt)