mirror of
https://github.com/sfilippone/psblas3.git
synced 2026-10-16 10:52:08 +00:00
Updated PENV with min/max.
Updated docs on utilities.
This commit is contained in:
@@ -20,7 +20,7 @@ INCDIRS = -I .
|
||||
psb_realloc_mod.o : psb_error_mod.o
|
||||
psb_spmat_type.o : psb_realloc_mod.o psb_error_mod.o psb_const_mod.o psb_string_mod.o
|
||||
psb_error_mod.o: psb_const_mod.o
|
||||
psb_penv_mod.o: psb_const_mod.o psb_error_mod.o
|
||||
psb_penv_mod.o: psb_const_mod.o psb_error_mod.o psb_realloc_mod.o
|
||||
psi_mod.o: psb_penv_mod.o psb_error_mod.o psb_desc_type.o
|
||||
psb_desc_type.o: psb_const_mod.o psb_error_mod.o psb_penv_mod.o
|
||||
psb_check_mod.o: psb_desc_type.o
|
||||
|
||||
@@ -77,6 +77,17 @@ module psb_penv_mod
|
||||
& psb_hrcvs, psb_lrcvs
|
||||
end interface
|
||||
|
||||
interface psb_max
|
||||
module procedure psb_imaxs, psb_imaxv, psb_imaxm,&
|
||||
& psb_dmaxs, psb_dmaxv, psb_dmaxm
|
||||
end interface
|
||||
|
||||
|
||||
interface psb_min
|
||||
module procedure psb_imins, psb_iminv, psb_iminm,&
|
||||
& psb_dmins, psb_dminv, psb_dminm
|
||||
end interface
|
||||
|
||||
|
||||
interface psb_amx
|
||||
module procedure psb_iamxs, psb_iamxv, psb_iamxm,&
|
||||
@@ -96,7 +107,6 @@ module psb_penv_mod
|
||||
& psb_zsums, psb_zsumv, psb_zsumm
|
||||
end interface
|
||||
|
||||
|
||||
|
||||
interface gebs2d
|
||||
module procedure igebs2ds, igebs2dv, igebs2dm,&
|
||||
@@ -482,6 +492,371 @@ contains
|
||||
end subroutine psb_lbcasts
|
||||
|
||||
|
||||
|
||||
subroutine psb_imaxs(ictxt,dat,root)
|
||||
use mpi
|
||||
integer, intent(in) :: ictxt
|
||||
integer, intent(inout) :: dat
|
||||
integer, intent(in), optional :: root
|
||||
integer :: root_, dat_
|
||||
integer :: iam, np, icomm
|
||||
|
||||
|
||||
call psb_info(ictxt,iam,np)
|
||||
call psb_get_mpicomm(ictxt,icomm)
|
||||
|
||||
if (present(root)) then
|
||||
root_ = root
|
||||
else
|
||||
root_ = -1
|
||||
endif
|
||||
if (root_ == -1) then
|
||||
call mpi_allreduce(dat,dat_,1,mpi_integer,mpi_max,icomm)
|
||||
dat = dat_
|
||||
else
|
||||
call mpi_reduce(dat,dat_,1,mpi_integer,mpi_max,root_,icomm)
|
||||
dat = dat_
|
||||
endif
|
||||
end subroutine psb_imaxs
|
||||
subroutine psb_imaxv(ictxt,dat,root)
|
||||
use mpi
|
||||
use psb_realloc_mod
|
||||
integer, intent(in) :: ictxt
|
||||
integer, intent(inout) :: dat(:)
|
||||
integer, intent(in), optional :: root
|
||||
integer :: root_
|
||||
integer, allocatable :: dat_(:)
|
||||
integer :: iam, np, icomm, info
|
||||
|
||||
|
||||
call psb_info(ictxt,iam,np)
|
||||
call psb_get_mpicomm(ictxt,icomm)
|
||||
|
||||
if (present(root)) then
|
||||
root_ = root
|
||||
else
|
||||
root_ = -1
|
||||
endif
|
||||
if (root_ == -1) then
|
||||
call psb_realloc(size(dat),dat_,info)
|
||||
if (info ==0) call mpi_allreduce(dat_,dat,size(dat),mpi_integer,mpi_max,icomm)
|
||||
else
|
||||
if (iam==root_) then
|
||||
call psb_realloc(size(dat),dat_,info)
|
||||
call mpi_reduce(dat_,dat,size(dat),mpi_integer,mpi_max,root_,icomm)
|
||||
else
|
||||
call mpi_reduce(dat,dat_,size(dat),mpi_integer,mpi_max,root_,icomm)
|
||||
end if
|
||||
endif
|
||||
end subroutine psb_imaxv
|
||||
subroutine psb_imaxm(ictxt,dat,root)
|
||||
use mpi
|
||||
use psb_realloc_mod
|
||||
integer, intent(in) :: ictxt
|
||||
integer, intent(inout) :: dat(:,:)
|
||||
integer, intent(in), optional :: root
|
||||
integer :: root_
|
||||
integer, allocatable :: dat_(:,:)
|
||||
integer :: iam, np, icomm, info
|
||||
|
||||
|
||||
call psb_info(ictxt,iam,np)
|
||||
call psb_get_mpicomm(ictxt,icomm)
|
||||
|
||||
if (present(root)) then
|
||||
root_ = root
|
||||
else
|
||||
root_ = -1
|
||||
endif
|
||||
if (root_ == -1) then
|
||||
call psb_realloc(size(dat,1),size(dat,2),dat_,info)
|
||||
if (info ==0) call mpi_allreduce(dat_,dat,size(dat),mpi_integer,mpi_max,icomm)
|
||||
else
|
||||
if (iam==root_) then
|
||||
call psb_realloc(size(dat,1),size(dat,2),dat_,info)
|
||||
call mpi_reduce(dat_,dat,size(dat),mpi_integer,mpi_max,root_,icomm)
|
||||
else
|
||||
call mpi_reduce(dat,dat_,size(dat),mpi_integer,mpi_max,root_,icomm)
|
||||
end if
|
||||
endif
|
||||
end subroutine psb_imaxm
|
||||
|
||||
subroutine psb_dmaxs(ictxt,dat,root)
|
||||
use mpi
|
||||
integer, intent(in) :: ictxt
|
||||
real(kind(1.d0)), intent(inout) :: dat
|
||||
integer, intent(in), optional :: root
|
||||
integer :: root_
|
||||
real(kind(1.d0)) :: dat_
|
||||
integer :: iam, np, icomm
|
||||
|
||||
|
||||
call psb_info(ictxt,iam,np)
|
||||
call psb_get_mpicomm(ictxt,icomm)
|
||||
|
||||
if (present(root)) then
|
||||
root_ = root
|
||||
else
|
||||
root_ = -1
|
||||
endif
|
||||
if (root_ == -1) then
|
||||
call mpi_allreduce(dat,dat_,1,mpi_double_precision,mpi_max,icomm)
|
||||
dat = dat_
|
||||
else
|
||||
call mpi_reduce(dat,dat_,1,mpi_double_precision,mpi_max,root_,icomm)
|
||||
dat = dat_
|
||||
endif
|
||||
end subroutine psb_dmaxs
|
||||
subroutine psb_dmaxv(ictxt,dat,root)
|
||||
use mpi
|
||||
use psb_realloc_mod
|
||||
integer, intent(in) :: ictxt
|
||||
real(kind(1.d0)), intent(inout) :: dat(:)
|
||||
integer, intent(in), optional :: root
|
||||
integer :: root_
|
||||
real(kind(1.d0)), allocatable :: dat_(:)
|
||||
integer :: iam, np, icomm, info
|
||||
|
||||
|
||||
call psb_info(ictxt,iam,np)
|
||||
call psb_get_mpicomm(ictxt,icomm)
|
||||
|
||||
if (present(root)) then
|
||||
root_ = root
|
||||
else
|
||||
root_ = -1
|
||||
endif
|
||||
if (root_ == -1) then
|
||||
call psb_realloc(size(dat),dat_,info)
|
||||
dat_ = dat
|
||||
if (info ==0) call mpi_allreduce(dat_,dat,size(dat),mpi_double_precision,mpi_max,icomm)
|
||||
else
|
||||
if (iam==root_) then
|
||||
call psb_realloc(size(dat),dat_,info)
|
||||
dat_ = dat
|
||||
call mpi_reduce(dat_,dat,size(dat),mpi_double_precision,mpi_max,root_,icomm)
|
||||
else
|
||||
call mpi_reduce(dat,dat_,size(dat),mpi_double_precision,mpi_max,root_,icomm)
|
||||
end if
|
||||
endif
|
||||
end subroutine psb_dmaxv
|
||||
subroutine psb_dmaxm(ictxt,dat,root)
|
||||
use mpi
|
||||
use psb_realloc_mod
|
||||
integer, intent(in) :: ictxt
|
||||
real(kind(1.d0)), intent(inout) :: dat(:,:)
|
||||
integer, intent(in), optional :: root
|
||||
integer :: root_
|
||||
real(kind(1.d0)), allocatable :: dat_(:,:)
|
||||
integer :: iam, np, icomm, info
|
||||
|
||||
|
||||
call psb_info(ictxt,iam,np)
|
||||
call psb_get_mpicomm(ictxt,icomm)
|
||||
|
||||
if (present(root)) then
|
||||
root_ = root
|
||||
else
|
||||
root_ = -1
|
||||
endif
|
||||
if (root_ == -1) then
|
||||
call psb_realloc(size(dat,1),size(dat,2),dat_,info)
|
||||
dat_ = dat
|
||||
if (info ==0) call mpi_allreduce(dat_,dat,size(dat),mpi_double_precision,mpi_max,icomm)
|
||||
else
|
||||
if (iam==root_) then
|
||||
call psb_realloc(size(dat,1),size(dat,2),dat_,info)
|
||||
dat_ = dat
|
||||
call mpi_reduce(dat_,dat,size(dat),mpi_double_precision,mpi_max,root_,icomm)
|
||||
else
|
||||
call mpi_reduce(dat,dat_,size(dat),mpi_double_precision,mpi_max,root_,icomm)
|
||||
end if
|
||||
endif
|
||||
end subroutine psb_dmaxm
|
||||
|
||||
|
||||
subroutine psb_imins(ictxt,dat,root)
|
||||
use mpi
|
||||
integer, intent(in) :: ictxt
|
||||
integer, intent(inout) :: dat
|
||||
integer, intent(in), optional :: root
|
||||
integer :: root_, dat_
|
||||
integer :: iam, np, icomm
|
||||
|
||||
|
||||
call psb_info(ictxt,iam,np)
|
||||
call psb_get_mpicomm(ictxt,icomm)
|
||||
|
||||
if (present(root)) then
|
||||
root_ = root
|
||||
else
|
||||
root_ = -1
|
||||
endif
|
||||
if (root_ == -1) then
|
||||
call mpi_allreduce(dat,dat_,1,mpi_integer,mpi_min,icomm)
|
||||
dat = dat_
|
||||
else
|
||||
call mpi_reduce(dat,dat_,1,mpi_integer,mpi_min,root_,icomm)
|
||||
dat = dat_
|
||||
endif
|
||||
end subroutine psb_imins
|
||||
subroutine psb_iminv(ictxt,dat,root)
|
||||
use mpi
|
||||
use psb_realloc_mod
|
||||
integer, intent(in) :: ictxt
|
||||
integer, intent(inout) :: dat(:)
|
||||
integer, intent(in), optional :: root
|
||||
integer :: root_
|
||||
integer, allocatable :: dat_(:)
|
||||
integer :: iam, np, icomm, info
|
||||
|
||||
|
||||
call psb_info(ictxt,iam,np)
|
||||
call psb_get_mpicomm(ictxt,icomm)
|
||||
|
||||
if (present(root)) then
|
||||
root_ = root
|
||||
else
|
||||
root_ = -1
|
||||
endif
|
||||
if (root_ == -1) then
|
||||
call psb_realloc(size(dat),dat_,info)
|
||||
if (info ==0) call mpi_allreduce(dat_,dat,size(dat),mpi_integer,mpi_min,icomm)
|
||||
else
|
||||
if (iam==root_) then
|
||||
call psb_realloc(size(dat),dat_,info)
|
||||
call mpi_reduce(dat_,dat,size(dat),mpi_integer,mpi_min,root_,icomm)
|
||||
else
|
||||
call mpi_reduce(dat,dat_,size(dat),mpi_integer,mpi_min,root_,icomm)
|
||||
end if
|
||||
endif
|
||||
end subroutine psb_iminv
|
||||
subroutine psb_iminm(ictxt,dat,root)
|
||||
use mpi
|
||||
use psb_realloc_mod
|
||||
integer, intent(in) :: ictxt
|
||||
integer, intent(inout) :: dat(:,:)
|
||||
integer, intent(in), optional :: root
|
||||
integer :: root_
|
||||
integer, allocatable :: dat_(:,:)
|
||||
integer :: iam, np, icomm, info
|
||||
|
||||
|
||||
call psb_info(ictxt,iam,np)
|
||||
call psb_get_mpicomm(ictxt,icomm)
|
||||
|
||||
if (present(root)) then
|
||||
root_ = root
|
||||
else
|
||||
root_ = -1
|
||||
endif
|
||||
if (root_ == -1) then
|
||||
call psb_realloc(size(dat,1),size(dat,2),dat_,info)
|
||||
if (info ==0) call mpi_allreduce(dat_,dat,size(dat),mpi_integer,mpi_min,icomm)
|
||||
else
|
||||
if (iam==root_) then
|
||||
call psb_realloc(size(dat,1),size(dat,2),dat_,info)
|
||||
call mpi_reduce(dat_,dat,size(dat),mpi_integer,mpi_min,root_,icomm)
|
||||
else
|
||||
call mpi_reduce(dat,dat_,size(dat),mpi_integer,mpi_min,root_,icomm)
|
||||
end if
|
||||
endif
|
||||
end subroutine psb_iminm
|
||||
|
||||
subroutine psb_dmins(ictxt,dat,root)
|
||||
use mpi
|
||||
integer, intent(in) :: ictxt
|
||||
real(kind(1.d0)), intent(inout) :: dat
|
||||
integer, intent(in), optional :: root
|
||||
integer :: root_
|
||||
real(kind(1.d0)) :: dat_
|
||||
integer :: iam, np, icomm
|
||||
|
||||
|
||||
call psb_info(ictxt,iam,np)
|
||||
call psb_get_mpicomm(ictxt,icomm)
|
||||
|
||||
if (present(root)) then
|
||||
root_ = root
|
||||
else
|
||||
root_ = -1
|
||||
endif
|
||||
if (root_ == -1) then
|
||||
call mpi_allreduce(dat,dat_,1,mpi_double_precision,mpi_min,icomm)
|
||||
dat = dat_
|
||||
else
|
||||
call mpi_reduce(dat,dat_,1,mpi_double_precision,mpi_min,root_,icomm)
|
||||
dat = dat_
|
||||
endif
|
||||
end subroutine psb_dmins
|
||||
subroutine psb_dminv(ictxt,dat,root)
|
||||
use mpi
|
||||
use psb_realloc_mod
|
||||
integer, intent(in) :: ictxt
|
||||
real(kind(1.d0)), intent(inout) :: dat(:)
|
||||
integer, intent(in), optional :: root
|
||||
integer :: root_
|
||||
real(kind(1.d0)), allocatable :: dat_(:)
|
||||
integer :: iam, np, icomm, info
|
||||
|
||||
|
||||
call psb_info(ictxt,iam,np)
|
||||
call psb_get_mpicomm(ictxt,icomm)
|
||||
|
||||
if (present(root)) then
|
||||
root_ = root
|
||||
else
|
||||
root_ = -1
|
||||
endif
|
||||
if (root_ == -1) then
|
||||
call psb_realloc(size(dat),dat_,info)
|
||||
dat_ = dat
|
||||
if (info ==0) call mpi_allreduce(dat_,dat,size(dat),mpi_double_precision,mpi_min,icomm)
|
||||
else
|
||||
if (iam==root_) then
|
||||
call psb_realloc(size(dat),dat_,info)
|
||||
dat_ = dat
|
||||
call mpi_reduce(dat_,dat,size(dat),mpi_double_precision,mpi_min,root_,icomm)
|
||||
else
|
||||
call mpi_reduce(dat,dat_,size(dat),mpi_double_precision,mpi_min,root_,icomm)
|
||||
end if
|
||||
endif
|
||||
end subroutine psb_dminv
|
||||
subroutine psb_dminm(ictxt,dat,root)
|
||||
use mpi
|
||||
use psb_realloc_mod
|
||||
integer, intent(in) :: ictxt
|
||||
real(kind(1.d0)), intent(inout) :: dat(:,:)
|
||||
integer, intent(in), optional :: root
|
||||
integer :: root_
|
||||
real(kind(1.d0)), allocatable :: dat_(:,:)
|
||||
integer :: iam, np, icomm, info
|
||||
|
||||
|
||||
call psb_info(ictxt,iam,np)
|
||||
call psb_get_mpicomm(ictxt,icomm)
|
||||
|
||||
if (present(root)) then
|
||||
root_ = root
|
||||
else
|
||||
root_ = -1
|
||||
endif
|
||||
if (root_ == -1) then
|
||||
call psb_realloc(size(dat,1),size(dat,2),dat_,info)
|
||||
dat_ = dat
|
||||
if (info ==0) call mpi_allreduce(dat_,dat,size(dat),mpi_double_precision,mpi_min,icomm)
|
||||
else
|
||||
if (iam==root_) then
|
||||
call psb_realloc(size(dat,1),size(dat,2),dat_,info)
|
||||
dat_ = dat
|
||||
call mpi_reduce(dat_,dat,size(dat),mpi_double_precision,mpi_min,root_,icomm)
|
||||
else
|
||||
call mpi_reduce(dat,dat_,size(dat),mpi_double_precision,mpi_min,root_,icomm)
|
||||
end if
|
||||
endif
|
||||
end subroutine psb_dminm
|
||||
|
||||
|
||||
subroutine psb_iamxs(ictxt,dat,root,ia)
|
||||
integer, intent(in) :: ictxt
|
||||
integer, intent(inout) :: dat
|
||||
|
||||
@@ -75,8 +75,8 @@ Contains
|
||||
use psb_error_mod
|
||||
|
||||
! ...Subroutine Arguments
|
||||
Integer,allocatable,intent(in) :: vin(:)
|
||||
Integer,allocatable,intent(out) :: vout(:)
|
||||
Integer,allocatable, intent(in) :: vin(:)
|
||||
Integer,allocatable, intent(out) :: vout(:)
|
||||
integer :: info
|
||||
! ...Local Variables
|
||||
|
||||
@@ -122,7 +122,8 @@ Contains
|
||||
use psb_error_mod
|
||||
|
||||
! ...Subroutine Arguments
|
||||
Integer,allocatable :: vin(:,:),vout(:,:)
|
||||
Integer, allocatable, intent(in) :: vin(:,:)
|
||||
Integer, allocatable, intent(out) :: vout(:,:)
|
||||
integer :: info
|
||||
! ...Local Variables
|
||||
|
||||
@@ -170,7 +171,8 @@ Contains
|
||||
use psb_error_mod
|
||||
|
||||
! ...Subroutine Arguments
|
||||
real(kind(1.d0)),allocatable :: vin(:),vout(:)
|
||||
real(kind(1.d0)), allocatable, intent(in) :: vin(:)
|
||||
real(kind(1.d0)), allocatable, intent(out) :: vout(:)
|
||||
integer :: info
|
||||
! ...Local Variables
|
||||
|
||||
@@ -216,7 +218,8 @@ Contains
|
||||
use psb_error_mod
|
||||
|
||||
! ...Subroutine Arguments
|
||||
real(kind(1.d0)),allocatable :: vin(:,:),vout(:,:)
|
||||
real(kind(1.d0)), allocatable, intent(in) :: vin(:,:)
|
||||
real(kind(1.d0)), allocatable, intent(out) :: vout(:,:)
|
||||
integer :: info
|
||||
! ...Local Variables
|
||||
|
||||
@@ -264,7 +267,8 @@ Contains
|
||||
use psb_error_mod
|
||||
|
||||
! ...Subroutine Arguments
|
||||
complex(kind(1.d0)),allocatable :: vin(:),vout(:)
|
||||
complex(kind(1.d0)), allocatable, intent(in) :: vin(:)
|
||||
complex(kind(1.d0)), allocatable, intent(out) :: vout(:)
|
||||
integer :: info
|
||||
! ...Local Variables
|
||||
|
||||
@@ -310,7 +314,8 @@ Contains
|
||||
use psb_error_mod
|
||||
|
||||
! ...Subroutine Arguments
|
||||
complex(kind(1.d0)),allocatable :: vin(:,:),vout(:,:)
|
||||
complex(kind(1.d0)), allocatable, intent(in) :: vin(:,:)
|
||||
complex(kind(1.d0)), allocatable, intent(out) :: vout(:,:)
|
||||
integer :: info
|
||||
! ...Local Variables
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
!!$
|
||||
module psb_string_mod
|
||||
|
||||
public tolower, toupper, touppers
|
||||
interface tolower
|
||||
module procedure tolowerc
|
||||
end interface
|
||||
@@ -42,13 +43,15 @@ module psb_string_mod
|
||||
module procedure sub_toupperc
|
||||
end interface
|
||||
|
||||
private
|
||||
character(len=*), parameter :: lcase='abcdefghijklmnopqrstuvwxyz'
|
||||
character(len=*), parameter :: ucase='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||
|
||||
contains
|
||||
|
||||
function tolowerc(string)
|
||||
character(len=*), intent(in) :: string
|
||||
character(len=len(string)) :: tolowerc
|
||||
character(len=*), parameter :: lcase='abcdefghijklmnopqrstuvwxyz'
|
||||
character(len=*), parameter :: ucase='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||
integer :: i,k
|
||||
|
||||
do i=1,len(string)
|
||||
@@ -64,8 +67,6 @@ contains
|
||||
function toupperc(string)
|
||||
character(len=*), intent(in) :: string
|
||||
character(len=len(string)) :: toupperc
|
||||
character(len=*), parameter :: lcase='abcdefghijklmnopqrstuvwxyz'
|
||||
character(len=*), parameter :: ucase='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||
integer :: i,k
|
||||
|
||||
do i=1,len(string)
|
||||
@@ -81,8 +82,6 @@ contains
|
||||
subroutine sub_toupperc(string,strout)
|
||||
character(len=*), intent(in) :: string
|
||||
character(len=*), intent(out) :: strout
|
||||
character(len=*), parameter :: lcase='abcdefghijklmnopqrstuvwxyz'
|
||||
character(len=*), parameter :: ucase='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||
integer :: i,k
|
||||
|
||||
do i=1,len(string)
|
||||
|
||||
@@ -17,10 +17,12 @@ the Krylov-Subspace family methods implemented in PSBLAS-2.0.
|
||||
|
||||
The stopping criterion is the normwise backward error, in the infinity
|
||||
norm, i.e. the iteration is stopped when
|
||||
\[ \frac{\|r\|}{(\|A\|\|x\|+\|b\|)} < eps \]
|
||||
or
|
||||
\[ \frac{\|r_i\|}{\|b\|_2} < eps \]
|
||||
according to the value passed through the istop argument (see later).
|
||||
\[ err = \frac{\|r_i\|}{(\|A\|\|x_i\|+\|b\|)} < eps \]
|
||||
or the 2-norm residual reduction
|
||||
\[ err = \frac{\|r_i\|}{\|b\|_2} < eps \]
|
||||
according to the value passed through the istop argument (see
|
||||
later). In the above formulae, $x_i$ is the tentative solution and
|
||||
$r_i=b-Ax_i$ the corresponding residual at the $i$-th iteration.
|
||||
|
||||
|
||||
\syntax{call psb\_krylov}{method,a,prec,b,x,eps,desc\_a,info,itmax,iter,err,itrace,istop}
|
||||
@@ -74,8 +76,9 @@ Scope: {\bf global} \\
|
||||
Type: {\bf optional}\\
|
||||
\item[istop] An integer specifying the stopping criterion.\\
|
||||
Scope: {\bf global} \\
|
||||
Type: {\bf optional}\\
|
||||
|
||||
Type: {\bf optional}.\\
|
||||
Values: 1: use the normwise backward error, 2: use the scaled 2-norm
|
||||
of the residual. Default: 1.
|
||||
\item[\bf On Return]
|
||||
\item[x] The computed solution. \\
|
||||
Scope: {\bf local} \\
|
||||
|
||||
+92
-2
@@ -292,6 +292,96 @@ Type, rank and size must agree on all processes.
|
||||
|
||||
|
||||
|
||||
\subroutine{psb\_max}{Global maximum}
|
||||
|
||||
\syntax{call psb\_max}{icontxt, dat, root}
|
||||
|
||||
This subroutine implements a maximum valuereduction
|
||||
operation based on the underlying communication library.
|
||||
\begin{description}
|
||||
\item[\bf On Entry ]
|
||||
\item[icontxt] the communication context identifying the virtual
|
||||
parallel machine.\\
|
||||
Scope:{\bf global}.\\
|
||||
Type:{\bf required}.\\
|
||||
Specified as: an integer variable.
|
||||
\item[dat] The local contribution to the global maximum.\\
|
||||
Scope:{\bf local}.\\
|
||||
Type:{\bf required}.\\
|
||||
Specified as: an integer or real variable, which may be a
|
||||
scalar, or a rank 1 or 2 array. \
|
||||
Type, rank and size must agree on all processes.
|
||||
\item[root] Process to hold the final maximum, or $-1$ to make it available
|
||||
on all processes.\\
|
||||
Scope:{\bf global}.\\
|
||||
Type:{\bf optional}.\\
|
||||
Specified as: an integer value $-1<= root <= np-1$, default -1. \\
|
||||
\end{description}
|
||||
|
||||
|
||||
\begin{description}
|
||||
\item[\bf On Return]
|
||||
\item[dat] On destination process(es), the result of the maximum operation.\\
|
||||
Scope:{\bf global}.\\
|
||||
Type:{\bf required}.\\
|
||||
Specified as: an integer or real variable, which may be a
|
||||
scalar, or a rank 1 or 2 array. \
|
||||
Type, rank and size must agree on all processes.
|
||||
\end{description}
|
||||
|
||||
|
||||
\section*{Notes}
|
||||
\begin{enumerate}
|
||||
\item The \verb|dat| argument is both input and output, and its
|
||||
value may be changed even on processes different from the final
|
||||
result destination.
|
||||
\end{enumerate}
|
||||
|
||||
\subroutine{psb\_min}{Global minimum}
|
||||
|
||||
\syntax{call psb\_min}{icontxt, dat, root}
|
||||
|
||||
This subroutine implements a minimum value reduction
|
||||
operation based on the underlying communication library.
|
||||
\begin{description}
|
||||
\item[\bf On Entry ]
|
||||
\item[icontxt] the communication context identifying the virtual
|
||||
parallel machine.\\
|
||||
Scope:{\bf global}.\\
|
||||
Type:{\bf required}.\\
|
||||
Specified as: an integer variable.
|
||||
\item[dat] The local contribution to the global minimum.\\
|
||||
Scope:{\bf local}.\\
|
||||
Type:{\bf required}.\\
|
||||
Specified as: an integer or real variable, which may be a
|
||||
scalar, or a rank 1 or 2 array. \
|
||||
Type, rank and size must agree on all processes.
|
||||
\item[root] Process to hold the final value, or $-1$ to make it available
|
||||
on all processes.\\
|
||||
Scope:{\bf global}.\\
|
||||
Type:{\bf optional}.\\
|
||||
Specified as: an integer value $-1<= root <= np-1$, default -1. \\
|
||||
\end{description}
|
||||
|
||||
|
||||
\begin{description}
|
||||
\item[\bf On Return]
|
||||
\item[dat] On destination process(es), the result of the minimum operation.\\
|
||||
Scope:{\bf global}.\\
|
||||
Type:{\bf required}.\\
|
||||
Specified as: an integer or real variable, which may be a
|
||||
scalar, or a rank 1 or 2 array. \\
|
||||
Type, rank and size must agree on all processes.
|
||||
\end{description}
|
||||
|
||||
|
||||
\section*{Notes}
|
||||
\begin{enumerate}
|
||||
\item The \verb|dat| argument is both input and output, and its
|
||||
value may be changed even on processes different from the final
|
||||
result destination.
|
||||
\end{enumerate}
|
||||
|
||||
\subroutine{psb\_amx}{Global maximum absolute value}
|
||||
|
||||
\syntax{call psb\_amx}{icontxt, dat, root}
|
||||
@@ -311,7 +401,7 @@ Type:{\bf required}.\\
|
||||
Specified as: an integer, real or complex variable, which may be a
|
||||
scalar, or a rank 1 or 2 array. \
|
||||
Type, rank and size must agree on all processes.
|
||||
\item[root] Process to hold the final sum, or $-1$ to make it available
|
||||
\item[root] Process to hold the final value, or $-1$ to make it available
|
||||
on all processes.\\
|
||||
Scope:{\bf global}.\\
|
||||
Type:{\bf optional}.\\
|
||||
@@ -356,7 +446,7 @@ Type:{\bf required}.\\
|
||||
Specified as: an integer, real or complex variable, which may be a
|
||||
scalar, or a rank 1 or 2 array. \
|
||||
Type, rank and size must agree on all processes.
|
||||
\item[root] Process to hold the final sum, or $-1$ to make it available
|
||||
\item[root] Process to hold the final value, or $-1$ to make it available
|
||||
on all processes.\\
|
||||
Scope:{\bf global}.\\
|
||||
Type:{\bf optional}.\\
|
||||
|
||||
@@ -35,7 +35,9 @@
|
||||
|
||||
\newcounter{subroutine}[subsection]
|
||||
\newcounter{example}[subroutine]
|
||||
\newcommand{\subroutine}[2]{\clearpage%
|
||||
\makeatletter
|
||||
\def\subroutine{\@ifstar{\@subroutine}{\clearpage\@subroutine}}%
|
||||
\def\@subroutine#1#2{%
|
||||
\stepcounter{subroutine}%
|
||||
\section*{\flushleft #1---#2 \endflushleft}%
|
||||
\addcontentsline{toc}{subsection}{#1}%
|
||||
@@ -47,7 +49,6 @@
|
||||
\markright{#1}}%
|
||||
\newcommand{\examplename}{Example}
|
||||
\newcommand{\syntaxname}{Syntax}
|
||||
\makeatletter
|
||||
\def\syntax{\@ifstar{\@ssyntax}{\@syntax}}%
|
||||
\def\@syntax{\section*{\syntaxname}%
|
||||
\@ssyntax}%
|
||||
|
||||
@@ -2,6 +2,148 @@
|
||||
\label{sec:util}
|
||||
|
||||
|
||||
\subroutine{PSB\_HBIO\_MOD}{Input/Output in Harwell-Boeing format}
|
||||
|
||||
\subroutine*{hb\_read}{Read a sparse matrix from a file}
|
||||
\syntax{call hb\_read}{a, iret, iunit, filename, b, mtitle}
|
||||
|
||||
\begin{description}
|
||||
\item[\bf On Entry ]
|
||||
\item[filename] The name of the file to be read.\\
|
||||
Type:{\bf optional}.\\
|
||||
Specified as: a character variable containing a valid file name, or
|
||||
\verb|-|, in which case the default input unit 5 (i.e. standard input
|
||||
in Unix jargon) is used. Default: \verb|-|.
|
||||
\item[iunit] The Fortran file unit number.\\
|
||||
Type:{\bf optional}.\\
|
||||
Specified as: an integer value. Only meaningful if filename is not \verb|-|.
|
||||
\end{description}
|
||||
|
||||
\begin{description}
|
||||
\item[\bf On Return]
|
||||
\item[a] the sparse matrix read from file.\\
|
||||
Type:{\bf required}.\\
|
||||
Specified as: a structured data of type \spdata.
|
||||
\item[b] Rigth hand side.\\
|
||||
Type: {\bf Optional} \\
|
||||
An array of type real or complex, rank 1 and having the ALLOCATABLE
|
||||
attribute; will be allocated and filled in if the input file contains
|
||||
a right hand side.
|
||||
\item[mtitle] Matrix title.\\
|
||||
Type: {\bf Optional} \\
|
||||
A charachter variable of length 72 holding a copy of the
|
||||
matrix title as specified by the Harwell-Boeing format and contained
|
||||
in the input file.
|
||||
\item[iret] Error code.\\
|
||||
Type: {\bf required} \\
|
||||
An integer value; 0 means no error has been detected.
|
||||
\end{description}
|
||||
|
||||
|
||||
|
||||
\subroutine*{hb\_write}{Write a sparse matrix to a file}
|
||||
\syntax{call hb\_write}{a, iret, iunit, filename, key, rhs, mtitle}
|
||||
|
||||
|
||||
|
||||
\begin{description}
|
||||
\item[\bf On Entry ]
|
||||
\item[a] the sparse matrix to be written.\\
|
||||
Type:{\bf required}.\\
|
||||
Specified as: a structured data of type \spdata.
|
||||
\item[b] Rigth hand side.\\
|
||||
Type: {\bf Optional} \\
|
||||
An array of type real or complex, rank 1 and having the ALLOCATABLE
|
||||
attribute; will be allocated and filled in if the input file contains
|
||||
a right hand side.
|
||||
\item[filename] The name of the file to be written to.\\
|
||||
Type:{\bf optional}.\\
|
||||
Specified as: a character variable containing a valid file name, or
|
||||
\verb|-|, in which case the default output unit 6 (i.e. standard output
|
||||
in Unix jargon) is used. Default: \verb|-|.
|
||||
\item[iunit] The Fortran file unit number.\\
|
||||
Type:{\bf optional}.\\
|
||||
Specified as: an integer value. Only meaningful if filename is not \verb|-|.
|
||||
\item[key] Matrix key.\\
|
||||
Type: {\bf Optional} \\
|
||||
A charachter variable of length 8 holding the
|
||||
matrix key as specified by the Harwell-Boeing format and to be
|
||||
written to file.
|
||||
\item[mtitle] Matrix title.\\
|
||||
Type: {\bf Optional} \\
|
||||
A charachter variable of length 72 holding the
|
||||
matrix title as specified by the Harwell-Boeing format and to be
|
||||
written to file.
|
||||
\end{description}
|
||||
|
||||
\begin{description}
|
||||
\item[\bf On Return]
|
||||
\item[iret] Error code.\\
|
||||
Type: {\bf required} \\
|
||||
An integer value; 0 means no error has been detected.
|
||||
\end{description}
|
||||
|
||||
|
||||
|
||||
|
||||
\subroutine{PSB\_MMIO\_MOD}{Input/Output in MatrixMarket format}
|
||||
|
||||
\subroutine*{mm\_mat\_read}{Read a sparse matrix from a file}
|
||||
\syntax{call mm\_mat\_read}{a, iret, iunit, filename}
|
||||
|
||||
\begin{description}
|
||||
\item[\bf On Entry ]
|
||||
\item[filename] The name of the file to be read.\\
|
||||
Type:{\bf optional}.\\
|
||||
Specified as: a character variable containing a valid file name, or
|
||||
\verb|-|, in which case the default input unit 5 (i.e. standard input
|
||||
in Unix jargon) is used. Default: \verb|-|.
|
||||
\item[iunit] The Fortran file unit number.\\
|
||||
Type:{\bf optional}.\\
|
||||
Specified as: an integer value. Only meaningful if filename is not \verb|-|.
|
||||
\end{description}
|
||||
|
||||
\begin{description}
|
||||
\item[\bf On Return]
|
||||
\item[a] the sparse matrix read from file.\\
|
||||
Type:{\bf required}.\\
|
||||
Specified as: a structured data of type \spdata.
|
||||
\item[iret] Error code.\\
|
||||
Type: {\bf required} \\
|
||||
An integer value; 0 means no error has been detected.
|
||||
\end{description}
|
||||
|
||||
|
||||
|
||||
\subroutine*{mm\_mat\_write}{Write a sparse matrix to a file}
|
||||
\syntax{call mm\_mat\_write}{a, mtitle, iret, iunit, filename}
|
||||
\begin{description}
|
||||
\item[\bf On Entry ]
|
||||
\item[a] the sparse matrix to be written.\\
|
||||
Type:{\bf required}.\\
|
||||
Specified as: a structured data of type \spdata.
|
||||
\item[mtitle] Matrix title.\\
|
||||
Type: {\bf required} \\
|
||||
A charachter variable holding a descriptive title for the matrix to be
|
||||
written to file.
|
||||
\item[filename] The name of the file to be written to.\\
|
||||
Type:{\bf optional}.\\
|
||||
Specified as: a character variable containing a valid file name, or
|
||||
\verb|-|, in which case the default output unit 6 (i.e. standard output
|
||||
in Unix jargon) is used. Default: \verb|-|.
|
||||
\item[iunit] The Fortran file unit number.\\
|
||||
Type:{\bf optional}.\\
|
||||
Specified as: an integer value. Only meaningful if filename is not \verb|-|.
|
||||
\end{description}
|
||||
|
||||
\begin{description}
|
||||
\item[\bf On Return]
|
||||
\item[iret] Error code.\\
|
||||
Type: {\bf required} \\
|
||||
An integer value; 0 means no error has been detected.
|
||||
\end{description}
|
||||
|
||||
|
||||
|
||||
%%% Local Variables:
|
||||
%%% mode: latex
|
||||
|
||||
+6370
-4544
File diff suppressed because one or more lines are too long
+12
-12
@@ -179,13 +179,13 @@ contains
|
||||
|
||||
|
||||
|
||||
subroutine dhb_write(a,iret,eiout,filename,key,rhs,mtitle)
|
||||
subroutine dhb_write(a,iret,iunit,filename,key,rhs,mtitle)
|
||||
use psb_base_mod
|
||||
implicit none
|
||||
type(psb_dspmat_type), intent(in) :: a
|
||||
integer, intent(out) :: iret
|
||||
character(len=*), optional, intent(in) :: mtitle
|
||||
integer, optional, intent(in) :: eiout
|
||||
integer, optional, intent(in) :: iunit
|
||||
character(len=*), optional, intent(in) :: filename
|
||||
character(len=*), optional, intent(in) :: key
|
||||
real(kind(1.d0)), optional :: rhs(:)
|
||||
@@ -213,16 +213,16 @@ contains
|
||||
if (filename=='-') then
|
||||
iout=6
|
||||
else
|
||||
if (present(eiout)) then
|
||||
iout = eiout
|
||||
if (present(iunit)) then
|
||||
iout = iunit
|
||||
else
|
||||
iout=99
|
||||
endif
|
||||
open(iout,file=filename, err=901, action='WRITE')
|
||||
endif
|
||||
else
|
||||
if (present(eiout)) then
|
||||
iout = eiout
|
||||
if (present(iunit)) then
|
||||
iout = iunit
|
||||
else
|
||||
iout=6
|
||||
endif
|
||||
@@ -520,13 +520,13 @@ contains
|
||||
|
||||
|
||||
|
||||
subroutine zhb_write(a,iret,eiout,filename,key,rhs,mtitle)
|
||||
subroutine zhb_write(a,iret,iunit,filename,key,rhs,mtitle)
|
||||
use psb_base_mod
|
||||
implicit none
|
||||
type(psb_zspmat_type), intent(in) :: a
|
||||
integer, intent(out) :: iret
|
||||
character(len=*), optional, intent(in) :: mtitle
|
||||
integer, optional, intent(in) :: eiout
|
||||
integer, optional, intent(in) :: iunit
|
||||
character(len=*), optional, intent(in) :: filename
|
||||
character(len=*), optional, intent(in) :: key
|
||||
complex(kind(1.d0)), optional :: rhs(:)
|
||||
@@ -554,16 +554,16 @@ contains
|
||||
if (filename=='-') then
|
||||
iout=6
|
||||
else
|
||||
if (present(eiout)) then
|
||||
iout = eiout
|
||||
if (present(iunit)) then
|
||||
iout = iunit
|
||||
else
|
||||
iout=99
|
||||
endif
|
||||
open(iout,file=filename, err=901, action='WRITE')
|
||||
endif
|
||||
else
|
||||
if (present(eiout)) then
|
||||
iout = eiout
|
||||
if (present(iunit)) then
|
||||
iout = iunit
|
||||
else
|
||||
iout=6
|
||||
endif
|
||||
|
||||
+12
-12
@@ -148,13 +148,13 @@ contains
|
||||
|
||||
|
||||
|
||||
subroutine dmm_mat_write(a,mtitle,iret,eiout,filename)
|
||||
subroutine dmm_mat_write(a,mtitle,iret,iunit,filename)
|
||||
use psb_base_mod
|
||||
implicit none
|
||||
type(psb_dspmat_type), intent(in) :: a
|
||||
integer, intent(out) :: iret
|
||||
character(len=*), intent(in) :: mtitle
|
||||
integer, optional, intent(in) :: eiout
|
||||
integer, optional, intent(in) :: iunit
|
||||
character(len=*), optional, intent(in) :: filename
|
||||
integer :: iout
|
||||
|
||||
@@ -165,16 +165,16 @@ contains
|
||||
if (filename=='-') then
|
||||
iout=6
|
||||
else
|
||||
if (present(eiout)) then
|
||||
iout = eiout
|
||||
if (present(iunit)) then
|
||||
iout = iunit
|
||||
else
|
||||
iout=99
|
||||
endif
|
||||
open(iout,file=filename, err=901, action='WRITE')
|
||||
endif
|
||||
else
|
||||
if (present(eiout)) then
|
||||
iout = eiout
|
||||
if (present(iunit)) then
|
||||
iout = iunit
|
||||
else
|
||||
iout=6
|
||||
endif
|
||||
@@ -330,13 +330,13 @@ contains
|
||||
|
||||
|
||||
|
||||
subroutine zmm_mat_write(a,mtitle,iret,eiout,filename)
|
||||
subroutine zmm_mat_write(a,mtitle,iret,iunit,filename)
|
||||
use psb_base_mod
|
||||
implicit none
|
||||
type(psb_zspmat_type), intent(in) :: a
|
||||
integer, intent(out) :: iret
|
||||
character(len=*), intent(in) :: mtitle
|
||||
integer, optional, intent(in) :: eiout
|
||||
integer, optional, intent(in) :: iunit
|
||||
character(len=*), optional, intent(in) :: filename
|
||||
integer :: iout
|
||||
|
||||
@@ -347,16 +347,16 @@ contains
|
||||
if (filename=='-') then
|
||||
iout=6
|
||||
else
|
||||
if (present(eiout)) then
|
||||
iout = eiout
|
||||
if (present(iunit)) then
|
||||
iout = iunit
|
||||
else
|
||||
iout=99
|
||||
endif
|
||||
open(iout,file=filename, err=901, action='WRITE')
|
||||
endif
|
||||
else
|
||||
if (present(eiout)) then
|
||||
iout = eiout
|
||||
if (present(iunit)) then
|
||||
iout = iunit
|
||||
else
|
||||
iout=6
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user