mirror of
https://github.com/sfilippone/psblas3.git
synced 2026-10-18 20:02:27 +00:00
Test programs can take input file on command line.
This commit is contained in:
+64
-28
@@ -50,20 +50,35 @@ contains
|
||||
real(psb_dpk_) :: eps
|
||||
character :: afmt*5
|
||||
integer(psb_ipk_) :: np, iam
|
||||
integer(psb_ipk_) :: inparms(40), ip
|
||||
integer(psb_ipk_) :: inparms(40), ip, inp_unit
|
||||
character(len=1024) :: filename
|
||||
|
||||
call psb_info(ictxt,iam,np)
|
||||
if (iam == 0) 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
|
||||
read(psb_inp_unit,*) ip
|
||||
read(inp_unit,*) ip
|
||||
if (ip >= 5) then
|
||||
read(psb_inp_unit,*) mtrx_file
|
||||
read(psb_inp_unit,*) rhs_file
|
||||
read(psb_inp_unit,*) filefmt
|
||||
read(psb_inp_unit,*) kmethd
|
||||
read(psb_inp_unit,*) ptype
|
||||
read(psb_inp_unit,*) afmt
|
||||
read(psb_inp_unit,*) part
|
||||
read(inp_unit,*) mtrx_file
|
||||
read(inp_unit,*) rhs_file
|
||||
read(inp_unit,*) filefmt
|
||||
read(inp_unit,*) kmethd
|
||||
read(inp_unit,*) ptype
|
||||
read(inp_unit,*) afmt
|
||||
read(inp_unit,*) part
|
||||
|
||||
|
||||
call psb_bcast(ictxt,mtrx_file)
|
||||
@@ -75,27 +90,27 @@ contains
|
||||
call psb_bcast(ictxt,part)
|
||||
|
||||
if (ip >= 7) then
|
||||
read(psb_inp_unit,*) istopc
|
||||
read(inp_unit,*) istopc
|
||||
else
|
||||
istopc=1
|
||||
endif
|
||||
if (ip >= 8) then
|
||||
read(psb_inp_unit,*) itmax
|
||||
read(inp_unit,*) itmax
|
||||
else
|
||||
itmax=500
|
||||
endif
|
||||
if (ip >= 9) then
|
||||
read(psb_inp_unit,*) itrace
|
||||
read(inp_unit,*) itrace
|
||||
else
|
||||
itrace=-1
|
||||
endif
|
||||
if (ip >= 10) then
|
||||
read(psb_inp_unit,*) irst
|
||||
read(inp_unit,*) irst
|
||||
else
|
||||
irst = 1
|
||||
endif
|
||||
if (ip >= 11) then
|
||||
read(psb_inp_unit,*) eps
|
||||
read(inp_unit,*) eps
|
||||
else
|
||||
eps=1.d-6
|
||||
endif
|
||||
@@ -119,6 +134,9 @@ contains
|
||||
call psb_abort(ictxt)
|
||||
stop 1
|
||||
end if
|
||||
if (inp_unit /= psb_inp_unit) then
|
||||
close(inp_unit)
|
||||
end if
|
||||
else
|
||||
! Receive Parameters
|
||||
call psb_bcast(ictxt,mtrx_file)
|
||||
@@ -152,20 +170,35 @@ contains
|
||||
real(psb_spk_) :: eps
|
||||
character :: afmt*5
|
||||
integer(psb_ipk_) :: np, iam
|
||||
integer(psb_ipk_) :: inparms(40), ip
|
||||
integer(psb_ipk_) :: inparms(40), ip, inp_unit
|
||||
character(len=1024) :: filename
|
||||
|
||||
call psb_info(ictxt,iam,np)
|
||||
if (iam == 0) 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=inp_unit
|
||||
end if
|
||||
! Read Input Parameters
|
||||
read(psb_inp_unit,*) ip
|
||||
read(inp_unit,*) ip
|
||||
if (ip >= 5) then
|
||||
read(psb_inp_unit,*) mtrx_file
|
||||
read(psb_inp_unit,*) rhs_file
|
||||
read(psb_inp_unit,*) filefmt
|
||||
read(psb_inp_unit,*) kmethd
|
||||
read(psb_inp_unit,*) ptype
|
||||
read(psb_inp_unit,*) afmt
|
||||
read(psb_inp_unit,*) ipart
|
||||
read(inp_unit,*) mtrx_file
|
||||
read(inp_unit,*) rhs_file
|
||||
read(inp_unit,*) filefmt
|
||||
read(inp_unit,*) kmethd
|
||||
read(inp_unit,*) ptype
|
||||
read(inp_unit,*) afmt
|
||||
read(inp_unit,*) ipart
|
||||
|
||||
|
||||
call psb_bcast(ictxt,mtrx_file)
|
||||
@@ -177,27 +210,27 @@ contains
|
||||
call psb_bcast(ictxt,part)
|
||||
|
||||
if (ip >= 7) then
|
||||
read(psb_inp_unit,*) istopc
|
||||
read(inp_unit,*) istopc
|
||||
else
|
||||
istopc=1
|
||||
endif
|
||||
if (ip >= 8) then
|
||||
read(psb_inp_unit,*) itmax
|
||||
read(inp_unit,*) itmax
|
||||
else
|
||||
itmax=500
|
||||
endif
|
||||
if (ip >= 9) then
|
||||
read(psb_inp_unit,*) itrace
|
||||
read(inp_unit,*) itrace
|
||||
else
|
||||
itrace=-1
|
||||
endif
|
||||
if (ip >= 10) then
|
||||
read(psb_inp_unit,*) irst
|
||||
read(inp_unit,*) irst
|
||||
else
|
||||
irst = 1
|
||||
endif
|
||||
if (ip >= 11) then
|
||||
read(psb_inp_unit,*) eps
|
||||
read(inp_unit,*) eps
|
||||
else
|
||||
eps=1.d-6
|
||||
endif
|
||||
@@ -221,6 +254,9 @@ contains
|
||||
call psb_abort(ictxt)
|
||||
stop 1
|
||||
end if
|
||||
if (inp_unit /= psb_inp_unit) then
|
||||
close(inp_unit)
|
||||
end if
|
||||
else
|
||||
! Receive Parameters
|
||||
call psb_bcast(ictxt,mtrx_file)
|
||||
|
||||
+29
-12
@@ -558,35 +558,50 @@ contains
|
||||
character(len=*) :: kmethd, ptype, afmt
|
||||
integer(psb_ipk_) :: idim, istopc,itmax,itrace,irst
|
||||
integer(psb_ipk_) :: np, iam
|
||||
integer(psb_ipk_) :: ip
|
||||
integer(psb_ipk_) :: ip, inp_unit
|
||||
character(len=1024) :: filename
|
||||
|
||||
call psb_info(ictxt, iam, np)
|
||||
|
||||
if (iam == 0) then
|
||||
read(psb_inp_unit,*) ip
|
||||
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(inp_unit,*) ip
|
||||
if (ip >= 3) then
|
||||
read(psb_inp_unit,*) kmethd
|
||||
read(psb_inp_unit,*) ptype
|
||||
read(psb_inp_unit,*) afmt
|
||||
read(inp_unit,*) kmethd
|
||||
read(inp_unit,*) ptype
|
||||
read(inp_unit,*) afmt
|
||||
|
||||
read(psb_inp_unit,*) idim
|
||||
read(inp_unit,*) idim
|
||||
if (ip >= 4) then
|
||||
read(psb_inp_unit,*) istopc
|
||||
read(inp_unit,*) istopc
|
||||
else
|
||||
istopc=1
|
||||
endif
|
||||
if (ip >= 5) then
|
||||
read(psb_inp_unit,*) itmax
|
||||
read(inp_unit,*) itmax
|
||||
else
|
||||
itmax=500
|
||||
endif
|
||||
if (ip >= 6) then
|
||||
read(psb_inp_unit,*) itrace
|
||||
read(inp_unit,*) itrace
|
||||
else
|
||||
itrace=-1
|
||||
endif
|
||||
if (ip >= 7) then
|
||||
read(psb_inp_unit,*) irst
|
||||
read(inp_unit,*) irst
|
||||
else
|
||||
irst=1
|
||||
endif
|
||||
@@ -604,8 +619,11 @@ contains
|
||||
call psb_abort(ictxt)
|
||||
stop 1
|
||||
endif
|
||||
end if
|
||||
if (inp_unit /= psb_inp_unit) then
|
||||
close(inp_unit)
|
||||
end if
|
||||
|
||||
end if
|
||||
! broadcast parameters to all processors
|
||||
call psb_bcast(ictxt,kmethd)
|
||||
call psb_bcast(ictxt,afmt)
|
||||
@@ -616,7 +634,6 @@ contains
|
||||
call psb_bcast(ictxt,itrace)
|
||||
call psb_bcast(ictxt,irst)
|
||||
|
||||
|
||||
return
|
||||
|
||||
end subroutine get_parms
|
||||
|
||||
+29
-11
@@ -586,36 +586,50 @@ contains
|
||||
character(len=*) :: kmethd, ptype, afmt
|
||||
integer(psb_ipk_) :: idim, istopc,itmax,itrace,irst
|
||||
integer(psb_ipk_) :: np, iam
|
||||
integer(psb_ipk_) :: ip
|
||||
integer(psb_ipk_) :: ip, inp_unit
|
||||
character(len=1024) :: filename
|
||||
|
||||
call psb_info(ictxt, iam, np)
|
||||
|
||||
if (iam == 0) then
|
||||
read(psb_inp_unit,*) ip
|
||||
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(inp_unit,*) ip
|
||||
if (ip >= 3) then
|
||||
read(psb_inp_unit,*) kmethd
|
||||
read(psb_inp_unit,*) ptype
|
||||
read(psb_inp_unit,*) afmt
|
||||
read(inp_unit,*) kmethd
|
||||
read(inp_unit,*) ptype
|
||||
read(inp_unit,*) afmt
|
||||
|
||||
|
||||
read(psb_inp_unit,*) idim
|
||||
read(inp_unit,*) idim
|
||||
if (ip >= 4) then
|
||||
read(psb_inp_unit,*) istopc
|
||||
read(inp_unit,*) istopc
|
||||
else
|
||||
istopc=1
|
||||
endif
|
||||
if (ip >= 5) then
|
||||
read(psb_inp_unit,*) itmax
|
||||
read(inp_unit,*) itmax
|
||||
else
|
||||
itmax=500
|
||||
endif
|
||||
if (ip >= 6) then
|
||||
read(psb_inp_unit,*) itrace
|
||||
read(inp_unit,*) itrace
|
||||
else
|
||||
itrace=-1
|
||||
endif
|
||||
if (ip >= 7) then
|
||||
read(psb_inp_unit,*) irst
|
||||
read(inp_unit,*) irst
|
||||
else
|
||||
irst=1
|
||||
endif
|
||||
@@ -637,6 +651,10 @@ contains
|
||||
call psb_abort(ictxt)
|
||||
stop 1
|
||||
endif
|
||||
if (inp_unit /= psb_inp_unit) then
|
||||
close(inp_unit)
|
||||
end if
|
||||
|
||||
end if
|
||||
! broadcast parameters to all processors
|
||||
call psb_bcast(ictxt,kmethd)
|
||||
|
||||
+29
-11
@@ -543,35 +543,50 @@ contains
|
||||
character(len=*) :: kmethd, ptype, afmt
|
||||
integer(psb_ipk_) :: idim, istopc,itmax,itrace,irst
|
||||
integer(psb_ipk_) :: np, iam
|
||||
integer(psb_ipk_) :: ip
|
||||
integer(psb_ipk_) :: ip, inp_unit
|
||||
character(len=1024) :: filename
|
||||
|
||||
call psb_info(ictxt, iam, np)
|
||||
|
||||
if (iam == 0) then
|
||||
read(psb_inp_unit,*) ip
|
||||
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(inp_unit,*) ip
|
||||
if (ip >= 3) then
|
||||
read(psb_inp_unit,*) kmethd
|
||||
read(psb_inp_unit,*) ptype
|
||||
read(psb_inp_unit,*) afmt
|
||||
read(inp_unit,*) kmethd
|
||||
read(inp_unit,*) ptype
|
||||
read(inp_unit,*) afmt
|
||||
|
||||
read(psb_inp_unit,*) idim
|
||||
read(inp_unit,*) idim
|
||||
if (ip >= 4) then
|
||||
read(psb_inp_unit,*) istopc
|
||||
read(inp_unit,*) istopc
|
||||
else
|
||||
istopc=1
|
||||
endif
|
||||
if (ip >= 5) then
|
||||
read(psb_inp_unit,*) itmax
|
||||
read(inp_unit,*) itmax
|
||||
else
|
||||
itmax=500
|
||||
endif
|
||||
if (ip >= 6) then
|
||||
read(psb_inp_unit,*) itrace
|
||||
read(inp_unit,*) itrace
|
||||
else
|
||||
itrace=-1
|
||||
endif
|
||||
if (ip >= 7) then
|
||||
read(psb_inp_unit,*) irst
|
||||
read(inp_unit,*) irst
|
||||
else
|
||||
irst=1
|
||||
endif
|
||||
@@ -589,6 +604,10 @@ contains
|
||||
call psb_abort(ictxt)
|
||||
stop 1
|
||||
endif
|
||||
if (inp_unit /= psb_inp_unit) then
|
||||
close(inp_unit)
|
||||
end if
|
||||
|
||||
end if
|
||||
! broadcast parameters to all processors
|
||||
call psb_bcast(ictxt,kmethd)
|
||||
@@ -600,7 +619,6 @@ contains
|
||||
call psb_bcast(ictxt,itrace)
|
||||
call psb_bcast(ictxt,irst)
|
||||
|
||||
|
||||
return
|
||||
|
||||
end subroutine get_parms
|
||||
|
||||
+31
-11
@@ -570,38 +570,55 @@ contains
|
||||
character(len=*) :: kmethd, ptype, afmt
|
||||
integer(psb_ipk_) :: idim, istopc,itmax,itrace,irst
|
||||
integer(psb_ipk_) :: np, iam
|
||||
integer(psb_ipk_) :: ip
|
||||
integer(psb_ipk_) :: ip, inp_unit
|
||||
character(len=1024) :: filename
|
||||
|
||||
call psb_info(ictxt, iam, np)
|
||||
|
||||
if (iam == 0) then
|
||||
read(psb_inp_unit,*) ip
|
||||
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(inp_unit,*) ip
|
||||
if (ip >= 3) then
|
||||
read(psb_inp_unit,*) kmethd
|
||||
read(psb_inp_unit,*) ptype
|
||||
read(psb_inp_unit,*) afmt
|
||||
read(inp_unit,*) kmethd
|
||||
read(inp_unit,*) ptype
|
||||
read(inp_unit,*) afmt
|
||||
|
||||
read(psb_inp_unit,*) idim
|
||||
read(inp_unit,*) idim
|
||||
if (ip >= 4) then
|
||||
read(psb_inp_unit,*) istopc
|
||||
read(inp_unit,*) istopc
|
||||
else
|
||||
istopc=1
|
||||
endif
|
||||
if (ip >= 5) then
|
||||
read(psb_inp_unit,*) itmax
|
||||
read(inp_unit,*) itmax
|
||||
else
|
||||
itmax=500
|
||||
endif
|
||||
if (ip >= 6) then
|
||||
read(psb_inp_unit,*) itrace
|
||||
read(inp_unit,*) itrace
|
||||
else
|
||||
itrace=-1
|
||||
endif
|
||||
if (ip >= 7) then
|
||||
read(psb_inp_unit,*) irst
|
||||
read(inp_unit,*) irst
|
||||
else
|
||||
irst=1
|
||||
endif
|
||||
! broadcast parameters to all processors
|
||||
|
||||
|
||||
write(psb_out_unit,'("Solving matrix : ell1")')
|
||||
write(psb_out_unit,&
|
||||
@@ -618,6 +635,10 @@ contains
|
||||
call psb_abort(ictxt)
|
||||
stop 1
|
||||
endif
|
||||
if (inp_unit /= psb_inp_unit) then
|
||||
close(inp_unit)
|
||||
end if
|
||||
|
||||
end if
|
||||
! broadcast parameters to all processors
|
||||
call psb_bcast(ictxt,kmethd)
|
||||
@@ -652,7 +673,6 @@ contains
|
||||
write(iout,*)' >= 1 do tracing every itrace'
|
||||
write(iout,*)' iterations '
|
||||
end subroutine pr_usage
|
||||
|
||||
!
|
||||
! functions parametrizing the differential equation
|
||||
!
|
||||
|
||||
Reference in New Issue
Block a user