Folded in new precinit/precset.

psblas3-type-indexed
Salvatore Filippone 18 years ago
parent e3b29920ed
commit b350f41c87

@ -1,6 +1,8 @@
Changelog. A lot less detailed than usual, at least for past Changelog. A lot less detailed than usual, at least for past
history. history.
2007/05/22: Defined psb_precinit.
2007/05/15: Defined psb_sizeof. 2007/05/15: Defined psb_sizeof.
2007/05/15: Merged in various fixes coming from tests on SP5 and 2007/05/15: Merged in various fixes coming from tests on SP5 and

@ -10,9 +10,9 @@ F90=/usr/local/gcc42/bin/gfortran
FC=/usr/local/gcc42/bin/gfortran FC=/usr/local/gcc42/bin/gfortran
F77=$(FC) F77=$(FC)
CC=/usr/local/gcc42/bin/gcc CC=/usr/local/gcc42/bin/gcc
F90COPT=-O3 -ggdb -pg F90COPT=-O3
FCOPT=-O3 -ggdb -pg FCOPT=-O3
CCOPT=-O3 -ggdb -pg CCOPT=-O3
# #
# Which flag does your compiler use for module inclusion? # Which flag does your compiler use for module inclusion?
# Most compilers use -I but Sun uses -M # Most compilers use -I but Sun uses -M
@ -26,7 +26,7 @@ FIFLAG=-I
# MPI_FINC=-DMPI_H or MPI_FINC=-DMPI_MOD # # MPI_FINC=-DMPI_H or MPI_FINC=-DMPI_MOD #
# If necessary add an include dir # # If necessary add an include dir #
########################################################## ##########################################################
F90LINK=/usr/local/mpich-gcc42/bin/mpif90 F90LINK=/usr/local/mpich-gcc42/bin/mpif90 -pg
FLINK=/usr/local/mpich-gcc42/bin/mpif77 FLINK=/usr/local/mpich-gcc42/bin/mpif77
MPF90=/usr/local/mpich-gcc42/bin/mpif90 MPF90=/usr/local/mpich-gcc42/bin/mpif90
MPF77=/usr/local/mpich-gcc42/bin/mpif77 MPF77=/usr/local/mpich-gcc42/bin/mpif77

@ -1,6 +1,6 @@
include Make.inc include Make.inc
#PREC=../mld2p4 PREC=../mld2p4
PREC=prec #PREC=prec
library: library:

@ -54,7 +54,7 @@ module psb_error_mod
integer,dimension(5) :: i_err_data=0 ! array of integer data to complete the error msg integer,dimension(5) :: i_err_data=0 ! array of integer data to complete the error msg
! real(kind(1.d0))(dim=10) :: r_err_data=0.d0 ! array of real data to complete the error msg ! real(kind(1.d0))(dim=10) :: r_err_data=0.d0 ! array of real data to complete the error msg
! complex(dim=10) :: c_err_data=0.c0 ! array of complex data to complete the error msg ! complex(dim=10) :: c_err_data=0.c0 ! array of complex data to complete the error msg
character(len=20) :: a_err_data='' ! array of character data to complete the error msg character(len=40) :: a_err_data='' ! array of character data to complete the error msg
type(psb_errstack_node), pointer :: next ! pointer to the next element in the stack type(psb_errstack_node), pointer :: next ! pointer to the next element in the stack
end type psb_errstack_node end type psb_errstack_node
@ -175,7 +175,8 @@ contains
subroutine psb_errpop(err_c, r_name, i_e_d, a_e_d) subroutine psb_errpop(err_c, r_name, i_e_d, a_e_d)
integer, intent(out) :: err_c integer, intent(out) :: err_c
character(len=20), intent(out) :: r_name, a_e_d character(len=20), intent(out) :: r_name
character(len=40), intent(out) :: a_e_d
integer, intent(out) :: i_e_d(5) integer, intent(out) :: i_e_d(5)
type(psb_errstack_node), pointer :: old_node type(psb_errstack_node), pointer :: old_node
@ -201,7 +202,8 @@ contains
integer, intent(in) :: ictxt integer, intent(in) :: ictxt
integer :: err_c integer :: err_c
character(len=20) :: r_name, a_e_d character(len=20) :: r_name
character(len=40) :: a_e_d
integer :: i_e_d(5) integer :: i_e_d(5)
integer :: nprow, npcol, me, mypcol integer :: nprow, npcol, me, mypcol
integer, parameter :: ione=1, izero=0 integer, parameter :: ione=1, izero=0
@ -252,7 +254,8 @@ contains
subroutine psb_serror() subroutine psb_serror()
integer :: err_c integer :: err_c
character(len=20) :: r_name, a_e_d character(len=20) :: r_name
character(len=40) :: a_e_d
integer :: i_e_d(5) integer :: i_e_d(5)
integer, parameter :: ione=1, izero=0 integer, parameter :: ione=1, izero=0
@ -283,7 +286,8 @@ contains
subroutine psb_errmsg(err_c, r_name, i_e_d, a_e_d,me) subroutine psb_errmsg(err_c, r_name, i_e_d, a_e_d,me)
integer, intent(in) :: err_c integer, intent(in) :: err_c
character(len=20), intent(in) :: r_name, a_e_d character(len=20), intent(in) :: r_name
character(len=40), intent(in) :: a_e_d
integer, intent(in) :: i_e_d(5) integer, intent(in) :: i_e_d(5)
integer, optional :: me integer, optional :: me

@ -24,9 +24,9 @@ module \verb|psb_prec_mod|.
\subroutine{psb\_precset}{Sets the preconditioner type} \subroutine{psb\_precinit}{Initialize a preconditioner}
\syntax{call psb\_precset}{prec, ptype, info} \syntax{call psb\_precinit}{prec, ptype, info}
\begin{description} \begin{description}
\item[\bf On Entry] \item[\bf On Entry]

File diff suppressed because it is too large Load Diff

@ -0,0 +1,70 @@
!!$
!!$ Parallel Sparse BLAS v2.0
!!$ (C) Copyright 2006 Salvatore Filippone University of Rome Tor Vergata
!!$ Alfredo Buttari University of Rome Tor Vergata
!!$
!!$ Redistribution and use in source and binary forms, with or without
!!$ modification, are permitted provided that the following conditions
!!$ are met:
!!$ 1. Redistributions of source code must retain the above copyright
!!$ notice, this list of conditions and the following disclaimer.
!!$ 2. Redistributions in binary form must reproduce the above copyright
!!$ notice, this list of conditions, and the following disclaimer in the
!!$ documentation and/or other materials provided with the distribution.
!!$ 3. The name of the PSBLAS group or the names of its contributors may
!!$ not be used to endorse or promote products derived from this
!!$ software without specific written permission.
!!$
!!$ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
!!$ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
!!$ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
!!$ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
!!$ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
!!$ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
!!$ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
!!$ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
!!$ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
!!$ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
!!$ POSSIBILITY OF SUCH DAMAGE.
!!$
!!$
subroutine psb_dprecinit(p,ptype,info)
use psb_base_mod
use psb_prec_mod, psb_protect_name => psb_dprecinit
implicit none
type(psb_dprec_type), intent(inout) :: p
character(len=*), intent(in) :: ptype
integer, intent(out) :: info
info = 0
call psb_realloc(ifpsz,p%iprcparm,info)
if (info == 0) call psb_realloc(dfpsz,p%dprcparm,info)
if (info /= 0) return
p%iprcparm(:) = 0
select case(toupper(ptype(1:len_trim(ptype))))
case ('NONE','NOPREC')
p%iprcparm(:) = 0
p%iprcparm(p_type_) = noprec_
p%iprcparm(f_type_) = f_none_
case ('DIAG')
p%iprcparm(:) = 0
p%iprcparm(p_type_) = diag_
p%iprcparm(f_type_) = f_none_
case ('BJAC')
p%iprcparm(:) = 0
p%iprcparm(p_type_) = bjac_
p%iprcparm(f_type_) = f_ilu_n_
p%iprcparm(ilu_fill_in_) = 0
case default
write(0,*) 'Unknown preconditioner type request "',ptype,'"'
info = 2
end select
end subroutine psb_dprecinit

@ -28,52 +28,78 @@
!!$ POSSIBILITY OF SUCH DAMAGE. !!$ POSSIBILITY OF SUCH DAMAGE.
!!$ !!$
!!$ !!$
subroutine psb_dprecset(p,ptype,info,iv,rs,rv) subroutine psb_dprecseti(p,what,val,info)
use psb_base_mod use psb_base_mod
use psb_prec_mod, psb_protect_name => psb_dprecset use psb_prec_mod, psb_protect_name => psb_dprecseti
implicit none implicit none
type(psb_dprec_type), intent(inout) :: p type(psb_dprec_type), intent(inout) :: p
character(len=*), intent(in) :: ptype integer :: what, val
integer, intent(out) :: info integer, intent(out) :: info
integer, optional, intent(in) :: iv(:)
real(kind(1.d0)), optional, intent(in) :: rs
real(kind(1.d0)), optional, intent(in) :: rv(:)
character(len=len(ptype)) :: typeup
integer :: isz, err, nlev_, ilev_, i
info = 0 info = 0
select case(what)
case (f_type_)
if (p%iprcparm(p_type_) /= bjac_) then
write(0,*) 'WHAT is invalid for current preconditioner ',p%iprcparm(p_type_),&
& 'ignoring user specification'
return
endif
p%iprcparm(f_type_) = val
case (ilu_fill_in_)
if ((p%iprcparm(p_type_) /= bjac_).or.(p%iprcparm(f_type_) /= f_ilu_n_)) then
write(0,*) 'WHAT is invalid for current preconditioner ',p%iprcparm(p_type_),&
& 'ignoring user specification'
return
endif
p%iprcparm(ilu_fill_in_) = val
call psb_realloc(ifpsz,p%iprcparm,info) case default
if (info == 0) call psb_realloc(dfpsz,p%dprcparm,info) write(0,*) 'WHAT is invalid, ignoring user specification'
if (info /= 0) return
p%iprcparm(:) = 0
select case(toupper(ptype(1:len_trim(ptype)))) end select
case ('NONE','NOPREC') return
p%iprcparm(:) = 0
p%iprcparm(p_type_) = noprec_
p%iprcparm(f_type_) = f_none_
case ('DIAG') end subroutine psb_dprecseti
p%iprcparm(:) = 0
p%iprcparm(p_type_) = diag_
p%iprcparm(f_type_) = f_none_
case ('BJAC')
p%iprcparm(:) = 0 subroutine psb_dprecsetd(p,what,val,info)
p%iprcparm(p_type_) = bjac_
p%iprcparm(f_type_) = f_ilu_n_ use psb_base_mod
p%iprcparm(ilu_fill_in_) = 0 use psb_prec_mod, psb_protect_name => psb_dprecsetd
implicit none
type(psb_dprec_type), intent(inout) :: p
integer :: what
real(kind(1.d0)) :: val
integer, intent(out) :: info
!
! This will have to be changed if/when we put together an ILU(eps)
! factorization.
!
select case(what)
!!$ case (f_type_)
!!$ if (p%iprcparm(p_type_) /= bjac_) then
!!$ write(0,*) 'WHAT is invalid for current preconditioner ',p%iprcparm(p_type_),&
!!$ & 'ignoring user specification'
!!$ return
!!$ endif
!!$ p%iprcparm(f_type_) = val
!!$
!!$ case (ilu_fill_in_)
!!$ if ((p%iprcparm(p_type_) /= bjac_).or.(p%iprcparm(f_type_) /= f_ilu_n_)) then
!!$ write(0,*) 'WHAT is invalid for current preconditioner ',p%iprcparm(p_type_),&
!!$ & 'ignoring user specification'
!!$ return
!!$ endif
!!$ p%iprcparm(ilu_fill_in_) = val
case default case default
write(0,*) 'Unknown preconditioner type request "',ptype,'"' write(0,*) 'WHAT is invalid, ignoring user specification'
err = 2
end select end select
return
info = err end subroutine psb_dprecsetd
end subroutine psb_dprecset

@ -55,29 +55,60 @@ module psb_prec_mod
end subroutine psb_zprecbld end subroutine psb_zprecbld
end interface end interface
interface psb_precset interface psb_precinit
subroutine psb_dprecset(prec,ptype,info,iv,rs,rv) subroutine psb_dprecinit(prec,ptype,info)
use psb_base_mod use psb_base_mod
use psb_prec_type use psb_prec_type
implicit none implicit none
type(psb_dprec_type), intent(inout) :: prec type(psb_dprec_type), intent(inout) :: prec
character(len=*), intent(in) :: ptype character(len=*), intent(in) :: ptype
integer, intent(out) :: info integer, intent(out) :: info
integer, optional, intent(in) :: iv(:) end subroutine psb_dprecinit
real(kind(1.d0)), optional, intent(in) :: rs subroutine psb_zprecinit(prec,ptype,info)
real(kind(1.d0)), optional, intent(in) :: rv(:)
end subroutine psb_dprecset
subroutine psb_zprecset(prec,ptype,info,iv,rs,rv)
use psb_base_mod use psb_base_mod
use psb_prec_type use psb_prec_type
implicit none implicit none
type(psb_zprec_type), intent(inout) :: prec type(psb_zprec_type), intent(inout) :: prec
character(len=*), intent(in) :: ptype character(len=*), intent(in) :: ptype
integer, intent(out) :: info integer, intent(out) :: info
integer, optional, intent(in) :: iv(:) end subroutine psb_zprecinit
real(kind(1.d0)), optional, intent(in) :: rs end interface
real(kind(1.d0)), optional, intent(in) :: rv(:)
end subroutine psb_zprecset interface psb_precset
subroutine psb_dprecseti(prec,what,val,info)
use psb_base_mod
use psb_prec_type
implicit none
type(psb_dprec_type), intent(inout) :: prec
integer :: what, val
integer, intent(out) :: info
end subroutine psb_dprecseti
subroutine psb_dprecsetd(prec,what,val,info)
use psb_base_mod
use psb_prec_type
implicit none
type(psb_dprec_type), intent(inout) :: prec
integer :: what
real(kind(1.d0)) :: val
integer, intent(out) :: info
end subroutine psb_dprecsetd
subroutine psb_zprecseti(prec,what,val,info)
use psb_base_mod
use psb_prec_type
implicit none
type(psb_zprec_type), intent(inout) :: prec
integer :: what, val
integer, intent(out) :: info
end subroutine psb_zprecseti
subroutine psb_zprecsetd(prec,what,val,info)
use psb_base_mod
use psb_prec_type
implicit none
type(psb_zprec_type), intent(inout) :: prec
integer :: what
real(kind(1.d0)) :: val
integer, intent(out) :: info
end subroutine psb_zprecsetd
end interface end interface

@ -0,0 +1,73 @@
!!$
!!$ Parallel Sparse BLAS v2.0
!!$ (C) Copyright 2006 Salvatore Filippone University of Rome Tor Vergata
!!$ Alfredo Buttari University of Rome Tor Vergata
!!$
!!$ Redistribution and use in source and binary forms, with or without
!!$ modification, are permitted provided that the following conditions
!!$ are met:
!!$ 1. Redistributions of source code must retain the above copyright
!!$ notice, this list of conditions and the following disclaimer.
!!$ 2. Redistributions in binary form must reproduce the above copyright
!!$ notice, this list of conditions, and the following disclaimer in the
!!$ documentation and/or other materials provided with the distribution.
!!$ 3. The name of the PSBLAS group or the names of its contributors may
!!$ not be used to endorse or promote products derived from this
!!$ software without specific written permission.
!!$
!!$ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
!!$ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
!!$ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
!!$ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
!!$ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
!!$ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
!!$ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
!!$ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
!!$ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
!!$ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
!!$ POSSIBILITY OF SUCH DAMAGE.
!!$
!!$
subroutine psb_zprecinit(p,ptype,info)
use psb_base_mod
use psb_prec_mod, psb_protect_name => psb_zprecinit
implicit none
type(psb_zprec_type), intent(inout) :: p
character(len=*), intent(in) :: ptype
integer, intent(out) :: info
info = 0
call psb_realloc(ifpsz,p%iprcparm,info)
if (info == 0) call psb_realloc(dfpsz,p%dprcparm,info)
if (info /= 0) return
p%iprcparm(:) = 0
select case(toupper(ptype(1:len_trim(ptype))))
case ('NONE','NOPREC')
p%iprcparm(:) = 0
p%iprcparm(p_type_) = noprec_
p%iprcparm(f_type_) = f_none_
case ('DIAG')
p%iprcparm(:) = 0
p%iprcparm(p_type_) = diag_
p%iprcparm(f_type_) = f_none_
case ('BJAC')
p%iprcparm(:) = 0
p%iprcparm(p_type_) = bjac_
p%iprcparm(f_type_) = f_ilu_n_
p%iprcparm(ilu_fill_in_) = 0
case default
write(0,*) 'Unknown preconditioner type request "',ptype,'"'
info = 2
end select
end subroutine psb_zprecinit

@ -28,53 +28,78 @@
!!$ POSSIBILITY OF SUCH DAMAGE. !!$ POSSIBILITY OF SUCH DAMAGE.
!!$ !!$
!!$ !!$
subroutine psb_zprecset(p,ptype,info,iv,rs,rv) subroutine psb_zprecseti(p,what,val,info)
use psb_base_mod use psb_base_mod
use psb_prec_mod, psb_protect_name => psb_zprecset use psb_prec_mod, psb_protect_name => psb_zprecseti
implicit none implicit none
type(psb_zprec_type), intent(inout) :: p type(psb_zprec_type), intent(inout) :: p
character(len=*), intent(in) :: ptype integer :: what, val
integer, intent(out) :: info integer, intent(out) :: info
integer, optional, intent(in) :: iv(:)
real(kind(1.d0)), optional, intent(in) :: rs
real(kind(1.d0)), optional, intent(in) :: rv(:)
character(len=len(ptype)) :: typeup
integer :: isz, err, nlev_, ilev_, i
info = 0 info = 0
select case(what)
case (f_type_)
if (p%iprcparm(p_type_) /= bjac_) then
write(0,*) 'WHAT is invalid for current preconditioner ',p%iprcparm(p_type_),&
& 'ignoring user specification'
return
endif
p%iprcparm(f_type_) = val
case (ilu_fill_in_)
if ((p%iprcparm(p_type_) /= bjac_).or.(p%iprcparm(f_type_) /= f_ilu_n_)) then
write(0,*) 'WHAT is invalid for current preconditioner ',p%iprcparm(p_type_),&
& 'ignoring user specification'
return
endif
p%iprcparm(ilu_fill_in_) = val
case default
write(0,*) 'WHAT is invalid, ignoring user specification'
end select
return
end subroutine psb_zprecseti
call psb_realloc(ifpsz,p%iprcparm,info)
if (info == 0) call psb_realloc(dfpsz,p%dprcparm,info)
if (info /= 0) return
p%iprcparm(:) = 0
select case(toupper(ptype(1:len_trim(ptype)))) subroutine psb_zprecsetd(p,what,val,info)
case ('NONE','NOPREC')
p%iprcparm(:) = 0
p%iprcparm(p_type_) = noprec_
p%iprcparm(f_type_) = f_none_
case ('DIAG') use psb_base_mod
p%iprcparm(:) = 0 use psb_prec_mod, psb_protect_name => psb_zprecsetd
p%iprcparm(p_type_) = diag_ implicit none
p%iprcparm(f_type_) = f_none_ type(psb_zprec_type), intent(inout) :: p
integer :: what
real(kind(1.d0)) :: val
integer, intent(out) :: info
case ('BJAC') !
p%iprcparm(:) = 0 ! This will have to be changed if/when we put together an ILU(eps)
p%iprcparm(p_type_) = bjac_ ! factorization.
p%iprcparm(f_type_) = f_ilu_n_ !
p%iprcparm(ilu_fill_in_) = 0 select case(what)
!!$ case (f_type_)
!!$ if (p%iprcparm(p_type_) /= bjac_) then
!!$ write(0,*) 'WHAT is invalid for current preconditioner ',p%iprcparm(p_type_),&
!!$ & 'ignoring user specification'
!!$ return
!!$ endif
!!$ p%iprcparm(f_type_) = val
!!$
!!$ case (ilu_fill_in_)
!!$ if ((p%iprcparm(p_type_) /= bjac_).or.(p%iprcparm(f_type_) /= f_ilu_n_)) then
!!$ write(0,*) 'WHAT is invalid for current preconditioner ',p%iprcparm(p_type_),&
!!$ & 'ignoring user specification'
!!$ return
!!$ endif
!!$ p%iprcparm(ilu_fill_in_) = val
case default case default
write(0,*) 'Unknown preconditioner type request "',ptype,'"' write(0,*) 'WHAT is invalid, ignoring user specification'
err = 2
end select end select
return
info = err end subroutine psb_zprecsetd
end subroutine psb_zprecset

@ -203,13 +203,13 @@ program df_sample
igsmth=-1 igsmth=-1
select case(iprec) select case(iprec)
case(noprec_) case(noprec_)
call psb_precset(pre,'noprec',info) call psb_precinit(pre,'noprec',info)
case(diag_) case(diag_)
call psb_precset(pre,'diag',info) call psb_precinit(pre,'diag',info)
case(bjac_) case(bjac_)
call psb_precset(pre,'bjac',info) call psb_precinit(pre,'bjac',info)
case default case default
call psb_precset(pre,'bjac',info) call psb_precinit(pre,'bjac',info)
end select end select
! building the preconditioner ! building the preconditioner

@ -154,13 +154,13 @@ program pde90
if(iam == psb_root_) write(0,'("Setting preconditioner to : ",a)')pr_to_str(iprec) if(iam == psb_root_) write(0,'("Setting preconditioner to : ",a)')pr_to_str(iprec)
select case(iprec) select case(iprec)
case(noprec_) case(noprec_)
call psb_precset(pre,'noprec',info) call psb_precinit(pre,'noprec',info)
case(diag_) case(diag_)
call psb_precset(pre,'diag',info) call psb_precinit(pre,'diag',info)
case(bjac_) case(bjac_)
call psb_precset(pre,'bjac',info) call psb_precinit(pre,'bjac',info)
case default case default
call psb_precset(pre,'bjac',info) call psb_precinit(pre,'bjac',info)
end select end select
call psb_barrier(ictxt) call psb_barrier(ictxt)

Loading…
Cancel
Save