From 447a21b7f58254db065b323d90a9457e8b9e0086 Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Wed, 6 Mar 2013 17:49:38 +0000 Subject: [PATCH] mld2p4-2: config/pac.m4 configure.ac mlprec/mld_c_prec_type.f90 mlprec/mld_d_prec_type.f90 mlprec/mld_s_prec_type.f90 mlprec/mld_z_prec_type.f90 Minor configure message fixes. Added getters for pointers to smoother/solver. --- config/pac.m4 | 33 ----------------------- configure.ac | 18 +++++++------ mlprec/mld_c_prec_type.f90 | 54 ++++++++++++++++++++++++++++++++++++++ mlprec/mld_d_prec_type.f90 | 54 ++++++++++++++++++++++++++++++++++++++ mlprec/mld_s_prec_type.f90 | 54 ++++++++++++++++++++++++++++++++++++++ mlprec/mld_z_prec_type.f90 | 54 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 226 insertions(+), 41 deletions(-) diff --git a/config/pac.m4 b/config/pac.m4 index 3e28f5a7..fbcd38af 100644 --- a/config/pac.m4 +++ b/config/pac.m4 @@ -329,39 +329,6 @@ ifelse([$2], , , [ rm -rf conftest* fi rm -f conftest*]) -dnl @synopsis PAC_FORTRAN_HAVE_PSB_LONG_INT( [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) -dnl -dnl Will try to compile with psb_long_int_k_ -dnl -dnl Will use MPIFC, otherwise '$FC'. -dnl -dnl If the test passes, will execute ACTION-IF-FOUND. Otherwise, ACTION-IF-NOT-FOUND. -dnl -dnl @author Michele Martone -dnl -AC_DEFUN(PAC_FORTRAN_HAVE_PSB_LONG_INT, -ac_objext='.o' -ac_ext='f90' -ac_compile='${MPIFC-$FC} -c -o conftest${ac_objext} $FMFLAG$PSBLAS_DIR/include $FMFLAG$PSBLAS_DIR/lib conftest.$ac_ext 1>&5' -dnl Warning : square brackets are EVIL! -[AC_MSG_CHECKING([for version of PSBLAS supporting psb_long_int_k_]) -cat > conftest.$ac_ext <&AC_FD_CC - cat conftest.$ac_ext >&AC_FD_CC -ifelse([$2], , , [ rm -rf conftest* - $2 -])dnl -fi -rm -f conftest*]) dnl @synopsis PAC_FORTRAN_TEST_TR15581( [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl diff --git a/configure.ac b/configure.ac index 69367bad..422e8787 100755 --- a/configure.ac +++ b/configure.ac @@ -67,7 +67,7 @@ AC_MSG_NOTICE([ dnl NOTE : no spaces before the comma, and no brackets before the second argument! PAC_ARG_WITH_PSBLAS PSBLAS_DIR="$pac_cv_psblas_dir"; -AC_MSG_CHECKING([for PSBLAS build dir]) +AC_MSG_CHECKING([for PSBLAS install dir]) case $PSBLAS_DIR in /*) ;; *) AC_MSG_ERROR([The PSBLAS installation dir must be an absolute pathname @@ -202,15 +202,21 @@ AC_LANG([Fortran]) if test "X$MPIFC" = "X" ; then # This is our MPIFC compiler preference: it will override ACX_MPI's first try. - AC_CHECK_PROGS([MPIFC],[mpxlf95 mpxlf90 mpf95 mpf90 mpif95 mpif90 ftn]) + AC_CHECK_PROGS([MPIFC],[mpxlf2003_r mpxlf2003 mpxlf95_r mpxlf90 mpf95 mpf90 mpif95 mpif90 ]) fi ACX_MPI([], [AC_MSG_ERROR([[Cannot find any suitable MPI implementation for Fortran]])]) fi + # We leave a default language for the next checks. dnl AC_LANG([Fortran 77]) AC_LANG([C]) +dnl Now on, MPIFC should be set, as MPIF77 and MPICC + +############################################################################### +# Sanity checks, although redundant (useful when debugging this configure.ac)! +############################################################################### PAC_CHECK_SUPERLU if test "x$mld2p4_cv_have_superlu" == "xyes" ; then @@ -241,12 +247,8 @@ if test "x$FMFLAG" == "xnot" ; then FIFLAG="-I" fi -PAC_FORTRAN_HAVE_PSBLAS([AC_MSG_RESULT([yes.])],[AC_MSG_ERROR([no. - Could not find working version of PSBLAS.])]) - -PAC_FORTRAN_HAVE_PSB_LONG_INT([AC_MSG_RESULT([yes.])],[AC_MSG_ERROR([no. - Your version of PSBLAS does not define psb_long_int_k_; please get version 2.3.1 or newer.])]) - +PAC_FORTRAN_HAVE_PSBLAS([AC_MSG_RESULT([yes.])], + [AC_MSG_ERROR([no. Could not find working version of PSBLAS.])]) ############################################################################### # Variable substitutions : the Make.inc.in will have these @VARIABLES@ diff --git a/mlprec/mld_c_prec_type.f90 b/mlprec/mld_c_prec_type.f90 index c38d99f4..7c7a80c0 100644 --- a/mlprec/mld_c_prec_type.f90 +++ b/mlprec/mld_c_prec_type.f90 @@ -104,6 +104,8 @@ module mld_c_prec_type procedure, pass(prec) :: csetr => mld_ccprecsetr generic, public :: set => seti, setc, setr, & & cseti, csetc, csetr, setsm, setsv + procedure, pass(prec) :: get_smoother => mld_c_get_smootherp + procedure, pass(prec) :: get_solver => mld_c_get_solverp end type mld_cprec_type private :: mld_c_dump, mld_c_get_compl, mld_c_cmp_compl,& @@ -249,6 +251,58 @@ module mld_c_prec_type end interface contains + ! + ! Function returning a pointer to the smoother + ! + function mld_c_get_smootherp(prec,ilev) result(val) + implicit none + class(mld_cprec_type), target, intent(in) :: prec + integer(psb_ipk_), optional :: ilev + class(mld_c_base_smoother_type), pointer :: val + integer(psb_ipk_) :: ilev_ + + val => null() + if (present(ilev)) then + ilev_ = ilev + else + ! What is a good default? + ilev_ = 1 + end if + if (allocated(prec%precv)) then + if ((1<=ilev_).and.(ilev_<=size(prec%precv))) then + if (allocated(prec%precv(ilev_)%sm)) then + val => prec%precv(ilev_)%sm + end if + end if + end if + end function mld_c_get_smootherp + ! + ! Function returning a pointer to the solver + ! + function mld_c_get_solverp(prec,ilev) result(val) + implicit none + class(mld_cprec_type), target, intent(in) :: prec + integer(psb_ipk_), optional :: ilev + class(mld_c_base_solver_type), pointer :: val + integer(psb_ipk_) :: ilev_ + + val => null() + if (present(ilev)) then + ilev_ = ilev + else + ! What is a good default? + ilev_ = 1 + end if + if (allocated(prec%precv)) then + if ((1<=ilev_).and.(ilev_<=size(prec%precv))) then + if (allocated(prec%precv(ilev_)%sm)) then + if (allocated(prec%precv(ilev_)%sm%sv)) then + val => prec%precv(ilev_)%sm%sv + end if + end if + end if + end if + end function mld_c_get_solverp ! ! Function returning the size of the mld_prec_type data structure ! in bytes or in number of nonzeros of the operator(s) involved. diff --git a/mlprec/mld_d_prec_type.f90 b/mlprec/mld_d_prec_type.f90 index 0588721b..4a02f8a0 100644 --- a/mlprec/mld_d_prec_type.f90 +++ b/mlprec/mld_d_prec_type.f90 @@ -104,6 +104,8 @@ module mld_d_prec_type procedure, pass(prec) :: csetr => mld_dcprecsetr generic, public :: set => seti, setc, setr, & & cseti, csetc, csetr, setsm, setsv + procedure, pass(prec) :: get_smoother => mld_d_get_smootherp + procedure, pass(prec) :: get_solver => mld_d_get_solverp end type mld_dprec_type private :: mld_d_dump, mld_d_get_compl, mld_d_cmp_compl,& @@ -249,6 +251,58 @@ module mld_d_prec_type end interface contains + ! + ! Function returning a pointer to the smoother + ! + function mld_d_get_smootherp(prec,ilev) result(val) + implicit none + class(mld_dprec_type), target, intent(in) :: prec + integer(psb_ipk_), optional :: ilev + class(mld_d_base_smoother_type), pointer :: val + integer(psb_ipk_) :: ilev_ + + val => null() + if (present(ilev)) then + ilev_ = ilev + else + ! What is a good default? + ilev_ = 1 + end if + if (allocated(prec%precv)) then + if ((1<=ilev_).and.(ilev_<=size(prec%precv))) then + if (allocated(prec%precv(ilev_)%sm)) then + val => prec%precv(ilev_)%sm + end if + end if + end if + end function mld_d_get_smootherp + ! + ! Function returning a pointer to the solver + ! + function mld_d_get_solverp(prec,ilev) result(val) + implicit none + class(mld_dprec_type), target, intent(in) :: prec + integer(psb_ipk_), optional :: ilev + class(mld_d_base_solver_type), pointer :: val + integer(psb_ipk_) :: ilev_ + + val => null() + if (present(ilev)) then + ilev_ = ilev + else + ! What is a good default? + ilev_ = 1 + end if + if (allocated(prec%precv)) then + if ((1<=ilev_).and.(ilev_<=size(prec%precv))) then + if (allocated(prec%precv(ilev_)%sm)) then + if (allocated(prec%precv(ilev_)%sm%sv)) then + val => prec%precv(ilev_)%sm%sv + end if + end if + end if + end if + end function mld_d_get_solverp ! ! Function returning the size of the mld_prec_type data structure ! in bytes or in number of nonzeros of the operator(s) involved. diff --git a/mlprec/mld_s_prec_type.f90 b/mlprec/mld_s_prec_type.f90 index 156535cc..6ef93a9f 100644 --- a/mlprec/mld_s_prec_type.f90 +++ b/mlprec/mld_s_prec_type.f90 @@ -104,6 +104,8 @@ module mld_s_prec_type procedure, pass(prec) :: csetr => mld_scprecsetr generic, public :: set => seti, setc, setr, & & cseti, csetc, csetr, setsm, setsv + procedure, pass(prec) :: get_smoother => mld_s_get_smootherp + procedure, pass(prec) :: get_solver => mld_s_get_solverp end type mld_sprec_type private :: mld_s_dump, mld_s_get_compl, mld_s_cmp_compl,& @@ -249,6 +251,58 @@ module mld_s_prec_type end interface contains + ! + ! Function returning a pointer to the smoother + ! + function mld_s_get_smootherp(prec,ilev) result(val) + implicit none + class(mld_sprec_type), target, intent(in) :: prec + integer(psb_ipk_), optional :: ilev + class(mld_s_base_smoother_type), pointer :: val + integer(psb_ipk_) :: ilev_ + + val => null() + if (present(ilev)) then + ilev_ = ilev + else + ! What is a good default? + ilev_ = 1 + end if + if (allocated(prec%precv)) then + if ((1<=ilev_).and.(ilev_<=size(prec%precv))) then + if (allocated(prec%precv(ilev_)%sm)) then + val => prec%precv(ilev_)%sm + end if + end if + end if + end function mld_s_get_smootherp + ! + ! Function returning a pointer to the solver + ! + function mld_s_get_solverp(prec,ilev) result(val) + implicit none + class(mld_sprec_type), target, intent(in) :: prec + integer(psb_ipk_), optional :: ilev + class(mld_s_base_solver_type), pointer :: val + integer(psb_ipk_) :: ilev_ + + val => null() + if (present(ilev)) then + ilev_ = ilev + else + ! What is a good default? + ilev_ = 1 + end if + if (allocated(prec%precv)) then + if ((1<=ilev_).and.(ilev_<=size(prec%precv))) then + if (allocated(prec%precv(ilev_)%sm)) then + if (allocated(prec%precv(ilev_)%sm%sv)) then + val => prec%precv(ilev_)%sm%sv + end if + end if + end if + end if + end function mld_s_get_solverp ! ! Function returning the size of the mld_prec_type data structure ! in bytes or in number of nonzeros of the operator(s) involved. diff --git a/mlprec/mld_z_prec_type.f90 b/mlprec/mld_z_prec_type.f90 index f7d773b6..321c85f6 100644 --- a/mlprec/mld_z_prec_type.f90 +++ b/mlprec/mld_z_prec_type.f90 @@ -104,6 +104,8 @@ module mld_z_prec_type procedure, pass(prec) :: csetr => mld_zcprecsetr generic, public :: set => seti, setc, setr, & & cseti, csetc, csetr, setsm, setsv + procedure, pass(prec) :: get_smoother => mld_z_get_smootherp + procedure, pass(prec) :: get_solver => mld_z_get_solverp end type mld_zprec_type private :: mld_z_dump, mld_z_get_compl, mld_z_cmp_compl,& @@ -249,6 +251,58 @@ module mld_z_prec_type end interface contains + ! + ! Function returning a pointer to the smoother + ! + function mld_z_get_smootherp(prec,ilev) result(val) + implicit none + class(mld_zprec_type), target, intent(in) :: prec + integer(psb_ipk_), optional :: ilev + class(mld_z_base_smoother_type), pointer :: val + integer(psb_ipk_) :: ilev_ + + val => null() + if (present(ilev)) then + ilev_ = ilev + else + ! What is a good default? + ilev_ = 1 + end if + if (allocated(prec%precv)) then + if ((1<=ilev_).and.(ilev_<=size(prec%precv))) then + if (allocated(prec%precv(ilev_)%sm)) then + val => prec%precv(ilev_)%sm + end if + end if + end if + end function mld_z_get_smootherp + ! + ! Function returning a pointer to the solver + ! + function mld_z_get_solverp(prec,ilev) result(val) + implicit none + class(mld_zprec_type), target, intent(in) :: prec + integer(psb_ipk_), optional :: ilev + class(mld_z_base_solver_type), pointer :: val + integer(psb_ipk_) :: ilev_ + + val => null() + if (present(ilev)) then + ilev_ = ilev + else + ! What is a good default? + ilev_ = 1 + end if + if (allocated(prec%precv)) then + if ((1<=ilev_).and.(ilev_<=size(prec%precv))) then + if (allocated(prec%precv(ilev_)%sm)) then + if (allocated(prec%precv(ilev_)%sm%sv)) then + val => prec%precv(ilev_)%sm%sv + end if + end if + end if + end if + end function mld_z_get_solverp ! ! Function returning the size of the mld_prec_type data structure ! in bytes or in number of nonzeros of the operator(s) involved.