diff --git a/Changelog b/Changelog index b58366ec..7d700143 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,13 @@ Changelog. A lot less detailed than usual, at least for past history. +2017/04/03: Remove obsolete stuff. +2017/03/17: Fixed level%cnv; add coarse _solver tracker. +2017/02/18: Take out clean_zeros; changed NOFILTER; defined FBGS; take out + n_prec_levs. +2017/02/12: Updated mat_dist usage, dubious SP shell for UMFPACK, fixes + for RPM packaging. +2017/02/02: Fix superlu configury +2016/11/12: Fix hierarchy/smoothers build to handle 1 level. 2016/10/03: Merged changes to hierearchy building. 2016/08/20: Reimplemented decoupled aggregation 2016/07/20: Refactored application of multilevel. Defined V,W and diff --git a/config/pac.m4 b/config/pac.m4 index ca44ef70..9e7d801e 100644 --- a/config/pac.m4 +++ b/config/pac.m4 @@ -704,7 +704,7 @@ fi if test "x$mld2p4_cv_superludistlibdir" != "x"; then SLUDIST_LIBS="-L$mld2p4_cv_superludistlibdir" elif test "x$mld2p4_cv_superludistdir" != "x"; then - SLUDIST_LIBS="-L$mld2p4_cv_superludir" + SLUDIST_LIBS="-L$mld2p4_cv_superludistdir" fi LIBS="$SLUDIST_LIBS $save_LIBS" @@ -721,7 +721,7 @@ dnl Maybe Include or include subdirs? AC_CHECK_HEADERS([superlu_ddefs.h], [pac_sludist_header_ok=yes], - [pac_sludist_header_ok=no; SLUDIST_INCLUDES=""]) + [pac_sludist_header_ok=no; SLUDIST_INCLUDES=""; SLUDIST_LIBS=""; ]) fi if test "x$pac_sludist_header_ok" == "xyes" ; then @@ -742,6 +742,7 @@ if test "x$pac_sludist_header_ok" == "xyes" ; then SLUDIST_LIBS="";SLUDIST_INCLUDES=""]) fi AC_MSG_RESULT($pac_sludist_lib_ok) + if test "x$pac_sludist_lib_ok" == "xyes" ; then AC_MSG_CHECKING([for superlu_dist version 4]) AC_LANG_PUSH([C]) ac_cc=${MPICC-$CC} @@ -770,8 +771,12 @@ if test "x$pac_sludist_header_ok" == "xyes" ; then [ AC_MSG_RESULT([no]); pac_sludist_version="4";]) AC_LANG_POP([C]) - fi fi + else + SLUDIST_LIBS=""; + SLUDIST_INCLUDES=""; + fi + fi LIBS="$save_LIBS"; CPPFLAGS="$save_CPPFLAGS"; diff --git a/configure b/configure index d0e143d2..fe9ed175 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.63 for MLD2P4 2.0. +# Generated by GNU Autoconf 2.63 for MLD2P4 2.1. # # Report bugs to . # @@ -596,8 +596,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='MLD2P4' PACKAGE_TARNAME='mld2p4' -PACKAGE_VERSION='2.0' -PACKAGE_STRING='MLD2P4 2.0' +PACKAGE_VERSION='2.1' +PACKAGE_STRING='MLD2P4 2.1' PACKAGE_BUGREPORT='bugreport@mld2p4.it' ac_unique_file="mlprec/mld_prec_type.f90" @@ -668,10 +668,6 @@ LAPACK_LIBS EGREP GREP CPP -ac_ct_F77 -FFLAGS -F77 -MPIF77 MPIFC MPILIBS MPICC @@ -804,9 +800,6 @@ CFLAGS CPPFLAGS MPICC MPIFC -F77 -FFLAGS -MPIF77 CPP' @@ -1360,7 +1353,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures MLD2P4 2.0 to adapt to many kinds of systems. +\`configure' configures MLD2P4 2.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1426,7 +1419,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of MLD2P4 2.0:";; + short | recursive ) echo "Configuration of MLD2P4 2.1:";; esac cat <<\_ACEOF @@ -1521,9 +1514,6 @@ Some influential environment variables: you have headers in a nonstandard directory MPICC MPI C compiler command MPIFC MPI Fortran compiler command - F77 Fortran 77 compiler command - FFLAGS Fortran 77 compiler flags - MPIF77 MPI Fortran 77 compiler command CPP C preprocessor Use these variables to override the choices made by `configure' or to help @@ -1592,7 +1582,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -MLD2P4 configure 2.0 +MLD2P4 configure 2.1 generated by GNU Autoconf 2.63 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1606,7 +1596,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by MLD2P4 $as_me 2.0, which was +It was created by MLD2P4 $as_me 2.1, which was generated by GNU Autoconf 2.63. Invocation command line was $ $0 $@ @@ -1977,7 +1967,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # VERSION is the file containing the PSBLAS version code # FIXME -mld2p4_cv_version="2.0" +mld2p4_cv_version="2.1" # A sample source file @@ -2557,7 +2547,7 @@ fi # Define the identity of the package. PACKAGE='mld2p4' - VERSION='2.0' + VERSION='2.1' cat >>confdefs.h <<_ACEOF @@ -2721,9 +2711,7 @@ esac { $as_echo "$as_me:$LINENO: result: $INSTALL_DIR $INSTALL_INCLUDEDIR $INSTALL_LIBDIR $INSTALL_DOCSDIR $INSTALL_SAMPLESDIR" >&5 $as_echo "$INSTALL_DIR $INSTALL_INCLUDEDIR $INSTALL_LIBDIR $INSTALL_DOCSDIR $INSTALL_SAMPLESDIR" >&6; } -############################################################################### -# Compilers detection: FC,F77,CC should be set, if found. -############################################################################### +save_FCFLAGS="$FCFLAGS"; ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' @@ -3215,6 +3203,8 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu +FCFLAGS="$save_FCFLAGS"; +save_CFLAGS="$CFLAGS"; ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -3895,6 +3885,15 @@ else fi +CFLAGS="$save_CFLAGS"; + + +# Sanity checks, although redundant (useful when debugging this configure.ac)! +if test "X$FC" == "X" ; then + { { $as_echo "$as_me:$LINENO: error: Problem : No Fortran compiler specified nor found!" >&5 +$as_echo "$as_me: error: Problem : No Fortran compiler specified nor found!" >&2;} + { (exit 1); exit 1; }; } +fi if test "X$CC" == "X" ; then { { $as_echo "$as_me:$LINENO: error: Problem : No C compiler specified nor found!" >&5 @@ -3909,7 +3908,7 @@ if eval "$FC -qversion 2>&1 | grep XL 2>/dev/null" ; then FDEFINES="$mld_cv_define_prepend-DXLF_10 $FDEFINES" fi - # Note : there coule be problems with old xlf compiler versions ( <10.1 ) + # Note : there could be problems with old xlf compiler versions ( <10.1 ) # since (as far as it is known to us) -WF, is not used in earlier versions. # More problems could be undocumented yet. fi @@ -3944,7 +3943,6 @@ fi if test x"$pac_cv_serial_mpi" == x"yes" ; then FAKEMPI="fakempi.o"; MPIFC="$FC"; - MPIF77="$F77"; MPICC="$CC"; else ac_ext=c @@ -4204,846 +4202,106 @@ sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_mpi_MPI_Init" >&5 -$as_echo "$ac_cv_lib_mpi_MPI_Init" >&6; } -if test "x$ac_cv_lib_mpi_MPI_Init" = x""yes; then - MPILIBS="-lmpi" -fi - -fi -if test x = x"$MPILIBS"; then - { $as_echo "$as_me:$LINENO: checking for MPI_Init in -lmpich" >&5 -$as_echo_n "checking for MPI_Init in -lmpich... " >&6; } -if test "${ac_cv_lib_mpich_MPI_Init+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lmpich $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char MPI_Init (); -int -main () -{ -return MPI_Init (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - ac_cv_lib_mpich_MPI_Init=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_mpich_MPI_Init=no -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_mpich_MPI_Init" >&5 -$as_echo "$ac_cv_lib_mpich_MPI_Init" >&6; } -if test "x$ac_cv_lib_mpich_MPI_Init" = x""yes; then - MPILIBS="-lmpich" -fi - -fi - -if test x != x"$MPILIBS"; then - { $as_echo "$as_me:$LINENO: checking for mpi.h" >&5 -$as_echo_n "checking for mpi.h... " >&6; } - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - MPILIBS="" - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -CC="$acx_mpi_save_CC" - - - -# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: -if test x = x"$MPILIBS"; then - { { $as_echo "$as_me:$LINENO: error: Cannot find any suitable MPI implementation for C" >&5 -$as_echo "$as_me: error: Cannot find any suitable MPI implementation for C" >&2;} - { (exit 1); exit 1; }; } - : -else - -cat >>confdefs.h <<\_ACEOF -#define HAVE_MPI 1 -_ACEOF - - : -fi - - - -ac_ext=${ac_fc_srcext-f} -ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' -ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_fc_compiler_gnu - - -if test "X$MPIFC" = "X" ; then - # This is our MPIFC compiler preference: it will override ACX_MPI's first try. - for ac_prog in mpxlf2003_r mpxlf2003 mpxlf95_r mpxlf90 mpf95 mpf90 mpifort mpif95 mpif90 ftn -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_MPIFC+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$MPIFC"; then - ac_cv_prog_MPIFC="$MPIFC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_MPIFC="$ac_prog" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -MPIFC=$ac_cv_prog_MPIFC -if test -n "$MPIFC"; then - { $as_echo "$as_me:$LINENO: result: $MPIFC" >&5 -$as_echo "$MPIFC" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$MPIFC" && break -done - -fi - - - - - - - - for ac_prog in mpif90 hf90 mpxlf90 mpxlf95 mpf90 cmpifc cmpif90c -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_MPIFC+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$MPIFC"; then - ac_cv_prog_MPIFC="$MPIFC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_MPIFC="$ac_prog" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -MPIFC=$ac_cv_prog_MPIFC -if test -n "$MPIFC"; then - { $as_echo "$as_me:$LINENO: result: $MPIFC" >&5 -$as_echo "$MPIFC" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$MPIFC" && break -done -test -n "$MPIFC" || MPIFC="$FC" - - acx_mpi_save_FC="$FC" - FC="$MPIFC" - - - -if test x = x"$MPILIBS"; then - { $as_echo "$as_me:$LINENO: checking for MPI_Init" >&5 -$as_echo_n "checking for MPI_Init... " >&6; } - cat >conftest.$ac_ext <<_ACEOF - program main - call MPI_Init - end -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_fc_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - MPILIBS=" " - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi - - if test x = x"$MPILIBS"; then - { $as_echo "$as_me:$LINENO: checking for MPI_Init in -lfmpi" >&5 -$as_echo_n "checking for MPI_Init in -lfmpi... " >&6; } -if test "${ac_cv_lib_fmpi_MPI_Init+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lfmpi $LIBS" -cat >conftest.$ac_ext <<_ACEOF - program main - call MPI_Init - end -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_fc_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - ac_cv_lib_fmpi_MPI_Init=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_fmpi_MPI_Init=no -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_fmpi_MPI_Init" >&5 -$as_echo "$ac_cv_lib_fmpi_MPI_Init" >&6; } -if test "x$ac_cv_lib_fmpi_MPI_Init" = x""yes; then - MPILIBS="-lfmpi" -fi - - fi - if test x = x"$MPILIBS"; then - { $as_echo "$as_me:$LINENO: checking for MPI_Init in -lmpichf90" >&5 -$as_echo_n "checking for MPI_Init in -lmpichf90... " >&6; } -if test "${ac_cv_lib_mpichf90_MPI_Init+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lmpichf90 $LIBS" -cat >conftest.$ac_ext <<_ACEOF - program main - call MPI_Init - end -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_fc_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - ac_cv_lib_mpichf90_MPI_Init=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_mpichf90_MPI_Init=no -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_mpichf90_MPI_Init" >&5 -$as_echo "$ac_cv_lib_mpichf90_MPI_Init" >&6; } -if test "x$ac_cv_lib_mpichf90_MPI_Init" = x""yes; then - MPILIBS="-lmpichf90" -fi - - fi - -if test x = x"$MPILIBS"; then - { $as_echo "$as_me:$LINENO: checking for MPI_Init in -lmpi" >&5 -$as_echo_n "checking for MPI_Init in -lmpi... " >&6; } -if test "${ac_cv_lib_mpi_MPI_Init+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lmpi $LIBS" -cat >conftest.$ac_ext <<_ACEOF - program main - call MPI_Init - end -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_fc_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - ac_cv_lib_mpi_MPI_Init=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_mpi_MPI_Init=no -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_mpi_MPI_Init" >&5 -$as_echo "$ac_cv_lib_mpi_MPI_Init" >&6; } -if test "x$ac_cv_lib_mpi_MPI_Init" = x""yes; then - MPILIBS="-lmpi" -fi - -fi -if test x = x"$MPILIBS"; then - { $as_echo "$as_me:$LINENO: checking for MPI_Init in -lmpich" >&5 -$as_echo_n "checking for MPI_Init in -lmpich... " >&6; } -if test "${ac_cv_lib_mpich_MPI_Init+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lmpich $LIBS" -cat >conftest.$ac_ext <<_ACEOF - program main - call MPI_Init - end -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_fc_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - ac_cv_lib_mpich_MPI_Init=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_mpich_MPI_Init=no -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_mpich_MPI_Init" >&5 -$as_echo "$ac_cv_lib_mpich_MPI_Init" >&6; } -if test "x$ac_cv_lib_mpich_MPI_Init" = x""yes; then - MPILIBS="-lmpich" -fi - -fi - -if test x != x"$MPILIBS"; then - { $as_echo "$as_me:$LINENO: checking for mpif.h" >&5 -$as_echo_n "checking for mpif.h... " >&6; } - cat >conftest.$ac_ext <<_ACEOF - program main - include 'mpif.h' - end -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_fc_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - MPILIBS="" - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -FC="$acx_mpi_save_FC" - - - -# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: -if test x = x"$MPILIBS"; then - { { $as_echo "$as_me:$LINENO: error: Cannot find any suitable MPI implementation for Fortran" >&5 -$as_echo "$as_me: error: Cannot find any suitable MPI implementation for Fortran" >&2;} - { (exit 1); exit 1; }; } - : -else - -cat >>confdefs.h <<\_ACEOF -#define HAVE_MPI 1 -_ACEOF - - : -fi - - -ac_ext=f -ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' -ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_f77_compiler_gnu - -if test "X$MPIF77" = "X" ; then - # This is our MPIFC compiler preference: it will override ACX_MPI's first try. - for ac_prog in mpxlf mpf77 mpif77 ftn -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_MPIF77+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$MPIF77"; then - ac_cv_prog_MPIF77="$MPIF77" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_MPIF77="$ac_prog" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -MPIF77=$ac_cv_prog_MPIF77 -if test -n "$MPIF77"; then - { $as_echo "$as_me:$LINENO: result: $MPIF77" >&5 -$as_echo "$MPIF77" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$MPIF77" && break -done - -fi -ac_ext=f -ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' -ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_f77_compiler_gnu -if test -n "$ac_tool_prefix"; then - for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_F77+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$F77"; then - ac_cv_prog_F77="$F77" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_F77="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -F77=$ac_cv_prog_F77 -if test -n "$F77"; then - { $as_echo "$as_me:$LINENO: result: $F77" >&5 -$as_echo "$F77" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$F77" && break - done -fi -if test -z "$F77"; then - ac_ct_F77=$F77 - for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_F77+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_F77"; then - ac_cv_prog_ac_ct_F77="$ac_ct_F77" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_F77="$ac_prog" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_F77=$ac_cv_prog_ac_ct_F77 -if test -n "$ac_ct_F77"; then - { $as_echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 -$as_echo "$ac_ct_F77" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_F77" && break -done - - if test "x$ac_ct_F77" = x; then - F77="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - F77=$ac_ct_F77 - fi -fi - - -# Provide some information about the compiler. -$as_echo "$as_me:$LINENO: checking for Fortran 77 compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -{ (ac_try="$ac_compiler --version >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compiler --version >&5") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -v >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compiler -v >&5") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -V >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compiler -V >&5") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -rm -f a.out +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_mpi_MPI_Init" >&5 +$as_echo "$ac_cv_lib_mpi_MPI_Init" >&6; } +if test "x$ac_cv_lib_mpi_MPI_Init" = x""yes; then + MPILIBS="-lmpi" +fi -# If we don't use `.F' as extension, the preprocessor is not run on the -# input file. (Note that this only needs to work for GNU compilers.) -ac_save_ext=$ac_ext -ac_ext=F -{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5 -$as_echo_n "checking whether we are using the GNU Fortran 77 compiler... " >&6; } -if test "${ac_cv_f77_compiler_gnu+set}" = set; then +fi +if test x = x"$MPILIBS"; then + { $as_echo "$as_me:$LINENO: checking for MPI_Init in -lmpich" >&5 +$as_echo_n "checking for MPI_Init in -lmpich... " >&6; } +if test "${ac_cv_lib_mpich_MPI_Init+set}" = set; then $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF - program main -#ifndef __GNUC__ - choke me -#endif + ac_check_lib_save_LIBS=$LIBS +LIBS="-lmpich $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ - end +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char MPI_Init (); +int +main () +{ +return MPI_Init (); + ; + return 0; +} _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { - test -z "$ac_f77_werror_flag" || + test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_compiler_gnu=yes + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_lib_mpich_MPI_Init=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_compiler_gnu=no + ac_cv_lib_mpich_MPI_Init=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_f77_compiler_gnu=$ac_compiler_gnu +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_mpich_MPI_Init" >&5 +$as_echo "$ac_cv_lib_mpich_MPI_Init" >&6; } +if test "x$ac_cv_lib_mpich_MPI_Init" = x""yes; then + MPILIBS="-lmpich" +fi fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5 -$as_echo "$ac_cv_f77_compiler_gnu" >&6; } -ac_ext=$ac_save_ext -ac_test_FFLAGS=${FFLAGS+set} -ac_save_FFLAGS=$FFLAGS -FFLAGS= -{ $as_echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5 -$as_echo_n "checking whether $F77 accepts -g... " >&6; } -if test "${ac_cv_prog_f77_g+set}" = set; then - $as_echo_n "(cached) " >&6 -else - FFLAGS=-g -cat >conftest.$ac_ext <<_ACEOF - program main - end +if test x != x"$MPILIBS"; then + { $as_echo "$as_me:$LINENO: checking for mpi.h" >&5 +$as_echo_n "checking for mpi.h... " >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ + + ; + return 0; +} _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" @@ -5060,47 +4318,95 @@ $as_echo "$ac_try_echo") >&5 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { - test -z "$ac_f77_werror_flag" || + test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_prog_f77_g=yes + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_prog_f77_g=no + MPILIBS="" + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +CC="$acx_mpi_save_CC" + + + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test x = x"$MPILIBS"; then + { { $as_echo "$as_me:$LINENO: error: Cannot find any suitable MPI implementation for C" >&5 +$as_echo "$as_me: error: Cannot find any suitable MPI implementation for C" >&2;} + { (exit 1); exit 1; }; } + : +else + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MPI 1 +_ACEOF + : fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5 -$as_echo "$ac_cv_prog_f77_g" >&6; } -if test "$ac_test_FFLAGS" = set; then - FFLAGS=$ac_save_FFLAGS -elif test $ac_cv_prog_f77_g = yes; then - if test "x$ac_cv_f77_compiler_gnu" = xyes; then - FFLAGS="-g -O2" - else - FFLAGS="-g" - fi + + + +ac_ext=${ac_fc_srcext-f} +ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' +ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_fc_compiler_gnu + + +if test "X$MPIFC" = "X" ; then + # This is our MPIFC compiler preference: it will override ACX_MPI's first try. + for ac_prog in mpxlf2003_r mpxlf2003 mpxlf95_r mpxlf90 mpf95 mpf90 mpifort mpif95 mpif90 ftn +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_MPIFC+set}" = set; then + $as_echo_n "(cached) " >&6 else - if test "x$ac_cv_f77_compiler_gnu" = xyes; then - FFLAGS="-O2" - else - FFLAGS= + if test -n "$MPIFC"; then + ac_cv_prog_MPIFC="$MPIFC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_MPIFC="$ac_prog" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi -fi +done +done +IFS=$as_save_IFS -if test $ac_compiler_gnu = yes; then - G77=yes +fi +fi +MPIFC=$ac_cv_prog_MPIFC +if test -n "$MPIFC"; then + { $as_echo "$as_me:$LINENO: result: $MPIFC" >&5 +$as_echo "$MPIFC" >&6; } else - G77= + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$MPIFC" && break +done + fi -ac_ext=f -ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' -ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_f77_compiler_gnu @@ -5108,17 +4414,17 @@ ac_compiler_gnu=$ac_cv_f77_compiler_gnu - for ac_prog in mpif77 hf77 mpxlf mpf77 mpif90 mpf90 mpxlf90 mpxlf95 mpxlf_r cmpifc cmpif90c + for ac_prog in mpif90 hf90 mpxlf90 mpxlf95 mpf90 cmpifc cmpif90c do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_MPIF77+set}" = set; then +if test "${ac_cv_prog_MPIFC+set}" = set; then $as_echo_n "(cached) " >&6 else - if test -n "$MPIF77"; then - ac_cv_prog_MPIF77="$MPIF77" # Let the user override the test. + if test -n "$MPIFC"; then + ac_cv_prog_MPIFC="$MPIFC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -5127,7 +4433,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_MPIF77="$ac_prog" + ac_cv_prog_MPIFC="$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -5137,22 +4443,22 @@ IFS=$as_save_IFS fi fi -MPIF77=$ac_cv_prog_MPIF77 -if test -n "$MPIF77"; then - { $as_echo "$as_me:$LINENO: result: $MPIF77" >&5 -$as_echo "$MPIF77" >&6; } +MPIFC=$ac_cv_prog_MPIFC +if test -n "$MPIFC"; then + { $as_echo "$as_me:$LINENO: result: $MPIFC" >&5 +$as_echo "$MPIFC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi - test -n "$MPIF77" && break + test -n "$MPIFC" && break done -test -n "$MPIF77" || MPIF77="$F77" +test -n "$MPIFC" || MPIFC="$FC" - acx_mpi_save_F77="$F77" - F77="$MPIF77" + acx_mpi_save_FC="$FC" + FC="$MPIFC" @@ -5179,7 +4485,7 @@ $as_echo "$ac_try_echo") >&5 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { - test -z "$ac_f77_werror_flag" || + test -z "$ac_fc_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || @@ -5229,7 +4535,7 @@ $as_echo "$ac_try_echo") >&5 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { - test -z "$ac_f77_werror_flag" || + test -z "$ac_fc_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || @@ -5256,13 +4562,13 @@ fi fi if test x = x"$MPILIBS"; then - { $as_echo "$as_me:$LINENO: checking for MPI_Init in -lfmpich" >&5 -$as_echo_n "checking for MPI_Init in -lfmpich... " >&6; } -if test "${ac_cv_lib_fmpich_MPI_Init+set}" = set; then + { $as_echo "$as_me:$LINENO: checking for MPI_Init in -lmpichf90" >&5 +$as_echo_n "checking for MPI_Init in -lmpichf90... " >&6; } +if test "${ac_cv_lib_mpichf90_MPI_Init+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lfmpich $LIBS" +LIBS="-lmpichf90 $LIBS" cat >conftest.$ac_ext <<_ACEOF program main call MPI_Init @@ -5283,18 +4589,18 @@ $as_echo "$ac_try_echo") >&5 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { - test -z "$ac_f77_werror_flag" || + test -z "$ac_fc_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then - ac_cv_lib_fmpich_MPI_Init=yes + ac_cv_lib_mpichf90_MPI_Init=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_lib_fmpich_MPI_Init=no + ac_cv_lib_mpichf90_MPI_Init=no fi rm -rf conftest.dSYM @@ -5302,10 +4608,10 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_fmpich_MPI_Init" >&5 -$as_echo "$ac_cv_lib_fmpich_MPI_Init" >&6; } -if test "x$ac_cv_lib_fmpich_MPI_Init" = x""yes; then - MPILIBS="-lfmpich" +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_mpichf90_MPI_Init" >&5 +$as_echo "$ac_cv_lib_mpichf90_MPI_Init" >&6; } +if test "x$ac_cv_lib_mpichf90_MPI_Init" = x""yes; then + MPILIBS="-lmpichf90" fi fi @@ -5338,7 +4644,7 @@ $as_echo "$ac_try_echo") >&5 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { - test -z "$ac_f77_werror_flag" || + test -z "$ac_fc_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || @@ -5392,7 +4698,7 @@ $as_echo "$ac_try_echo") >&5 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { - test -z "$ac_f77_werror_flag" || + test -z "$ac_fc_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || @@ -5442,7 +4748,7 @@ $as_echo "$ac_try_echo") >&5 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { - test -z "$ac_f77_werror_flag" || + test -z "$ac_fc_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then { $as_echo "$as_me:$LINENO: result: yes" >&5 @@ -5459,14 +4765,14 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -F77="$acx_mpi_save_F77" +FC="$acx_mpi_save_FC" # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test x = x"$MPILIBS"; then - { { $as_echo "$as_me:$LINENO: error: Cannot find any suitable MPI implementation for Fortran 77" >&5 -$as_echo "$as_me: error: Cannot find any suitable MPI implementation for Fortran 77" >&2;} + { { $as_echo "$as_me:$LINENO: error: Cannot find any suitable MPI implementation for Fortran" >&5 +$as_echo "$as_me: error: Cannot find any suitable MPI implementation for Fortran" >&2;} { (exit 1); exit 1; }; } : else @@ -5478,13 +4784,11 @@ _ACEOF : fi + FC="$MPIFC" ; -F77="$MPIF77"; CC="$MPICC"; fi - -# We leave a default language for the next checks. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -5549,8 +4853,6 @@ $as_echo "no" >&6; } fi -#PAC_ARG_WITH_FLAGS(f90copt,F90COPT) -#PAC_ARG_WITH_FLAGS(ldflags,LDFLAGS) { $as_echo "$as_me:$LINENO: checking whether additional libraries are needed" >&5 $as_echo_n "checking whether additional libraries are needed... " >&6; } @@ -5688,8 +4990,10 @@ fi ############################################################################### ############################################################################### -# PSBLAS library presence checks +# Compiler identification (sadly, it is necessary) ############################################################################### +psblas_cv_fc="" + { $as_echo "$as_me:$LINENO: checking for GNU Fortran" >&5 $as_echo_n "checking for GNU Fortran... " >&6; } @@ -5841,7 +5145,6 @@ if test x"$psblas_cv_fc" == "x" ; then elif eval "$MPIFC -v 2>&1 | grep NAG 2>/dev/null" ; then psblas_cv_fc="nag" FC="$MPIFC" - F77="$MPIFC" else psblas_cv_fc="" # unsupported MPI Fortran compiler @@ -5917,6 +5220,12 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi + +############################################################################### +# Linking, symbol mangling, and misc tests +############################################################################### + +# Note : This is functional to Make.inc rules and structure (see below). ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -6913,10 +6222,6 @@ ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_fc_compiler_gnu -if test "X$psblas_cv_fc" == X"pg" ; then - save_FC=$FC - FC=$F77 -fi { $as_echo "$as_me:$LINENO: checking for Fortran name-mangling scheme" >&5 $as_echo_n "checking for Fortran name-mangling scheme... " >&6; } if test "${ac_cv_fc_mangling+set}" = set; then @@ -7200,8 +6505,10 @@ $as_echo " $pac_f_c_names " >&6; } ############################################################################### # Make.inc generation logic ############################################################################### -F90COPT="$FCOPT" - +# Honor CFLAGS if they were specified explicitly, but --with-ccopt take precedence +if test "X$CCOPT" == "X" ; then + CCOPT="$CFLAGS"; +fi if test "X$CCOPT" == "X" ; then if test "X$psblas_cv_fc" == "Xgcc" ; then # note that no space should be placed around the equality symbol in assignements @@ -7233,6 +6540,10 @@ if test "X$CCOPT" == "X" ; then fi #CFLAGS="${CCOPT}" +# Honor FCFLAGS if they were specified explicitly, but --with-fcopt take precedence +if test "X$FCOPT" == "X" ; then + FCOPT="$FCFLAGS"; +fi if test "X$FCOPT" == "X" ; then if test "X$psblas_cv_fc" == "Xgcc" ; then # note that no space should be placed around the equality symbol in assignations @@ -7264,60 +6575,24 @@ if test "X$FCOPT" == "X" ; then fi if test "X$psblas_cv_fc" == X"nag" ; then # Add needed options - FCOPT="$FCOPT -dcfuns -f2003 -wmismatch=mpi_scatterv,mpi_alltoallv,mpi_gatherv,mpi_allgatherv" -fi -#FFLAGS="${FCOPT}" - -if test "X$F90COPT" == "X" ; then - if test "X$psblas_cv_fc" == "Xgcc" ; then - # note that no space should be placed around the equality symbol in assignations - # Note : 'native' is valid _only_ on GCC/x86 (32/64 bits) - F90COPT="-O3 $F90COPT" - elif test "X$psblas_cv_fc" == X"xlf" ; then - # XL compiler : consider using -qarch=auto - F90COPT="-O3 -qarch=auto -qsuffix=f=f90:cpp=F90 -qlanglvl=extended $F90COPT" - elif test "X$psblas_cv_fc" == X"ifc" ; then - # other compilers .. - F90COPT="-O3 $F90COPT" - elif test "X$psblas_cv_fc" == X"pg" ; then - # other compilers .. - F90COPT="-fast $F90COPT" - elif test "X$psblas_cv_fc" == X"sun" ; then - F90COPT="-fast $F90COPT" - elif test "X$psblas_cv_fc" == X"cray" ; then - MPIFC="ftn" - F90COPT="-O3 -em $F90COPT" - elif test "X$psblas_cv_fc" == X"nag" ; then - # NAG compiler - F90COPT="-O2" - else - # other compilers .. - F90COPT="-O2 $F90COPT" - fi -else - echo "Found FCFLAGS $F90COPT" - #F90COPT="${FCFLAGS}" -fi -if test "X$psblas_cv_fc" == X"nag" ; then - # Add needed options - F90COPT="$F90COPT -dcfuns -f2003 -wmismatch=mpi_scatterv,mpi_alltoallv,mpi_gatherv,mpi_allgatherv" + FCOPT="$FCOPT -dcfuns -f2003 -wmismatch=mpi_scatterv,mpi_alltoallv,mpi_gatherv,mpi_allgatherv" EXTRA_OPT="-mismatch_all" fi -#FCFLAGS="${F90COPT}" -# COPT,FCOPT, F90COPT are aliases for FFLAGS,CFLAGS,FCFLAGS . +# COPT,FCOPT are aliases for CFLAGS,FCFLAGS . ############################################################################## # Compilers variables selection ############################################################################## -F90=${FC} -MPF90=${MPIFC} FC=${FC} -MPF77=${MPIFC} CC=${CC} MPCC=${MPICC} + +############################################################################## +# Choice of our compilers, needed by Make.inc +############################################################################## if test "X$psblas_cv_fc" == X"cray" then MODEXT=".mod" @@ -7531,14 +6806,9 @@ fi # Choice of our compilers, needed by Make.inc ############################################################################## if test "X$FLINK" == "X" ; then - FLINK=${MPF77} -fi - -if test "X$F90LINK" == "X" ; then - F90LINK=${MPF90} + FLINK=${MPF90} fi - { $as_echo "$as_me:$LINENO: checking for working installation of PSBLAS" >&5 $as_echo_n "checking for working installation of PSBLAS... " >&6; } ac_ext=${ac_fc_srcext-f} @@ -7772,9 +7042,9 @@ $as_echo "$as_me: error: PSBLAS patchlevel \"$pac_cv_psblas_patchlevel\"." >&2;} { (exit 1); exit 1; }; } fi if (( $pac_cv_psblas_major < 3 )) || - ( (( $pac_cv_psblas_major == 3 )) && (( $pac_cv_psblas_minor < 4 ))) ; then - { { $as_echo "$as_me:$LINENO: error: I need at least PSBLAS version 3.4." >&5 -$as_echo "$as_me: error: I need at least PSBLAS version 3.4." >&2;} + ( (( $pac_cv_psblas_major == 3 )) && (( $pac_cv_psblas_minor < 5 ))) ; then + { { $as_echo "$as_me:$LINENO: error: I need at least PSBLAS version 3.5." >&5 +$as_echo "$as_me: error: I need at least PSBLAS version 3.5." >&2;} { (exit 1); exit 1; }; } else { $as_echo "$as_me:$LINENO: Am configuring with PSBLAS version $pac_cv_psblas_major.$pac_cv_psblas_minor.$pac_cv_psblas_patchlevel." >&5 @@ -12175,7 +11445,7 @@ fi if test "x$mld2p4_cv_superludistlibdir" != "x"; then SLUDIST_LIBS="-L$mld2p4_cv_superludistlibdir" elif test "x$mld2p4_cv_superludistdir" != "x"; then - SLUDIST_LIBS="-L$mld2p4_cv_superludir" + SLUDIST_LIBS="-L$mld2p4_cv_superludistdir" fi LIBS="$SLUDIST_LIBS $save_LIBS" @@ -12487,7 +11757,7 @@ as_val=`eval 'as_val=${'$as_ac_Header'} _ACEOF pac_sludist_header_ok=yes else - pac_sludist_header_ok=no; SLUDIST_INCLUDES="" + pac_sludist_header_ok=no; SLUDIST_INCLUDES=""; SLUDIST_LIBS=""; fi done @@ -12615,6 +11885,7 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ fi { $as_echo "$as_me:$LINENO: result: $pac_sludist_lib_ok" >&5 $as_echo "$pac_sludist_lib_ok" >&6; } + if test "x$pac_sludist_lib_ok" == "xyes" ; then { $as_echo "$as_me:$LINENO: checking for superlu_dist version 4" >&5 $as_echo_n "checking for superlu_dist version 4... " >&6; } ac_ext=c @@ -12731,8 +12002,12 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu - fi fi + else + SLUDIST_LIBS=""; + SLUDIST_INCLUDES=""; + fi + fi LIBS="$save_LIBS"; CPPFLAGS="$save_CPPFLAGS"; @@ -12765,28 +12040,21 @@ if test "x$pac_cv_status_file" != "xNONE"; then COMPILERULES=''; else COMPILERULES=' -F90LINK=$(MPF90) -FLINK=$(MPF77) +FLINK=$(MPF90) # These should be portable rules, arent they? .c.o: $(CC) $(CCOPT) $(CINCLUDES) $(CDEFINES) -c $< -o $@ -.f.o: - $(FC) $(FCOPT) $(FINCLUDES) -c $< -o $@ .f90.o: - $(F90) $(FCOPT) $(FINCLUDES) -c $< -o $@ -.F.o: - $(FC) $(FCOPT) $(FINCLUDES) $(FDEFINES) -c $< -o $@ + $(FC) $(FCOPT) $(FINCLUDES) -c $< -o $@ .F90.o: - $(F90) $(FCOPT) $(FINCLUDES) $(FDEFINES) -c $< -o $@' + $(FC) $(FCOPT) $(FINCLUDES) $(FDEFINES) -c $< -o $@' COMPILERULES=" # The following ones are the variables used by the PSBLAS make scripts. -F90=$F90 FC=$FC CC=$CC -F90COPT=$F90COPT FCOPT=$FCOPT CCOPT=$CCOPT FMFLAG=$FMFLAG @@ -12802,8 +12070,7 @@ LIBS=$LIBS BLAS=$BLAS_LIBS # These three should be always set! -MPF90=$MPF90 -MPF77=$MPF77 +MPFC=$MPFC MPCC=$MPCC AR=$AR @@ -13326,7 +12593,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by MLD2P4 $as_me 2.0, which was +This file was extended by MLD2P4 $as_me 2.1, which was generated by GNU Autoconf 2.63. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -13380,7 +12647,7 @@ Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ -MLD2P4 config.status 2.0 +MLD2P4 config.status 2.1 configured by $0, generated by GNU Autoconf 2.63, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.ac b/configure.ac index 16e8db5b..d369a078 100755 --- a/configure.ac +++ b/configure.ac @@ -34,11 +34,11 @@ dnl NOTE : odd configurations like ifc + gcc still await in the mist of the unkn ############################################################################### # NOTE: the literal for version (the second argument to AC_INIT should be a literal!) -AC_INIT([MLD2P4],2.0, bugreport@mld2p4.it) +AC_INIT([MLD2P4],2.1, bugreport@mld2p4.it) # VERSION is the file containing the PSBLAS version code # FIXME -mld2p4_cv_version="2.0" +mld2p4_cv_version="2.1" # A sample source file AC_CONFIG_SRCDIR([mlprec/mld_prec_type.f90]) @@ -119,13 +119,26 @@ case $samplesdir in esac AC_MSG_RESULT([$INSTALL_DIR $INSTALL_INCLUDEDIR $INSTALL_LIBDIR $INSTALL_DOCSDIR $INSTALL_SAMPLESDIR]) -############################################################################### -# Compilers detection: FC,F77,CC should be set, if found. -############################################################################### +dnl +dnl We set our own FC flags, ignore those from AC_PROG_FC but not those from the +dnl environment variable. Same for C +dnl +save_FCFLAGS="$FCFLAGS"; AC_PROG_FC([ftn xlf2003_r xlf2003 xlf95_r xlf95 xlf90 xlf pgf95 pgf90 ifort ifc nagfor gfortran]) -AC_PROG_CC([xlc pgcc icc gcc cc]) +FCFLAGS="$save_FCFLAGS"; +save_CFLAGS="$CFLAGS"; +AC_PROG_CC([xlc pgcc icc gcc cc ]) +CFLAGS="$save_CFLAGS"; dnl AC_PROG_CXX +dnl AC_PROG_F90 doesn't exist, at the time of writing this ! +dnl AC_PROG_F90 + +# Sanity checks, although redundant (useful when debugging this configure.ac)! +if test "X$FC" == "X" ; then + AC_MSG_ERROR([Problem : No Fortran compiler specified nor found!]) +fi + if test "X$CC" == "X" ; then AC_MSG_ERROR([Problem : No C compiler specified nor found!]) fi @@ -137,7 +150,7 @@ if eval "$FC -qversion 2>&1 | grep XL 2>/dev/null" ; then FDEFINES="$mld_cv_define_prepend-DXLF_10 $FDEFINES" fi - # Note : there coule be problems with old xlf compiler versions ( <10.1 ) + # Note : there could be problems with old xlf compiler versions ( <10.1 ) # since (as far as it is known to us) -WF, is not used in earlier versions. # More problems could be undocumented yet. fi @@ -153,7 +166,6 @@ PAC_ARG_SERIAL_MPI if test x"$pac_cv_serial_mpi" == x"yes" ; then FAKEMPI="fakempi.o"; MPIFC="$FC"; - MPIF77="$F77"; MPICC="$CC"; else AC_LANG([C]) @@ -173,23 +185,13 @@ fi ACX_MPI([], [AC_MSG_ERROR([[Cannot find any suitable MPI implementation for Fortran]])]) -AC_LANG(Fortran 77) -if test "X$MPIF77" = "X" ; then - # This is our MPIFC compiler preference: it will override ACX_MPI's first try. - AC_CHECK_PROGS([MPIF77],[mpxlf mpf77 mpif77 ftn]) -fi -ACX_MPI([], [AC_MSG_ERROR([[Cannot find any suitable MPI implementation for Fortran 77]])]) FC="$MPIFC" ; -F77="$MPIF77"; CC="$MPICC"; 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 +dnl Now on, MPIFC should be set, and MPICC ############################################################################### # Sanity checks, although redundant (useful when debugging this configure.ac)! @@ -210,8 +212,6 @@ fi dnl NOTE : no spaces before the comma, and no brackets before the second argument! PAC_ARG_WITH_FLAGS(ccopt,CCOPT) PAC_ARG_WITH_FLAGS(fcopt,FCOPT) -#PAC_ARG_WITH_FLAGS(f90copt,F90COPT) -#PAC_ARG_WITH_FLAGS(ldflags,LDFLAGS) PAC_ARG_WITH_LIBS PAC_ARG_WITH_FLAGS(clibs,CLIBS) PAC_ARG_WITH_FLAGS(flibs,FLIBS) @@ -229,8 +229,12 @@ PAC_ARG_WITH_EXTRA_LIBS ############################################################################### ############################################################################### -# PSBLAS library presence checks +# Compiler identification (sadly, it is necessary) ############################################################################### +psblas_cv_fc="" + +dnl Do we use gfortran & co ? Compiler identification. +dnl NOTE : in /autoconf/autoconf/fortran.m4 there are plenty of better tests! PAC_CHECK_HAVE_GFORTRAN( [psblas_cv_fc="gcc"], @@ -268,7 +272,6 @@ if test x"$psblas_cv_fc" == "x" ; then elif eval "$MPIFC -v 2>&1 | grep NAG 2>/dev/null" ; then psblas_cv_fc="nag" FC="$MPIFC" - F77="$MPIFC" else psblas_cv_fc="" # unsupported MPI Fortran compiler @@ -282,6 +285,12 @@ PAC_HAVE_MODERN_GFORTRAN( ) fi + +############################################################################### +# Linking, symbol mangling, and misc tests +############################################################################### + +# Note : This is functional to Make.inc rules and structure (see below). AC_LANG([C]) AC_CHECK_SIZEOF(void *) # Define for platforms with 64 bit (void * ) pointers @@ -289,10 +298,6 @@ if test X"$ac_cv_sizeof_void_p" == X"8" ; then CDEFINES="-DPtr64Bits $CDEFINES" fi AC_LANG([Fortran]) -if test "X$psblas_cv_fc" == X"pg" ; then - save_FC=$FC - FC=$F77 -fi __AC_FC_NAME_MANGLING if test "X$psblas_cv_fc" == X"pg" ; then FC=$save_FC @@ -350,8 +355,10 @@ AC_MSG_RESULT([ $pac_f_c_names ]) ############################################################################### # Make.inc generation logic ############################################################################### -F90COPT="$FCOPT" - +# Honor CFLAGS if they were specified explicitly, but --with-ccopt take precedence +if test "X$CCOPT" == "X" ; then + CCOPT="$CFLAGS"; +fi if test "X$CCOPT" == "X" ; then if test "X$psblas_cv_fc" == "Xgcc" ; then # note that no space should be placed around the equality symbol in assignements @@ -383,6 +390,10 @@ if test "X$CCOPT" == "X" ; then fi #CFLAGS="${CCOPT}" +# Honor FCFLAGS if they were specified explicitly, but --with-fcopt take precedence +if test "X$FCOPT" == "X" ; then + FCOPT="$FCFLAGS"; +fi if test "X$FCOPT" == "X" ; then if test "X$psblas_cv_fc" == "Xgcc" ; then # note that no space should be placed around the equality symbol in assignations @@ -414,60 +425,24 @@ if test "X$FCOPT" == "X" ; then fi if test "X$psblas_cv_fc" == X"nag" ; then # Add needed options - FCOPT="$FCOPT -dcfuns -f2003 -wmismatch=mpi_scatterv,mpi_alltoallv,mpi_gatherv,mpi_allgatherv" -fi -#FFLAGS="${FCOPT}" - -if test "X$F90COPT" == "X" ; then - if test "X$psblas_cv_fc" == "Xgcc" ; then - # note that no space should be placed around the equality symbol in assignations - # Note : 'native' is valid _only_ on GCC/x86 (32/64 bits) - F90COPT="-O3 $F90COPT" - elif test "X$psblas_cv_fc" == X"xlf" ; then - # XL compiler : consider using -qarch=auto - F90COPT="-O3 -qarch=auto -qsuffix=f=f90:cpp=F90 -qlanglvl=extended $F90COPT" - elif test "X$psblas_cv_fc" == X"ifc" ; then - # other compilers .. - F90COPT="-O3 $F90COPT" - elif test "X$psblas_cv_fc" == X"pg" ; then - # other compilers .. - F90COPT="-fast $F90COPT" - elif test "X$psblas_cv_fc" == X"sun" ; then - F90COPT="-fast $F90COPT" - elif test "X$psblas_cv_fc" == X"cray" ; then - MPIFC="ftn" - F90COPT="-O3 -em $F90COPT" - elif test "X$psblas_cv_fc" == X"nag" ; then - # NAG compiler - F90COPT="-O2" - else - # other compilers .. - F90COPT="-O2 $F90COPT" - fi -else - echo "Found FCFLAGS $F90COPT" - #F90COPT="${FCFLAGS}" -fi -if test "X$psblas_cv_fc" == X"nag" ; then - # Add needed options - F90COPT="$F90COPT -dcfuns -f2003 -wmismatch=mpi_scatterv,mpi_alltoallv,mpi_gatherv,mpi_allgatherv" + FCOPT="$FCOPT -dcfuns -f2003 -wmismatch=mpi_scatterv,mpi_alltoallv,mpi_gatherv,mpi_allgatherv" EXTRA_OPT="-mismatch_all" fi -#FCFLAGS="${F90COPT}" -# COPT,FCOPT, F90COPT are aliases for FFLAGS,CFLAGS,FCFLAGS . +# COPT,FCOPT are aliases for CFLAGS,FCFLAGS . ############################################################################## # Compilers variables selection ############################################################################## -F90=${FC} -MPF90=${MPIFC} FC=${FC} -MPF77=${MPIFC} CC=${CC} MPCC=${MPICC} + +############################################################################## +# Choice of our compilers, needed by Make.inc +############################################################################## if test "X$psblas_cv_fc" == X"cray" then MODEXT=".mod" @@ -495,14 +470,9 @@ fi # Choice of our compilers, needed by Make.inc ############################################################################## if test "X$FLINK" == "X" ; then - FLINK=${MPF77} -fi - -if test "X$F90LINK" == "X" ; then - F90LINK=${MPF90} + FLINK=${MPF90} fi - PAC_FORTRAN_HAVE_PSBLAS([AC_MSG_RESULT([yes.])], [AC_MSG_ERROR([no. Could not find working version of PSBLAS.])]) @@ -518,8 +488,8 @@ if test "x$pac_cv_psblas_patchlevel" == "xunknown"; then AC_MSG_ERROR([PSBLAS patchlevel "$pac_cv_psblas_patchlevel".]) fi if (( $pac_cv_psblas_major < 3 )) || - ( (( $pac_cv_psblas_major == 3 )) && (( $pac_cv_psblas_minor < 4 ))) ; then - AC_MSG_ERROR([I need at least PSBLAS version 3.4.]) + ( (( $pac_cv_psblas_major == 3 )) && (( $pac_cv_psblas_minor < 5 ))) ; then + AC_MSG_ERROR([I need at least PSBLAS version 3.5.]) else AC_MSG_NOTICE([Am configuring with PSBLAS version $pac_cv_psblas_major.$pac_cv_psblas_minor.$pac_cv_psblas_patchlevel.]) fi @@ -702,28 +672,21 @@ if test "x$pac_cv_status_file" != "xNONE"; then COMPILERULES=''; else COMPILERULES=' -F90LINK=$(MPF90) -FLINK=$(MPF77) +FLINK=$(MPF90) # These should be portable rules, arent they? .c.o: $(CC) $(CCOPT) $(CINCLUDES) $(CDEFINES) -c $< -o $@ -.f.o: - $(FC) $(FCOPT) $(FINCLUDES) -c $< -o $@ .f90.o: - $(F90) $(FCOPT) $(FINCLUDES) -c $< -o $@ -.F.o: - $(FC) $(FCOPT) $(FINCLUDES) $(FDEFINES) -c $< -o $@ + $(FC) $(FCOPT) $(FINCLUDES) -c $< -o $@ .F90.o: - $(F90) $(FCOPT) $(FINCLUDES) $(FDEFINES) -c $< -o $@' + $(FC) $(FCOPT) $(FINCLUDES) $(FDEFINES) -c $< -o $@' COMPILERULES=" # The following ones are the variables used by the PSBLAS make scripts. -F90=$F90 FC=$FC CC=$CC -F90COPT=$F90COPT FCOPT=$FCOPT CCOPT=$CCOPT FMFLAG=$FMFLAG @@ -739,8 +702,7 @@ LIBS=$LIBS BLAS=$BLAS_LIBS # These three should be always set! -MPF90=$MPF90 -MPF77=$MPF77 +MPFC=$MPFC MPCC=$MPCC AR=$AR diff --git a/examples/fileread/Makefile b/examples/fileread/Makefile index a822a1f4..e847a66f 100644 --- a/examples/fileread/Makefile +++ b/examples/fileread/Makefile @@ -20,12 +20,12 @@ all: mld_dexample_ml mld_dexample_1lev mld_zexample_ml mld_zexample_1lev\ mld_sexample_ml mld_sexample_1lev mld_cexample_ml mld_cexample_1lev mld_dexample_ml: $(DMOBJS) - $(F90LINK) $(LINKOPT) $(DMOBJS) -o mld_dexample_ml \ + $(FLINK) $(LINKOPT) $(DMOBJS) -o mld_dexample_ml \ $(MLD_LIBS) $(PSBLAS_LIBS) $(LDLIBS) /bin/mv mld_dexample_ml $(EXEDIR) mld_dexample_1lev: $(D1OBJS) - $(F90LINK) $(LINKOPT) $(D1OBJS) -o mld_dexample_1lev \ + $(FLINK) $(LINKOPT) $(D1OBJS) -o mld_dexample_1lev \ $(MLD_LIBS) $(PSBLAS_LIBS) $(LDLIBS) /bin/mv mld_dexample_1lev $(EXEDIR) @@ -33,12 +33,12 @@ mld_dexample_ml.o: data_input.o mld_dexample_1lev.o: data_input.o mld_zexample_ml: $(ZMOBJS) - $(F90LINK) $(LINKOPT) $(ZMOBJS) -o mld_zexample_ml \ + $(FLINK) $(LINKOPT) $(ZMOBJS) -o mld_zexample_ml \ $(MLD_LIBS) $(PSBLAS_LIBS) $(LDLIBS) /bin/mv mld_zexample_ml $(EXEDIR) mld_zexample_1lev: $(Z1OBJS) - $(F90LINK) $(LINKOPT) $(Z1OBJS) -o mld_zexample_1lev \ + $(FLINK) $(LINKOPT) $(Z1OBJS) -o mld_zexample_1lev \ $(MLD_LIBS) $(PSBLAS_LIBS) $(LDLIBS) /bin/mv mld_zexample_1lev $(EXEDIR) @@ -48,12 +48,12 @@ mld_zexample_1lev.o: data_input.o mld_sexample_ml: $(SMOBJS) - $(F90LINK) $(LINKOPT) $(SMOBJS) -o mld_sexample_ml \ + $(FLINK) $(LINKOPT) $(SMOBJS) -o mld_sexample_ml \ $(MLD_LIBS) $(PSBLAS_LIBS) $(LDLIBS) /bin/mv mld_sexample_ml $(EXEDIR) mld_sexample_1lev: $(S1OBJS) - $(F90LINK) $(LINKOPT) $(S1OBJS) -o mld_sexample_1lev \ + $(FLINK) $(LINKOPT) $(S1OBJS) -o mld_sexample_1lev \ $(MLD_LIBS) $(PSBLAS_LIBS) $(LDLIBS) /bin/mv mld_sexample_1lev $(EXEDIR) @@ -61,12 +61,12 @@ mld_sexample_ml.o: data_input.o mld_sexample_1lev.o: data_input.o mld_cexample_ml: $(CMOBJS) - $(F90LINK) $(LINKOPT) $(CMOBJS) -o mld_cexample_ml \ + $(FLINK) $(LINKOPT) $(CMOBJS) -o mld_cexample_ml \ $(MLD_LIBS) $(PSBLAS_LIBS) $(LDLIBS) /bin/mv mld_cexample_ml $(EXEDIR) mld_cexample_1lev: $(C1OBJS) - $(F90LINK) $(LINKOPT) $(C1OBJS) -o mld_cexample_1lev \ + $(FLINK) $(LINKOPT) $(C1OBJS) -o mld_cexample_1lev \ $(MLD_LIBS) $(PSBLAS_LIBS) $(LDLIBS) /bin/mv mld_cexample_1lev $(EXEDIR) @@ -74,9 +74,6 @@ mld_cexample_ml.o: data_input.o mld_cexample_1lev.o: data_input.o -.f90.o: - $(MPF90) $(F90COPT) $(FINCLUDES) -c $< - clean: /bin/rm -f *$(.mod) \ $(DMOBJS) $(D1OBJS) $(ZMOBJS) $(Z1OBJS) \ diff --git a/examples/pdegen/Makefile b/examples/pdegen/Makefile index 8268d8ea..050f077a 100644 --- a/examples/pdegen/Makefile +++ b/examples/pdegen/Makefile @@ -16,12 +16,12 @@ all: mld_sexample_ml mld_sexample_1lev mld_dexample_ml mld_dexample_1lev mld_dexample_ml: $(DMOBJS) - $(F90LINK) $(LINKOPT) $(DMOBJS) -o mld_dexample_ml \ + $(FLINK) $(LINKOPT) $(DMOBJS) -o mld_dexample_ml \ $(MLD_LIBS) $(PSBLAS_LIBS) $(LDLIBS) /bin/mv mld_dexample_ml $(EXEDIR) mld_dexample_1lev: $(D1OBJS) - $(F90LINK) $(LINKOPT) $(D1OBJS) -o mld_dexample_1lev \ + $(FLINK) $(LINKOPT) $(D1OBJS) -o mld_dexample_1lev \ $(MLD_LIBS) $(PSBLAS_LIBS) $(LDLIBS) /bin/mv mld_dexample_1lev $(EXEDIR) @@ -29,21 +29,18 @@ mld_dexample_ml.o: data_input.o mld_dexample_1lev.o: data_input.o mld_sexample_ml: $(SMOBJS) - $(F90LINK) $(LINKOPT) $(SMOBJS) -o mld_sexample_ml \ + $(FLINK) $(LINKOPT) $(SMOBJS) -o mld_sexample_ml \ $(MLD_LIBS) $(PSBLAS_LIBS) $(LDLIBS) /bin/mv mld_sexample_ml $(EXEDIR) mld_sexample_1lev: $(S1OBJS) - $(F90LINK) $(LINKOPT) $(S1OBJS) -o mld_sexample_1lev \ + $(FLINK) $(LINKOPT) $(S1OBJS) -o mld_sexample_1lev \ $(MLD_LIBS) $(PSBLAS_LIBS) $(LDLIBS) /bin/mv mld_sexample_1lev $(EXEDIR) mld_sexample_ml.o: data_input.o mld_sexample_1lev.o: data_input.o -.f90.o: - $(MPF90) $(F90COPT) $(FINCLUDES) -c $< - clean: /bin/rm -f $(DMOBJS) $(D1OBJS) $(SMOBJS) $(S1OBJS) \ *$(.mod) $(EXEDIR)/mld_dexample_ml $(EXEDIR)/mld_dexample_1lev\ diff --git a/mlprec/impl/Makefile b/mlprec/impl/Makefile index d3033ec0..2f90244e 100644 --- a/mlprec/impl/Makefile +++ b/mlprec/impl/Makefile @@ -82,7 +82,7 @@ solvd: cd solver && $(MAKE) mpobjs: - (make $(MPFOBJS) F90="$(MPF90)" F90COPT="$(F90COPT)") + (make $(MPFOBJS) FC="$(MPFC)" FCOPT="$(FCOPT)") (make $(MPCOBJS) CC="$(MPCC)" CCOPT="$(CCOPT)") veryclean: clean diff --git a/mlprec/impl/level/Makefile b/mlprec/impl/level/Makefile index dbbfae8f..22139218 100644 --- a/mlprec/impl/level/Makefile +++ b/mlprec/impl/level/Makefile @@ -71,7 +71,7 @@ lib: $(OBJS) $(RANLIB) $(HERE)/$(LIBNAME) mpobjs: - (make $(MPFOBJS) F90="$(MPF90)" F90COPT="$(F90COPT)") + (make $(MPFOBJS) FC="$(MPFC)" FCOPT="$(FCOPT)") (make $(MPCOBJS) CC="$(MPCC)" CCOPT="$(CCOPT)") veryclean: clean diff --git a/mlprec/impl/mld_c_dec_map_bld.f90 b/mlprec/impl/mld_c_dec_map_bld.f90 index b1ac029f..310705ee 100644 --- a/mlprec/impl/mld_c_dec_map_bld.f90 +++ b/mlprec/impl/mld_c_dec_map_bld.f90 @@ -72,6 +72,7 @@ subroutine mld_c_dec_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info) use psb_base_mod + use mld_base_prec_type use mld_c_inner_mod, mld_protect_name => mld_c_dec_map_bld implicit none diff --git a/mlprec/impl/mld_c_hierarchy_bld.f90 b/mlprec/impl/mld_c_hierarchy_bld.f90 index ac326003..eb5f9e74 100644 --- a/mlprec/impl/mld_c_hierarchy_bld.f90 +++ b/mlprec/impl/mld_c_hierarchy_bld.f90 @@ -65,7 +65,7 @@ ! info - integer, output. ! Error code. ! -subroutine mld_c_hierarchy_bld(a,desc_a,p,info) +subroutine mld_c_hierarchy_bld(a,desc_a,prec,info) use psb_base_mod use mld_c_inner_mod @@ -76,7 +76,7 @@ subroutine mld_c_hierarchy_bld(a,desc_a,p,info) ! Arguments type(psb_cspmat_type),intent(in), target :: a type(psb_desc_type), intent(inout), target :: desc_a - type(mld_cprec_type),intent(inout),target :: p + class(mld_cprec_type),intent(inout),target :: prec integer(psb_ipk_), intent(out) :: info !!$ character, intent(in), optional :: upd @@ -106,7 +106,7 @@ subroutine mld_c_hierarchy_bld(a,desc_a,p,info) int_err(1) = 0 ictxt = desc_a%get_context() call psb_info(ictxt, me, np) - p%ictxt = ictxt + prec%ictxt = ictxt if (debug_level >= psb_debug_outer_) & & write(debug_unit,*) me,' ',trim(name),& & 'Entering ' @@ -127,7 +127,7 @@ subroutine mld_c_hierarchy_bld(a,desc_a,p,info) ! !$ endif upd_ = 'F' - if (.not.allocated(p%precv)) then + if (.not.allocated(prec%precv)) then !! Error: should have called mld_cprecinit info=3111 call psb_errpush(info,name) @@ -138,31 +138,31 @@ subroutine mld_c_hierarchy_bld(a,desc_a,p,info) ! Check to ensure all procs have the same ! newsz = -1 - casize = p%coarse_aggr_size - mxplevs = p%max_prec_levs - mnaggratio = p%min_aggr_ratio - casize = p%coarse_aggr_size - iszv = size(p%precv) + casize = prec%coarse_aggr_size + mxplevs = prec%max_prec_levs + mnaggratio = prec%min_aggr_ratio + casize = prec%coarse_aggr_size + iszv = size(prec%precv) call psb_bcast(ictxt,iszv) call psb_bcast(ictxt,casize) call psb_bcast(ictxt,mxplevs) call psb_bcast(ictxt,mnaggratio) - if (casize /= p%coarse_aggr_size) then + if (casize /= prec%coarse_aggr_size) then info=psb_err_internal_error_ call psb_errpush(info,name,a_err='Inconsistent coarse_aggr_size') goto 9999 end if - if (mxplevs /= p%max_prec_levs) then + if (mxplevs /= prec%max_prec_levs) then info=psb_err_internal_error_ call psb_errpush(info,name,a_err='Inconsistent max_prec_levs') goto 9999 end if - if (mnaggratio /= p%min_aggr_ratio) then + if (mnaggratio /= prec%min_aggr_ratio) then info=psb_err_internal_error_ call psb_errpush(info,name,a_err='Inconsistent min_aggr_ratio') goto 9999 end if - if (iszv /= size(p%precv)) then + if (iszv /= size(prec%precv)) then info=psb_err_internal_error_ call psb_errpush(info,name,a_err='Inconsistent size of precv') goto 9999 @@ -182,8 +182,8 @@ subroutine mld_c_hierarchy_bld(a,desc_a,p,info) ! This is OK, since it may be called by the user even if there ! is only one level ! - p%precv(1)%base_a => a - p%precv(1)%base_desc => desc_a + prec%precv(1)%base_a => a + prec%precv(1)%base_desc => desc_a call psb_erractionrestore(err_act) return @@ -213,13 +213,13 @@ subroutine mld_c_hierarchy_bld(a,desc_a,p,info) end if nplevs = max(itwo,mxplevs) - coarseparms = p%precv(iszv)%parms - baseparms = p%precv(1)%parms - medparms = p%precv(2)%parms + coarseparms = prec%precv(iszv)%parms + baseparms = prec%precv(1)%parms + medparms = prec%precv(2)%parms - call save_smoothers(p%precv(iszv),coarse_sm,coarse_sm2,info) - if (info == 0) call save_smoothers(p%precv(2),med_sm,med_sm2,info) - if (info == 0) call save_smoothers(p%precv(1),base_sm,base_sm2,info) + call save_smoothers(prec%precv(iszv),coarse_sm,coarse_sm2,info) + if (info == 0) call save_smoothers(prec%precv(2),med_sm,med_sm2,info) + if (info == 0) call save_smoothers(prec%precv(1),base_sm,base_sm2,info) if (info /= psb_success_) then write(0,*) 'Error in saving smoothers',info call psb_errpush(psb_err_internal_error_,name,a_err='Base level precbuild.') @@ -232,10 +232,10 @@ subroutine mld_c_hierarchy_bld(a,desc_a,p,info) allocate(tprecv(nplevs),stat=info) ! First all existing levels if (info == 0) tprecv(1)%parms = baseparms - if (info == 0) call restore_smoothers(tprecv(1),p%precv(1)%sm,p%precv(1)%sm2a,info) + if (info == 0) call restore_smoothers(tprecv(1),prec%precv(1)%sm,prec%precv(1)%sm2a,info) do i=2, min(iszv,nplevs) - 1 if (info == 0) tprecv(i)%parms = medparms - if (info == 0) call restore_smoothers(tprecv(i),p%precv(i)%sm,p%precv(i)%sm2a,info) + if (info == 0) call restore_smoothers(tprecv(i),prec%precv(i)%sm,prec%precv(i)%sm2a,info) end do ! Further intermediates, if any do i=iszv-1, nplevs - 1 @@ -252,24 +252,24 @@ subroutine mld_c_hierarchy_bld(a,desc_a,p,info) endif do i=1,iszv - call p%precv(i)%free(info) + call prec%precv(i)%free(info) end do - call move_alloc(tprecv,p%precv) - iszv = size(p%precv) + call move_alloc(tprecv,prec%precv) + iszv = size(prec%precv) end if ! ! Finest level first; remember to fix base_a and base_desc ! - p%precv(1)%base_a => a - p%precv(1)%base_desc => desc_a + prec%precv(1)%base_a => a + prec%precv(1)%base_desc => desc_a newsz = 0 array_build_loop: do i=2, iszv ! ! Check on the iprcparm contents: they should be the same ! on all processes. ! - call psb_bcast(ictxt,p%precv(i)%parms) + call psb_bcast(ictxt,prec%precv(i)%parms) ! ! Sanity checks on the parameters @@ -278,7 +278,7 @@ subroutine mld_c_hierarchy_bld(a,desc_a,p,info) ! ! A replicated matrix only makes sense at the coarsest level ! - call mld_check_def(p%precv(i)%parms%coarse_mat,'Coarse matrix',& + call mld_check_def(prec%precv(i)%parms%coarse_mat,'Coarse matrix',& & mld_distr_mat_,is_distr_ml_coarse_mat) end if @@ -289,8 +289,8 @@ subroutine mld_c_hierarchy_bld(a,desc_a,p,info) ! Build the mapping between levels i-1 and i and the matrix ! at level i ! - if (info == psb_success_) call mld_aggrmap_bld(p%precv(i),& - & p%precv(i-1)%base_a,p%precv(i-1)%base_desc,& + if (info == psb_success_) call mld_aggrmap_bld(prec%precv(i),& + & prec%precv(i-1)%base_a,prec%precv(i-1)%base_desc,& & ilaggr,nlaggr,op_prol,info) if (info /= psb_success_) then @@ -305,7 +305,7 @@ subroutine mld_c_hierarchy_bld(a,desc_a,p,info) ! ! Save op_prol just in case ! - call op_prol%clone(p%precv(i)%tprol,info) + call op_prol%clone(prec%precv(i)%tprol,info) ! ! Check for early termination of aggregation loop. ! @@ -315,9 +315,9 @@ subroutine mld_c_hierarchy_bld(a,desc_a,p,info) if (i==2) then sizeratio = desc_a%get_global_rows()/sizeratio else - sizeratio = sum(p%precv(i-1)%map%naggr)/sizeratio + sizeratio = sum(prec%precv(i-1)%map%naggr)/sizeratio end if - p%precv(i)%szratio = sizeratio + prec%precv(i)%szratio = sizeratio if (iaggsize <= casize) then newsz = i end if @@ -334,7 +334,7 @@ subroutine mld_c_hierarchy_bld(a,desc_a,p,info) end if end if - if (all(nlaggr == p%precv(i-1)%map%naggr)) then + if (all(nlaggr == prec%precv(i-1)%map%naggr)) then newsz=i-1 if (me == 0) then write(debug_unit,*) trim(name),& @@ -356,27 +356,27 @@ subroutine mld_c_hierarchy_bld(a,desc_a,p,info) ! This is awkward, we are saving the aggregation parms, for the sake ! of distr/repl matrix at coarse level. Should be rethought. ! - athresh = p%precv(newsz)%parms%aggr_thresh - ascale = p%precv(newsz)%parms%aggr_scale - aomega = p%precv(newsz)%parms%aggr_omega_val - if (info == 0) p%precv(newsz)%parms = coarseparms - p%precv(newsz)%parms%aggr_thresh = athresh - p%precv(newsz)%parms%aggr_scale = ascale - p%precv(newsz)%parms%aggr_omega_val = aomega + athresh = prec%precv(newsz)%parms%aggr_thresh + ascale = prec%precv(newsz)%parms%aggr_scale + aomega = prec%precv(newsz)%parms%aggr_omega_val + if (info == 0) prec%precv(newsz)%parms = coarseparms + prec%precv(newsz)%parms%aggr_thresh = athresh + prec%precv(newsz)%parms%aggr_scale = ascale + prec%precv(newsz)%parms%aggr_omega_val = aomega - if (info == 0) call restore_smoothers(p%precv(newsz),coarse_sm,coarse_sm2,info) + if (info == 0) call restore_smoothers(prec%precv(newsz),coarse_sm,coarse_sm2,info) if (newsz < i) then ! ! We are going back and revisit a previous leve; ! recover the aggregation. ! - ilaggr = p%precv(newsz)%map%iaggr - nlaggr = p%precv(newsz)%map%naggr - call p%precv(newsz)%tprol%clone(op_prol,info) + ilaggr = prec%precv(newsz)%map%iaggr + nlaggr = prec%precv(newsz)%map%naggr + call prec%precv(newsz)%tprol%clone(op_prol,info) end if - if (info == psb_success_) call mld_lev_mat_asb(p%precv(newsz),& - & p%precv(newsz-1)%base_a,p%precv(newsz-1)%base_desc,& + if (info == psb_success_) call mld_lev_mat_asb(prec%precv(newsz),& + & prec%precv(newsz-1)%base_a,prec%precv(newsz-1)%base_desc,& & ilaggr,nlaggr,op_prol,info) if (info /= 0) then call psb_errpush(psb_err_internal_error_,name,& @@ -385,8 +385,8 @@ subroutine mld_c_hierarchy_bld(a,desc_a,p,info) endif exit array_build_loop else - if (info == psb_success_) call mld_lev_mat_asb(p%precv(i),& - & p%precv(i-1)%base_a,p%precv(i-1)%base_desc,& + if (info == psb_success_) call mld_lev_mat_asb(prec%precv(i),& + & prec%precv(i-1)%base_a,prec%precv(i-1)%base_desc,& & ilaggr,nlaggr,op_prol,info) end if if (info /= psb_success_) then @@ -409,12 +409,12 @@ subroutine mld_c_hierarchy_bld(a,desc_a,p,info) goto 9999 endif do i=1,newsz - call p%precv(i)%move_alloc(tprecv(i),info) + call prec%precv(i)%move_alloc(tprecv(i),info) end do do i=newsz+1, iszv - call p%precv(i)%free(info) + call prec%precv(i)%free(info) end do - call move_alloc(tprecv,p%precv) + call move_alloc(tprecv,prec%precv) ! Ignore errors from transfer info = psb_success_ ! @@ -423,10 +423,10 @@ subroutine mld_c_hierarchy_bld(a,desc_a,p,info) ! Fix the pointers, but the level 1 should ! be already OK do i=2, iszv - p%precv(i)%base_a => p%precv(i)%ac - p%precv(i)%base_desc => p%precv(i)%desc_ac - p%precv(i)%map%p_desc_X => p%precv(i-1)%base_desc - p%precv(i)%map%p_desc_Y => p%precv(i)%base_desc + prec%precv(i)%base_a => prec%precv(i)%ac + prec%precv(i)%base_desc => prec%precv(i)%desc_ac + prec%precv(i)%map%p_desc_X => prec%precv(i-1)%base_desc + prec%precv(i)%map%p_desc_Y => prec%precv(i)%base_desc end do end if @@ -436,9 +436,9 @@ subroutine mld_c_hierarchy_bld(a,desc_a,p,info) goto 9999 endif - iszv = size(p%precv) + iszv = size(prec%precv) - call p%cmp_complexity() + call prec%cmp_complexity() if (debug_level >= psb_debug_outer_) & & write(debug_unit,*) me,' ',trim(name),& diff --git a/mlprec/impl/mld_c_lev_aggrmap_bld.f90 b/mlprec/impl/mld_c_lev_aggrmap_bld.f90 index 84b338df..8a2d3646 100644 --- a/mlprec/impl/mld_c_lev_aggrmap_bld.f90 +++ b/mlprec/impl/mld_c_lev_aggrmap_bld.f90 @@ -1,3 +1,4 @@ + ! ! ! MLD2P4 version 2.1 @@ -77,6 +78,7 @@ subroutine mld_c_lev_aggrmap_bld(p,a,desc_a,ilaggr,nlaggr,op_prol,info) use psb_base_mod + use mld_base_prec_type use mld_c_inner_mod, mld_protect_name => mld_c_lev_aggrmap_bld implicit none diff --git a/mlprec/impl/mld_c_lev_aggrmat_asb.f90 b/mlprec/impl/mld_c_lev_aggrmat_asb.f90 index 0d8d9695..ed95d473 100644 --- a/mlprec/impl/mld_c_lev_aggrmat_asb.f90 +++ b/mlprec/impl/mld_c_lev_aggrmat_asb.f90 @@ -88,6 +88,7 @@ subroutine mld_c_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info) use psb_base_mod + use mld_base_prec_type use mld_c_inner_mod, mld_protect_name => mld_c_lev_aggrmat_asb implicit none diff --git a/mlprec/impl/mld_c_smoothers_bld.f90 b/mlprec/impl/mld_c_smoothers_bld.f90 index 7ad8177a..1b132c1f 100644 --- a/mlprec/impl/mld_c_smoothers_bld.f90 +++ b/mlprec/impl/mld_c_smoothers_bld.f90 @@ -79,10 +79,10 @@ ! ! ! -subroutine mld_c_smoothers_bld(a,desc_a,p,info,amold,vmold,imold) +subroutine mld_c_smoothers_bld(a,desc_a,prec,info,amold,vmold,imold) use psb_base_mod - use mld_c_inner_mod + !use mld_c_inner_mod use mld_c_prec_mod, mld_protect_name => mld_c_smoothers_bld Implicit None @@ -90,7 +90,7 @@ subroutine mld_c_smoothers_bld(a,desc_a,p,info,amold,vmold,imold) ! Arguments type(psb_cspmat_type),intent(in), target :: a type(psb_desc_type), intent(inout), target :: desc_a - type(mld_cprec_type),intent(inout),target :: p + class(mld_cprec_type),intent(inout),target :: prec integer(psb_ipk_), intent(out) :: info class(psb_c_base_sparse_mat), intent(in), optional :: amold class(psb_c_base_vect_type), intent(in), optional :: vmold @@ -140,7 +140,7 @@ subroutine mld_c_smoothers_bld(a,desc_a,p,info,amold,vmold,imold) ! !$ endif upd_ = 'F' - if (.not.allocated(p%precv)) then + if (.not.allocated(prec%precv)) then !! Error: should have called mld_cprecinit info=3111 call psb_errpush(info,name) @@ -150,9 +150,9 @@ subroutine mld_c_smoothers_bld(a,desc_a,p,info,amold,vmold,imold) ! ! Check to ensure all procs have the same ! - iszv = size(p%precv) + iszv = size(prec%precv) call psb_bcast(ictxt,iszv) - if (iszv /= size(p%precv)) then + if (iszv /= size(prec%precv)) then info=psb_err_internal_error_ call psb_errpush(info,name,a_err='Inconsistent size of precv') goto 9999 @@ -174,7 +174,7 @@ subroutine mld_c_smoothers_bld(a,desc_a,p,info,amold,vmold,imold) ! ! build the base preconditioner at level i ! - call p%precv(i)%bld(info,amold=amold,vmold=vmold,imold=imold) + call prec%precv(i)%bld(info,amold=amold,vmold=vmold,imold=imold) if (info /= psb_success_) then write(ch_err,'(a,i7)') 'Error @ level',i diff --git a/mlprec/impl/mld_caggrmap_bld.f90 b/mlprec/impl/mld_caggrmap_bld.f90 index 83706616..eee39792 100644 --- a/mlprec/impl/mld_caggrmap_bld.f90 +++ b/mlprec/impl/mld_caggrmap_bld.f90 @@ -88,6 +88,7 @@ subroutine mld_caggrmap_bld(aggr_type,iorder,theta,a,desc_a,ilaggr,nlaggr,op_prol,info) use psb_base_mod + use mld_base_prec_type use mld_c_inner_mod, mld_protect_name => mld_caggrmap_bld implicit none diff --git a/mlprec/impl/mld_caggrmat_asb.f90 b/mlprec/impl/mld_caggrmat_asb.f90 index ed877642..eb186ce4 100644 --- a/mlprec/impl/mld_caggrmat_asb.f90 +++ b/mlprec/impl/mld_caggrmat_asb.f90 @@ -120,6 +120,7 @@ subroutine mld_caggrmat_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info) use psb_base_mod + use mld_base_prec_type use mld_c_inner_mod, mld_protect_name => mld_caggrmat_asb implicit none diff --git a/mlprec/impl/mld_caggrmat_biz_asb.f90 b/mlprec/impl/mld_caggrmat_biz_asb.f90 index 88b4c093..dcd202a1 100644 --- a/mlprec/impl/mld_caggrmat_biz_asb.f90 +++ b/mlprec/impl/mld_caggrmat_biz_asb.f90 @@ -84,6 +84,7 @@ ! subroutine mld_caggrmat_biz_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info) use psb_base_mod + use mld_base_prec_type use mld_c_inner_mod, mld_protect_name => mld_caggrmat_biz_asb implicit none diff --git a/mlprec/impl/mld_caggrmat_minnrg_asb.f90 b/mlprec/impl/mld_caggrmat_minnrg_asb.f90 index a9a8c246..c545404c 100644 --- a/mlprec/impl/mld_caggrmat_minnrg_asb.f90 +++ b/mlprec/impl/mld_caggrmat_minnrg_asb.f90 @@ -112,6 +112,7 @@ ! subroutine mld_caggrmat_minnrg_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info) use psb_base_mod + use mld_base_prec_type use mld_c_inner_mod, mld_protect_name => mld_caggrmat_minnrg_asb implicit none diff --git a/mlprec/impl/mld_caggrmat_nosmth_asb.f90 b/mlprec/impl/mld_caggrmat_nosmth_asb.f90 index 64c0eff2..33dd91c2 100644 --- a/mlprec/impl/mld_caggrmat_nosmth_asb.f90 +++ b/mlprec/impl/mld_caggrmat_nosmth_asb.f90 @@ -100,6 +100,7 @@ ! subroutine mld_caggrmat_nosmth_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info) use psb_base_mod + use mld_base_prec_type use mld_c_inner_mod, mld_protect_name => mld_caggrmat_nosmth_asb implicit none diff --git a/mlprec/impl/mld_caggrmat_smth_asb.f90 b/mlprec/impl/mld_caggrmat_smth_asb.f90 index 71dcd24b..55992069 100644 --- a/mlprec/impl/mld_caggrmat_smth_asb.f90 +++ b/mlprec/impl/mld_caggrmat_smth_asb.f90 @@ -113,6 +113,7 @@ ! subroutine mld_caggrmat_smth_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info) use psb_base_mod + use mld_base_prec_type use mld_c_inner_mod, mld_protect_name => mld_caggrmat_smth_asb implicit none diff --git a/mlprec/impl/mld_cmlprec_aply.f90 b/mlprec/impl/mld_cmlprec_aply.f90 index 6ecca865..cfc66694 100644 --- a/mlprec/impl/mld_cmlprec_aply.f90 +++ b/mlprec/impl/mld_cmlprec_aply.f90 @@ -299,6 +299,7 @@ subroutine mld_cmlprec_aply_vect(alpha,p,x,beta,y,desc_data,trans,work,info) use psb_base_mod + use mld_base_prec_type use mld_c_inner_mod, mld_protect_name => mld_cmlprec_aply_vect implicit none @@ -1303,6 +1304,7 @@ end subroutine mld_cmlprec_aply_vect subroutine mld_cmlprec_aply(alpha,p,x,beta,y,desc_data,trans,work,info) use psb_base_mod + use mld_base_prec_type use mld_c_inner_mod, mld_protect_name => mld_cmlprec_aply implicit none diff --git a/mlprec/impl/mld_cmlprec_bld.f90 b/mlprec/impl/mld_cmlprec_bld.f90 index 53948174..d5964b29 100644 --- a/mlprec/impl/mld_cmlprec_bld.f90 +++ b/mlprec/impl/mld_cmlprec_bld.f90 @@ -123,7 +123,7 @@ subroutine mld_cmlprec_bld(a,desc_a,p,info,amold,vmold,imold) & write(debug_unit,*) me,' ',trim(name),& & 'Entering ' - call mld_c_hierarchy_bld(a,desc_a,p,info) + call p%hierarchy_build(a,desc_a,info) if (info /= psb_success_) then info=psb_err_internal_error_ @@ -133,7 +133,7 @@ subroutine mld_cmlprec_bld(a,desc_a,p,info,amold,vmold,imold) iszv = p%get_nlevs() - call mld_c_smoothers_bld(a,desc_a,p,info,amold,vmold,imold) + call p%smoothers_build(a,desc_a,info,amold,vmold,imold) if (info /= psb_success_) then info=psb_err_internal_error_ diff --git a/mlprec/impl/mld_cprecaply.f90 b/mlprec/impl/mld_cprecaply.f90 index 1e249ec0..a0da9b29 100644 --- a/mlprec/impl/mld_cprecaply.f90 +++ b/mlprec/impl/mld_cprecaply.f90 @@ -75,7 +75,7 @@ subroutine mld_cprecaply(prec,x,y,desc_data,info,trans,work) use psb_base_mod - use mld_c_inner_mod, mld_protect_name => mld_cprecaply + use mld_c_inner_mod!, mld_protect_name => mld_cprecaply implicit none @@ -206,7 +206,7 @@ end subroutine mld_cprecaply subroutine mld_cprecaply1(prec,x,desc_data,info,trans) use psb_base_mod - use mld_c_inner_mod, mld_protect_name => mld_cprecaply1 + use mld_c_inner_mod!, mld_protect_name => mld_cprecaply1 implicit none @@ -240,7 +240,7 @@ subroutine mld_cprecaply1(prec,x,desc_data,info,trans) goto 9999 end if - call mld_precaply(prec,x,ww,desc_data,info,trans=trans,work=w1) + call prec%apply(x,ww,desc_data,info,trans=trans,work=w1) if (info /= psb_success_) then call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_precaply') goto 9999 @@ -267,7 +267,7 @@ end subroutine mld_cprecaply1 subroutine mld_cprecaply2_vect(prec,x,y,desc_data,info,trans,work) use psb_base_mod - use mld_c_inner_mod, mld_protect_name => mld_cprecaply2_vect + use mld_c_inner_mod!, mld_protect_name => mld_cprecaply2_vect implicit none @@ -368,7 +368,7 @@ end subroutine mld_cprecaply2_vect subroutine mld_cprecaply1_vect(prec,x,desc_data,info,trans,work) use psb_base_mod - use mld_c_inner_mod, mld_protect_name => mld_cprecaply1_vect + use mld_c_inner_mod!, mld_protect_name => mld_cprecaply1_vect implicit none diff --git a/mlprec/impl/mld_cprecbld.f90 b/mlprec/impl/mld_cprecbld.f90 index 6fa11f4f..ad328359 100644 --- a/mlprec/impl/mld_cprecbld.f90 +++ b/mlprec/impl/mld_cprecbld.f90 @@ -59,10 +59,9 @@ ! info - integer, output. ! Error code. ! -subroutine mld_cprecbld(a,desc_a,p,info,amold,vmold,imold) +subroutine mld_cprecbld(a,desc_a,prec,info,amold,vmold,imold) use psb_base_mod - use mld_c_inner_mod use mld_c_prec_mod, mld_protect_name => mld_cprecbld Implicit None @@ -70,7 +69,7 @@ subroutine mld_cprecbld(a,desc_a,p,info,amold,vmold,imold) ! Arguments type(psb_cspmat_type),intent(in), target :: a type(psb_desc_type), intent(inout), target :: desc_a - type(mld_cprec_type),intent(inout), target :: p + class(mld_cprec_type),intent(inout), target :: prec integer(psb_ipk_), intent(out) :: info class(psb_c_base_sparse_mat), intent(in), optional :: amold class(psb_c_base_vect_type), intent(in), optional :: vmold @@ -100,7 +99,7 @@ subroutine mld_cprecbld(a,desc_a,p,info,amold,vmold,imold) int_err(1) = 0 ictxt = desc_a%get_context() call psb_info(ictxt, me, np) - p%ictxt = ictxt + prec%ictxt = ictxt if (debug_level >= psb_debug_outer_) & & write(debug_unit,*) me,' ',trim(name),& @@ -122,7 +121,7 @@ subroutine mld_cprecbld(a,desc_a,p,info,amold,vmold,imold) !!$ endif upd_ = 'F' - if (.not.allocated(p%precv)) then + if (.not.allocated(prec%precv)) then !! Error: should have called mld_cprecinit info=3111 call psb_errpush(info,name) @@ -133,9 +132,9 @@ subroutine mld_cprecbld(a,desc_a,p,info,amold,vmold,imold) ! Check to ensure all procs have the same ! newsz = -1 - iszv = size(p%precv) + iszv = size(prec%precv) call psb_bcast(ictxt,iszv) - if (iszv /= size(p%precv)) then + if (iszv /= size(prec%precv)) then info=psb_err_internal_error_ call psb_errpush(info,name,a_err='Inconsistent size of precv') goto 9999 @@ -157,31 +156,31 @@ subroutine mld_cprecbld(a,desc_a,p,info,amold,vmold,imold) ! Check on the iprcparm contents: they should be the same ! on all processes. ! - call psb_bcast(ictxt,p%precv(1)%parms) + call psb_bcast(ictxt,prec%precv(1)%parms) - p%precv(1)%base_a => a - p%precv(1)%base_desc => desc_a + prec%precv(1)%base_a => a + prec%precv(1)%base_desc => desc_a if (info /= psb_success_) then call psb_errpush(psb_err_internal_error_,name,a_err='Base level precbuild.') goto 9999 end if - call p%precv(1)%check(info) - if (info /= psb_success_) then - write(0,*) ' Smoother check error',info - call psb_errpush(psb_err_internal_error_,name,& - & a_err='One level preconditioner check.') - goto 9999 - endif - - call p%precv(1)%sm%build(a,desc_a,upd_,info,& - & amold=amold,vmold=vmold,imold=imold) - if (info /= psb_success_) then - call psb_errpush(psb_err_internal_error_,name,& - & a_err='One level preconditioner build.') - goto 9999 - endif + call prec%precv(1)%check(info) + if (info /= psb_success_) then + write(0,*) ' Smoother check error',info + call psb_errpush(psb_err_internal_error_,name,& + & a_err='One level preconditioner check.') + goto 9999 + endif + + call prec%precv(1)%sm%build(a,desc_a,upd_,info,& + & amold=amold,vmold=vmold,imold=imold) + if (info /= psb_success_) then + call psb_errpush(psb_err_internal_error_,name,& + & a_err='One level preconditioner build.') + goto 9999 + endif ! ! Number of levels > 1 @@ -190,16 +189,25 @@ subroutine mld_cprecbld(a,desc_a,p,info,amold,vmold,imold) ! ! Build the multilevel preconditioner ! - call mld_mlprec_bld(a,desc_a,p,info,& - & amold=amold,vmold=vmold,imold=imold) + call prec%hierarchy_build(a,desc_a,info) if (info /= psb_success_) then - call psb_errpush(psb_err_internal_error_,name,& - & a_err='Multilevel preconditioner build.') + info=psb_err_internal_error_ + call psb_errpush(info,name,a_err='Error from hierarchy build') goto 9999 - endif + end if + + + call prec%smoothers_build(a,desc_a,info,amold,vmold,imold) + + if (info /= psb_success_) then + info=psb_err_internal_error_ + call psb_errpush(info,name,a_err='Error from smoothers build') + goto 9999 + end if + end if - + call psb_erractionrestore(err_act) return diff --git a/mlprec/impl/mld_cprecinit.F90 b/mlprec/impl/mld_cprecinit.F90 index 18948381..0bb6ae61 100644 --- a/mlprec/impl/mld_cprecinit.F90 +++ b/mlprec/impl/mld_cprecinit.F90 @@ -84,12 +84,8 @@ ! lowercase strings). ! info - integer, output. ! Error code. -! nlev - integer, optional, input. -! The number of levels of the multilevel preconditioner. -! If nlev is not present and ptype='ML', then nlev=2 -! is assumed. If ptype /= 'ML', nlev is ignored. ! -subroutine mld_cprecinit(p,ptype,info,nlev) +subroutine mld_cprecinit(prec,ptype,info) use psb_base_mod use mld_c_prec_mod, mld_protect_name => mld_cprecinit @@ -106,10 +102,9 @@ subroutine mld_cprecinit(p,ptype,info,nlev) implicit none ! Arguments - type(mld_cprec_type), intent(inout) :: p + class(mld_cprec_type), intent(inout) :: prec character(len=*), intent(in) :: ptype integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: nlev ! Local variables integer(psb_ipk_) :: nlev_, ilev_ @@ -117,97 +112,92 @@ subroutine mld_cprecinit(p,ptype,info,nlev) character(len=*), parameter :: name='mld_precinit' info = psb_success_ - if (allocated(p%precv)) then - call mld_precfree(p,info) + if (allocated(prec%precv)) then + call prec%free(info) if (info /= psb_success_) then ! Do we want to do something? endif endif - p%coarse_aggr_size = -1 + prec%coarse_aggr_size = -1 select case(psb_toupper(ptype(1:len_trim(ptype)))) case ('NOPREC','NONE') nlev_ = 1 ilev_ = 1 - allocate(p%precv(nlev_),stat=info) - allocate(mld_c_base_smoother_type :: p%precv(ilev_)%sm, stat=info) + allocate(prec%precv(nlev_),stat=info) + allocate(mld_c_base_smoother_type :: prec%precv(ilev_)%sm, stat=info) if (info /= psb_success_) return - allocate(mld_c_id_solver_type :: p%precv(ilev_)%sm%sv, stat=info) - call p%precv(ilev_)%default() + allocate(mld_c_id_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) + call prec%precv(ilev_)%default() case ('JAC','DIAG','JACOBI') nlev_ = 1 ilev_ = 1 - allocate(p%precv(nlev_),stat=info) - allocate(mld_c_jac_smoother_type :: p%precv(ilev_)%sm, stat=info) + allocate(prec%precv(nlev_),stat=info) + allocate(mld_c_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info) if (info /= psb_success_) return - allocate(mld_c_diag_solver_type :: p%precv(ilev_)%sm%sv, stat=info) - call p%precv(ilev_)%default() + allocate(mld_c_diag_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) + call prec%precv(ilev_)%default() case ('BJAC') nlev_ = 1 ilev_ = 1 - allocate(p%precv(nlev_),stat=info) - allocate(mld_c_jac_smoother_type :: p%precv(ilev_)%sm, stat=info) + allocate(prec%precv(nlev_),stat=info) + allocate(mld_c_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info) if (info /= psb_success_) return - allocate(mld_c_ilu_solver_type :: p%precv(ilev_)%sm%sv, stat=info) - call p%precv(ilev_)%default() + allocate(mld_c_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) + call prec%precv(ilev_)%default() case ('AS') nlev_ = 1 ilev_ = 1 - allocate(p%precv(nlev_),stat=info) - allocate(mld_c_as_smoother_type :: p%precv(ilev_)%sm, stat=info) + allocate(prec%precv(nlev_),stat=info) + allocate(mld_c_as_smoother_type :: prec%precv(ilev_)%sm, stat=info) if (info /= psb_success_) return - allocate(mld_c_ilu_solver_type :: p%precv(ilev_)%sm%sv, stat=info) - call p%precv(ilev_)%default() + allocate(mld_c_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) + call prec%precv(ilev_)%default() case ('ML') - if (present(nlev)) then - nlev_ = max(1,nlev) - p%max_prec_levs = nlev_ - else - nlev_ = p%max_prec_levs - end if + nlev_ = prec%max_prec_levs ilev_ = 1 - allocate(p%precv(nlev_),stat=info) - allocate(mld_c_as_smoother_type :: p%precv(ilev_)%sm, stat=info) + allocate(prec%precv(nlev_),stat=info) + allocate(mld_c_as_smoother_type :: prec%precv(ilev_)%sm, stat=info) if (info /= psb_success_) return - allocate(mld_c_ilu_solver_type :: p%precv(ilev_)%sm%sv, stat=info) - call p%precv(ilev_)%default() + allocate(mld_c_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) + call prec%precv(ilev_)%default() if (nlev_ == 1) return do ilev_ = 2, nlev_ -1 - allocate(mld_c_as_smoother_type :: p%precv(ilev_)%sm, stat=info) + allocate(mld_c_as_smoother_type :: prec%precv(ilev_)%sm, stat=info) if (info /= psb_success_) return - allocate(mld_c_ilu_solver_type :: p%precv(ilev_)%sm%sv, stat=info) - call p%precv(ilev_)%default() + allocate(mld_c_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) + call prec%precv(ilev_)%default() end do ilev_ = nlev_ - allocate(mld_c_jac_smoother_type :: p%precv(ilev_)%sm, stat=info) + allocate(mld_c_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info) if (info /= psb_success_) return #if defined(HAVE_SLU_) - allocate(mld_c_slu_solver_type :: p%precv(ilev_)%sm%sv, stat=info) + allocate(mld_c_slu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) #else - allocate(mld_c_ilu_solver_type :: p%precv(ilev_)%sm%sv, stat=info) + allocate(mld_c_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) #endif - call p%precv(ilev_)%default() - p%precv(ilev_)%parms%coarse_solve = mld_bjac_ - call p%precv(ilev_)%set(mld_smoother_sweeps_,4_psb_ipk_,info) - call p%precv(ilev_)%set(mld_sub_restr_,psb_none_,info) - call p%precv(ilev_)%set(mld_sub_prol_,psb_none_,info) - call p%precv(ilev_)%set(mld_sub_ovr_,izero,info) + call prec%precv(ilev_)%default() + prec%precv(ilev_)%parms%coarse_solve = mld_bjac_ + call prec%precv(ilev_)%set(mld_smoother_sweeps_,4_psb_ipk_,info) + call prec%precv(ilev_)%set(mld_sub_restr_,psb_none_,info) + call prec%precv(ilev_)%set(mld_sub_prol_,psb_none_,info) + call prec%precv(ilev_)%set(mld_sub_ovr_,izero,info) thr = 0.05_psb_spk_ scale = 1.0_psb_spk_ do ilev_=1,nlev_ - call p%precv(ilev_)%set(mld_aggr_thresh_,thr,info) - call p%precv(ilev_)%set(mld_aggr_scale_,scale,info) - call p%precv(ilev_)%set(mld_aggr_filter_,mld_filter_mat_,info) + call prec%precv(ilev_)%set(mld_aggr_thresh_,thr,info) + call prec%precv(ilev_)%set(mld_aggr_scale_,scale,info) + call prec%precv(ilev_)%set(mld_aggr_filter_,mld_filter_mat_,info) end do case default diff --git a/mlprec/impl/mld_d_dec_map_bld.f90 b/mlprec/impl/mld_d_dec_map_bld.f90 index 735b2f47..c3739500 100644 --- a/mlprec/impl/mld_d_dec_map_bld.f90 +++ b/mlprec/impl/mld_d_dec_map_bld.f90 @@ -72,6 +72,7 @@ subroutine mld_d_dec_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info) use psb_base_mod + use mld_base_prec_type use mld_d_inner_mod, mld_protect_name => mld_d_dec_map_bld implicit none diff --git a/mlprec/impl/mld_d_hierarchy_bld.f90 b/mlprec/impl/mld_d_hierarchy_bld.f90 index d79cde04..5be032ed 100644 --- a/mlprec/impl/mld_d_hierarchy_bld.f90 +++ b/mlprec/impl/mld_d_hierarchy_bld.f90 @@ -65,7 +65,7 @@ ! info - integer, output. ! Error code. ! -subroutine mld_d_hierarchy_bld(a,desc_a,p,info) +subroutine mld_d_hierarchy_bld(a,desc_a,prec,info) use psb_base_mod use mld_d_inner_mod @@ -76,7 +76,7 @@ subroutine mld_d_hierarchy_bld(a,desc_a,p,info) ! Arguments type(psb_dspmat_type),intent(in), target :: a type(psb_desc_type), intent(inout), target :: desc_a - type(mld_dprec_type),intent(inout),target :: p + class(mld_dprec_type),intent(inout),target :: prec integer(psb_ipk_), intent(out) :: info !!$ character, intent(in), optional :: upd @@ -106,7 +106,7 @@ subroutine mld_d_hierarchy_bld(a,desc_a,p,info) int_err(1) = 0 ictxt = desc_a%get_context() call psb_info(ictxt, me, np) - p%ictxt = ictxt + prec%ictxt = ictxt if (debug_level >= psb_debug_outer_) & & write(debug_unit,*) me,' ',trim(name),& & 'Entering ' @@ -127,7 +127,7 @@ subroutine mld_d_hierarchy_bld(a,desc_a,p,info) ! !$ endif upd_ = 'F' - if (.not.allocated(p%precv)) then + if (.not.allocated(prec%precv)) then !! Error: should have called mld_dprecinit info=3111 call psb_errpush(info,name) @@ -138,31 +138,31 @@ subroutine mld_d_hierarchy_bld(a,desc_a,p,info) ! Check to ensure all procs have the same ! newsz = -1 - casize = p%coarse_aggr_size - mxplevs = p%max_prec_levs - mnaggratio = p%min_aggr_ratio - casize = p%coarse_aggr_size - iszv = size(p%precv) + casize = prec%coarse_aggr_size + mxplevs = prec%max_prec_levs + mnaggratio = prec%min_aggr_ratio + casize = prec%coarse_aggr_size + iszv = size(prec%precv) call psb_bcast(ictxt,iszv) call psb_bcast(ictxt,casize) call psb_bcast(ictxt,mxplevs) call psb_bcast(ictxt,mnaggratio) - if (casize /= p%coarse_aggr_size) then + if (casize /= prec%coarse_aggr_size) then info=psb_err_internal_error_ call psb_errpush(info,name,a_err='Inconsistent coarse_aggr_size') goto 9999 end if - if (mxplevs /= p%max_prec_levs) then + if (mxplevs /= prec%max_prec_levs) then info=psb_err_internal_error_ call psb_errpush(info,name,a_err='Inconsistent max_prec_levs') goto 9999 end if - if (mnaggratio /= p%min_aggr_ratio) then + if (mnaggratio /= prec%min_aggr_ratio) then info=psb_err_internal_error_ call psb_errpush(info,name,a_err='Inconsistent min_aggr_ratio') goto 9999 end if - if (iszv /= size(p%precv)) then + if (iszv /= size(prec%precv)) then info=psb_err_internal_error_ call psb_errpush(info,name,a_err='Inconsistent size of precv') goto 9999 @@ -182,8 +182,8 @@ subroutine mld_d_hierarchy_bld(a,desc_a,p,info) ! This is OK, since it may be called by the user even if there ! is only one level ! - p%precv(1)%base_a => a - p%precv(1)%base_desc => desc_a + prec%precv(1)%base_a => a + prec%precv(1)%base_desc => desc_a call psb_erractionrestore(err_act) return @@ -213,13 +213,13 @@ subroutine mld_d_hierarchy_bld(a,desc_a,p,info) end if nplevs = max(itwo,mxplevs) - coarseparms = p%precv(iszv)%parms - baseparms = p%precv(1)%parms - medparms = p%precv(2)%parms + coarseparms = prec%precv(iszv)%parms + baseparms = prec%precv(1)%parms + medparms = prec%precv(2)%parms - call save_smoothers(p%precv(iszv),coarse_sm,coarse_sm2,info) - if (info == 0) call save_smoothers(p%precv(2),med_sm,med_sm2,info) - if (info == 0) call save_smoothers(p%precv(1),base_sm,base_sm2,info) + call save_smoothers(prec%precv(iszv),coarse_sm,coarse_sm2,info) + if (info == 0) call save_smoothers(prec%precv(2),med_sm,med_sm2,info) + if (info == 0) call save_smoothers(prec%precv(1),base_sm,base_sm2,info) if (info /= psb_success_) then write(0,*) 'Error in saving smoothers',info call psb_errpush(psb_err_internal_error_,name,a_err='Base level precbuild.') @@ -232,10 +232,10 @@ subroutine mld_d_hierarchy_bld(a,desc_a,p,info) allocate(tprecv(nplevs),stat=info) ! First all existing levels if (info == 0) tprecv(1)%parms = baseparms - if (info == 0) call restore_smoothers(tprecv(1),p%precv(1)%sm,p%precv(1)%sm2a,info) + if (info == 0) call restore_smoothers(tprecv(1),prec%precv(1)%sm,prec%precv(1)%sm2a,info) do i=2, min(iszv,nplevs) - 1 if (info == 0) tprecv(i)%parms = medparms - if (info == 0) call restore_smoothers(tprecv(i),p%precv(i)%sm,p%precv(i)%sm2a,info) + if (info == 0) call restore_smoothers(tprecv(i),prec%precv(i)%sm,prec%precv(i)%sm2a,info) end do ! Further intermediates, if any do i=iszv-1, nplevs - 1 @@ -252,24 +252,24 @@ subroutine mld_d_hierarchy_bld(a,desc_a,p,info) endif do i=1,iszv - call p%precv(i)%free(info) + call prec%precv(i)%free(info) end do - call move_alloc(tprecv,p%precv) - iszv = size(p%precv) + call move_alloc(tprecv,prec%precv) + iszv = size(prec%precv) end if ! ! Finest level first; remember to fix base_a and base_desc ! - p%precv(1)%base_a => a - p%precv(1)%base_desc => desc_a + prec%precv(1)%base_a => a + prec%precv(1)%base_desc => desc_a newsz = 0 array_build_loop: do i=2, iszv ! ! Check on the iprcparm contents: they should be the same ! on all processes. ! - call psb_bcast(ictxt,p%precv(i)%parms) + call psb_bcast(ictxt,prec%precv(i)%parms) ! ! Sanity checks on the parameters @@ -278,7 +278,7 @@ subroutine mld_d_hierarchy_bld(a,desc_a,p,info) ! ! A replicated matrix only makes sense at the coarsest level ! - call mld_check_def(p%precv(i)%parms%coarse_mat,'Coarse matrix',& + call mld_check_def(prec%precv(i)%parms%coarse_mat,'Coarse matrix',& & mld_distr_mat_,is_distr_ml_coarse_mat) end if @@ -289,8 +289,8 @@ subroutine mld_d_hierarchy_bld(a,desc_a,p,info) ! Build the mapping between levels i-1 and i and the matrix ! at level i ! - if (info == psb_success_) call mld_aggrmap_bld(p%precv(i),& - & p%precv(i-1)%base_a,p%precv(i-1)%base_desc,& + if (info == psb_success_) call mld_aggrmap_bld(prec%precv(i),& + & prec%precv(i-1)%base_a,prec%precv(i-1)%base_desc,& & ilaggr,nlaggr,op_prol,info) if (info /= psb_success_) then @@ -305,7 +305,7 @@ subroutine mld_d_hierarchy_bld(a,desc_a,p,info) ! ! Save op_prol just in case ! - call op_prol%clone(p%precv(i)%tprol,info) + call op_prol%clone(prec%precv(i)%tprol,info) ! ! Check for early termination of aggregation loop. ! @@ -315,9 +315,9 @@ subroutine mld_d_hierarchy_bld(a,desc_a,p,info) if (i==2) then sizeratio = desc_a%get_global_rows()/sizeratio else - sizeratio = sum(p%precv(i-1)%map%naggr)/sizeratio + sizeratio = sum(prec%precv(i-1)%map%naggr)/sizeratio end if - p%precv(i)%szratio = sizeratio + prec%precv(i)%szratio = sizeratio if (iaggsize <= casize) then newsz = i end if @@ -334,7 +334,7 @@ subroutine mld_d_hierarchy_bld(a,desc_a,p,info) end if end if - if (all(nlaggr == p%precv(i-1)%map%naggr)) then + if (all(nlaggr == prec%precv(i-1)%map%naggr)) then newsz=i-1 if (me == 0) then write(debug_unit,*) trim(name),& @@ -356,27 +356,27 @@ subroutine mld_d_hierarchy_bld(a,desc_a,p,info) ! This is awkward, we are saving the aggregation parms, for the sake ! of distr/repl matrix at coarse level. Should be rethought. ! - athresh = p%precv(newsz)%parms%aggr_thresh - ascale = p%precv(newsz)%parms%aggr_scale - aomega = p%precv(newsz)%parms%aggr_omega_val - if (info == 0) p%precv(newsz)%parms = coarseparms - p%precv(newsz)%parms%aggr_thresh = athresh - p%precv(newsz)%parms%aggr_scale = ascale - p%precv(newsz)%parms%aggr_omega_val = aomega + athresh = prec%precv(newsz)%parms%aggr_thresh + ascale = prec%precv(newsz)%parms%aggr_scale + aomega = prec%precv(newsz)%parms%aggr_omega_val + if (info == 0) prec%precv(newsz)%parms = coarseparms + prec%precv(newsz)%parms%aggr_thresh = athresh + prec%precv(newsz)%parms%aggr_scale = ascale + prec%precv(newsz)%parms%aggr_omega_val = aomega - if (info == 0) call restore_smoothers(p%precv(newsz),coarse_sm,coarse_sm2,info) + if (info == 0) call restore_smoothers(prec%precv(newsz),coarse_sm,coarse_sm2,info) if (newsz < i) then ! ! We are going back and revisit a previous leve; ! recover the aggregation. ! - ilaggr = p%precv(newsz)%map%iaggr - nlaggr = p%precv(newsz)%map%naggr - call p%precv(newsz)%tprol%clone(op_prol,info) + ilaggr = prec%precv(newsz)%map%iaggr + nlaggr = prec%precv(newsz)%map%naggr + call prec%precv(newsz)%tprol%clone(op_prol,info) end if - if (info == psb_success_) call mld_lev_mat_asb(p%precv(newsz),& - & p%precv(newsz-1)%base_a,p%precv(newsz-1)%base_desc,& + if (info == psb_success_) call mld_lev_mat_asb(prec%precv(newsz),& + & prec%precv(newsz-1)%base_a,prec%precv(newsz-1)%base_desc,& & ilaggr,nlaggr,op_prol,info) if (info /= 0) then call psb_errpush(psb_err_internal_error_,name,& @@ -385,8 +385,8 @@ subroutine mld_d_hierarchy_bld(a,desc_a,p,info) endif exit array_build_loop else - if (info == psb_success_) call mld_lev_mat_asb(p%precv(i),& - & p%precv(i-1)%base_a,p%precv(i-1)%base_desc,& + if (info == psb_success_) call mld_lev_mat_asb(prec%precv(i),& + & prec%precv(i-1)%base_a,prec%precv(i-1)%base_desc,& & ilaggr,nlaggr,op_prol,info) end if if (info /= psb_success_) then @@ -409,12 +409,12 @@ subroutine mld_d_hierarchy_bld(a,desc_a,p,info) goto 9999 endif do i=1,newsz - call p%precv(i)%move_alloc(tprecv(i),info) + call prec%precv(i)%move_alloc(tprecv(i),info) end do do i=newsz+1, iszv - call p%precv(i)%free(info) + call prec%precv(i)%free(info) end do - call move_alloc(tprecv,p%precv) + call move_alloc(tprecv,prec%precv) ! Ignore errors from transfer info = psb_success_ ! @@ -423,10 +423,10 @@ subroutine mld_d_hierarchy_bld(a,desc_a,p,info) ! Fix the pointers, but the level 1 should ! be already OK do i=2, iszv - p%precv(i)%base_a => p%precv(i)%ac - p%precv(i)%base_desc => p%precv(i)%desc_ac - p%precv(i)%map%p_desc_X => p%precv(i-1)%base_desc - p%precv(i)%map%p_desc_Y => p%precv(i)%base_desc + prec%precv(i)%base_a => prec%precv(i)%ac + prec%precv(i)%base_desc => prec%precv(i)%desc_ac + prec%precv(i)%map%p_desc_X => prec%precv(i-1)%base_desc + prec%precv(i)%map%p_desc_Y => prec%precv(i)%base_desc end do end if @@ -436,9 +436,9 @@ subroutine mld_d_hierarchy_bld(a,desc_a,p,info) goto 9999 endif - iszv = size(p%precv) + iszv = size(prec%precv) - call p%cmp_complexity() + call prec%cmp_complexity() if (debug_level >= psb_debug_outer_) & & write(debug_unit,*) me,' ',trim(name),& diff --git a/mlprec/impl/mld_d_lev_aggrmap_bld.f90 b/mlprec/impl/mld_d_lev_aggrmap_bld.f90 index c044486a..94839bad 100644 --- a/mlprec/impl/mld_d_lev_aggrmap_bld.f90 +++ b/mlprec/impl/mld_d_lev_aggrmap_bld.f90 @@ -1,3 +1,4 @@ + ! ! ! MLD2P4 version 2.1 @@ -77,6 +78,7 @@ subroutine mld_d_lev_aggrmap_bld(p,a,desc_a,ilaggr,nlaggr,op_prol,info) use psb_base_mod + use mld_base_prec_type use mld_d_inner_mod, mld_protect_name => mld_d_lev_aggrmap_bld implicit none diff --git a/mlprec/impl/mld_d_lev_aggrmat_asb.f90 b/mlprec/impl/mld_d_lev_aggrmat_asb.f90 index a451ca46..145eec26 100644 --- a/mlprec/impl/mld_d_lev_aggrmat_asb.f90 +++ b/mlprec/impl/mld_d_lev_aggrmat_asb.f90 @@ -88,6 +88,7 @@ subroutine mld_d_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info) use psb_base_mod + use mld_base_prec_type use mld_d_inner_mod, mld_protect_name => mld_d_lev_aggrmat_asb implicit none diff --git a/mlprec/impl/mld_d_smoothers_bld.f90 b/mlprec/impl/mld_d_smoothers_bld.f90 index a34638f6..5ba6dbb1 100644 --- a/mlprec/impl/mld_d_smoothers_bld.f90 +++ b/mlprec/impl/mld_d_smoothers_bld.f90 @@ -79,10 +79,10 @@ ! ! ! -subroutine mld_d_smoothers_bld(a,desc_a,p,info,amold,vmold,imold) +subroutine mld_d_smoothers_bld(a,desc_a,prec,info,amold,vmold,imold) use psb_base_mod - use mld_d_inner_mod + !use mld_d_inner_mod use mld_d_prec_mod, mld_protect_name => mld_d_smoothers_bld Implicit None @@ -90,7 +90,7 @@ subroutine mld_d_smoothers_bld(a,desc_a,p,info,amold,vmold,imold) ! Arguments type(psb_dspmat_type),intent(in), target :: a type(psb_desc_type), intent(inout), target :: desc_a - type(mld_dprec_type),intent(inout),target :: p + class(mld_dprec_type),intent(inout),target :: prec integer(psb_ipk_), intent(out) :: info class(psb_d_base_sparse_mat), intent(in), optional :: amold class(psb_d_base_vect_type), intent(in), optional :: vmold @@ -140,7 +140,7 @@ subroutine mld_d_smoothers_bld(a,desc_a,p,info,amold,vmold,imold) ! !$ endif upd_ = 'F' - if (.not.allocated(p%precv)) then + if (.not.allocated(prec%precv)) then !! Error: should have called mld_dprecinit info=3111 call psb_errpush(info,name) @@ -150,9 +150,9 @@ subroutine mld_d_smoothers_bld(a,desc_a,p,info,amold,vmold,imold) ! ! Check to ensure all procs have the same ! - iszv = size(p%precv) + iszv = size(prec%precv) call psb_bcast(ictxt,iszv) - if (iszv /= size(p%precv)) then + if (iszv /= size(prec%precv)) then info=psb_err_internal_error_ call psb_errpush(info,name,a_err='Inconsistent size of precv') goto 9999 @@ -174,7 +174,7 @@ subroutine mld_d_smoothers_bld(a,desc_a,p,info,amold,vmold,imold) ! ! build the base preconditioner at level i ! - call p%precv(i)%bld(info,amold=amold,vmold=vmold,imold=imold) + call prec%precv(i)%bld(info,amold=amold,vmold=vmold,imold=imold) if (info /= psb_success_) then write(ch_err,'(a,i7)') 'Error @ level',i diff --git a/mlprec/impl/mld_daggrmap_bld.f90 b/mlprec/impl/mld_daggrmap_bld.f90 index f7aecb6f..0f5af04c 100644 --- a/mlprec/impl/mld_daggrmap_bld.f90 +++ b/mlprec/impl/mld_daggrmap_bld.f90 @@ -88,6 +88,7 @@ subroutine mld_daggrmap_bld(aggr_type,iorder,theta,a,desc_a,ilaggr,nlaggr,op_prol,info) use psb_base_mod + use mld_base_prec_type use mld_d_inner_mod, mld_protect_name => mld_daggrmap_bld implicit none diff --git a/mlprec/impl/mld_daggrmat_asb.f90 b/mlprec/impl/mld_daggrmat_asb.f90 index f13ea524..ddd01378 100644 --- a/mlprec/impl/mld_daggrmat_asb.f90 +++ b/mlprec/impl/mld_daggrmat_asb.f90 @@ -120,6 +120,7 @@ subroutine mld_daggrmat_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info) use psb_base_mod + use mld_base_prec_type use mld_d_inner_mod, mld_protect_name => mld_daggrmat_asb implicit none diff --git a/mlprec/impl/mld_daggrmat_biz_asb.f90 b/mlprec/impl/mld_daggrmat_biz_asb.f90 index dde4d6af..01330b1c 100644 --- a/mlprec/impl/mld_daggrmat_biz_asb.f90 +++ b/mlprec/impl/mld_daggrmat_biz_asb.f90 @@ -84,6 +84,7 @@ ! subroutine mld_daggrmat_biz_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info) use psb_base_mod + use mld_base_prec_type use mld_d_inner_mod, mld_protect_name => mld_daggrmat_biz_asb implicit none diff --git a/mlprec/impl/mld_daggrmat_minnrg_asb.f90 b/mlprec/impl/mld_daggrmat_minnrg_asb.f90 index c064f9e2..8e73858f 100644 --- a/mlprec/impl/mld_daggrmat_minnrg_asb.f90 +++ b/mlprec/impl/mld_daggrmat_minnrg_asb.f90 @@ -112,6 +112,7 @@ ! subroutine mld_daggrmat_minnrg_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info) use psb_base_mod + use mld_base_prec_type use mld_d_inner_mod, mld_protect_name => mld_daggrmat_minnrg_asb implicit none diff --git a/mlprec/impl/mld_daggrmat_nosmth_asb.f90 b/mlprec/impl/mld_daggrmat_nosmth_asb.f90 index ae0bec99..48bbf144 100644 --- a/mlprec/impl/mld_daggrmat_nosmth_asb.f90 +++ b/mlprec/impl/mld_daggrmat_nosmth_asb.f90 @@ -100,6 +100,7 @@ ! subroutine mld_daggrmat_nosmth_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info) use psb_base_mod + use mld_base_prec_type use mld_d_inner_mod, mld_protect_name => mld_daggrmat_nosmth_asb implicit none diff --git a/mlprec/impl/mld_daggrmat_smth_asb.f90 b/mlprec/impl/mld_daggrmat_smth_asb.f90 index 74b11d4e..9e1c6a94 100644 --- a/mlprec/impl/mld_daggrmat_smth_asb.f90 +++ b/mlprec/impl/mld_daggrmat_smth_asb.f90 @@ -113,6 +113,7 @@ ! subroutine mld_daggrmat_smth_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info) use psb_base_mod + use mld_base_prec_type use mld_d_inner_mod, mld_protect_name => mld_daggrmat_smth_asb implicit none diff --git a/mlprec/impl/mld_dmlprec_aply.f90 b/mlprec/impl/mld_dmlprec_aply.f90 index ec79f017..483f5bae 100644 --- a/mlprec/impl/mld_dmlprec_aply.f90 +++ b/mlprec/impl/mld_dmlprec_aply.f90 @@ -299,6 +299,7 @@ subroutine mld_dmlprec_aply_vect(alpha,p,x,beta,y,desc_data,trans,work,info) use psb_base_mod + use mld_base_prec_type use mld_d_inner_mod, mld_protect_name => mld_dmlprec_aply_vect implicit none @@ -1303,6 +1304,7 @@ end subroutine mld_dmlprec_aply_vect subroutine mld_dmlprec_aply(alpha,p,x,beta,y,desc_data,trans,work,info) use psb_base_mod + use mld_base_prec_type use mld_d_inner_mod, mld_protect_name => mld_dmlprec_aply implicit none diff --git a/mlprec/impl/mld_dmlprec_bld.f90 b/mlprec/impl/mld_dmlprec_bld.f90 index afc4f6eb..7b579fc6 100644 --- a/mlprec/impl/mld_dmlprec_bld.f90 +++ b/mlprec/impl/mld_dmlprec_bld.f90 @@ -123,7 +123,7 @@ subroutine mld_dmlprec_bld(a,desc_a,p,info,amold,vmold,imold) & write(debug_unit,*) me,' ',trim(name),& & 'Entering ' - call mld_d_hierarchy_bld(a,desc_a,p,info) + call p%hierarchy_build(a,desc_a,info) if (info /= psb_success_) then info=psb_err_internal_error_ @@ -133,7 +133,7 @@ subroutine mld_dmlprec_bld(a,desc_a,p,info,amold,vmold,imold) iszv = p%get_nlevs() - call mld_d_smoothers_bld(a,desc_a,p,info,amold,vmold,imold) + call p%smoothers_build(a,desc_a,info,amold,vmold,imold) if (info /= psb_success_) then info=psb_err_internal_error_ diff --git a/mlprec/impl/mld_dprecaply.f90 b/mlprec/impl/mld_dprecaply.f90 index 51b55f84..4964d07a 100644 --- a/mlprec/impl/mld_dprecaply.f90 +++ b/mlprec/impl/mld_dprecaply.f90 @@ -75,7 +75,7 @@ subroutine mld_dprecaply(prec,x,y,desc_data,info,trans,work) use psb_base_mod - use mld_d_inner_mod, mld_protect_name => mld_dprecaply + use mld_d_inner_mod!, mld_protect_name => mld_dprecaply implicit none @@ -206,7 +206,7 @@ end subroutine mld_dprecaply subroutine mld_dprecaply1(prec,x,desc_data,info,trans) use psb_base_mod - use mld_d_inner_mod, mld_protect_name => mld_dprecaply1 + use mld_d_inner_mod!, mld_protect_name => mld_dprecaply1 implicit none @@ -240,7 +240,7 @@ subroutine mld_dprecaply1(prec,x,desc_data,info,trans) goto 9999 end if - call mld_precaply(prec,x,ww,desc_data,info,trans=trans,work=w1) + call prec%apply(x,ww,desc_data,info,trans=trans,work=w1) if (info /= psb_success_) then call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_precaply') goto 9999 @@ -267,7 +267,7 @@ end subroutine mld_dprecaply1 subroutine mld_dprecaply2_vect(prec,x,y,desc_data,info,trans,work) use psb_base_mod - use mld_d_inner_mod, mld_protect_name => mld_dprecaply2_vect + use mld_d_inner_mod!, mld_protect_name => mld_dprecaply2_vect implicit none @@ -368,7 +368,7 @@ end subroutine mld_dprecaply2_vect subroutine mld_dprecaply1_vect(prec,x,desc_data,info,trans,work) use psb_base_mod - use mld_d_inner_mod, mld_protect_name => mld_dprecaply1_vect + use mld_d_inner_mod!, mld_protect_name => mld_dprecaply1_vect implicit none diff --git a/mlprec/impl/mld_dprecbld.f90 b/mlprec/impl/mld_dprecbld.f90 index 4937f4d8..66f4b092 100644 --- a/mlprec/impl/mld_dprecbld.f90 +++ b/mlprec/impl/mld_dprecbld.f90 @@ -59,18 +59,17 @@ ! info - integer, output. ! Error code. ! -subroutine mld_dprecbld(a,desc_a,p,info,amold,vmold,imold) +subroutine mld_dprecbld(a,desc_a,prec,info,amold,vmold,imold) use psb_base_mod - use mld_d_inner_mod, mld_protect_name1 => mld_dprecbld - use mld_d_prec_mod, mld_protect_name2 => mld_dprecbld + use mld_d_prec_mod, mld_protect_name => mld_dprecbld Implicit None ! Arguments type(psb_dspmat_type),intent(in), target :: a type(psb_desc_type), intent(inout), target :: desc_a - type(mld_dprec_type),intent(inout), target :: p + class(mld_dprec_type),intent(inout), target :: prec integer(psb_ipk_), intent(out) :: info class(psb_d_base_sparse_mat), intent(in), optional :: amold class(psb_d_base_vect_type), intent(in), optional :: vmold @@ -100,7 +99,7 @@ subroutine mld_dprecbld(a,desc_a,p,info,amold,vmold,imold) int_err(1) = 0 ictxt = desc_a%get_context() call psb_info(ictxt, me, np) - p%ictxt = ictxt + prec%ictxt = ictxt if (debug_level >= psb_debug_outer_) & & write(debug_unit,*) me,' ',trim(name),& @@ -122,7 +121,7 @@ subroutine mld_dprecbld(a,desc_a,p,info,amold,vmold,imold) !!$ endif upd_ = 'F' - if (.not.allocated(p%precv)) then + if (.not.allocated(prec%precv)) then !! Error: should have called mld_dprecinit info=3111 call psb_errpush(info,name) @@ -133,9 +132,9 @@ subroutine mld_dprecbld(a,desc_a,p,info,amold,vmold,imold) ! Check to ensure all procs have the same ! newsz = -1 - iszv = size(p%precv) + iszv = size(prec%precv) call psb_bcast(ictxt,iszv) - if (iszv /= size(p%precv)) then + if (iszv /= size(prec%precv)) then info=psb_err_internal_error_ call psb_errpush(info,name,a_err='Inconsistent size of precv') goto 9999 @@ -157,31 +156,31 @@ subroutine mld_dprecbld(a,desc_a,p,info,amold,vmold,imold) ! Check on the iprcparm contents: they should be the same ! on all processes. ! - call psb_bcast(ictxt,p%precv(1)%parms) + call psb_bcast(ictxt,prec%precv(1)%parms) - p%precv(1)%base_a => a - p%precv(1)%base_desc => desc_a + prec%precv(1)%base_a => a + prec%precv(1)%base_desc => desc_a if (info /= psb_success_) then call psb_errpush(psb_err_internal_error_,name,a_err='Base level precbuild.') goto 9999 end if - call p%precv(1)%check(info) - if (info /= psb_success_) then - write(0,*) ' Smoother check error',info - call psb_errpush(psb_err_internal_error_,name,& - & a_err='One level preconditioner check.') - goto 9999 - endif - - call p%precv(1)%sm%build(a,desc_a,upd_,info,& - & amold=amold,vmold=vmold,imold=imold) - if (info /= psb_success_) then - call psb_errpush(psb_err_internal_error_,name,& - & a_err='One level preconditioner build.') - goto 9999 - endif + call prec%precv(1)%check(info) + if (info /= psb_success_) then + write(0,*) ' Smoother check error',info + call psb_errpush(psb_err_internal_error_,name,& + & a_err='One level preconditioner check.') + goto 9999 + endif + + call prec%precv(1)%sm%build(a,desc_a,upd_,info,& + & amold=amold,vmold=vmold,imold=imold) + if (info /= psb_success_) then + call psb_errpush(psb_err_internal_error_,name,& + & a_err='One level preconditioner build.') + goto 9999 + endif ! ! Number of levels > 1 @@ -190,16 +189,25 @@ subroutine mld_dprecbld(a,desc_a,p,info,amold,vmold,imold) ! ! Build the multilevel preconditioner ! - call mld_mlprec_bld(a,desc_a,p,info,& - & amold=amold,vmold=vmold,imold=imold) + call prec%hierarchy_build(a,desc_a,info) if (info /= psb_success_) then - call psb_errpush(psb_err_internal_error_,name,& - & a_err='Multilevel preconditioner build.') + info=psb_err_internal_error_ + call psb_errpush(info,name,a_err='Error from hierarchy build') goto 9999 - endif + end if + + + call prec%smoothers_build(a,desc_a,info,amold,vmold,imold) + + if (info /= psb_success_) then + info=psb_err_internal_error_ + call psb_errpush(info,name,a_err='Error from smoothers build') + goto 9999 + end if + end if - + call psb_erractionrestore(err_act) return diff --git a/mlprec/impl/mld_dprecinit.F90 b/mlprec/impl/mld_dprecinit.F90 index e4ea7b43..be29400a 100644 --- a/mlprec/impl/mld_dprecinit.F90 +++ b/mlprec/impl/mld_dprecinit.F90 @@ -84,12 +84,8 @@ ! lowercase strings). ! info - integer, output. ! Error code. -! nlev - integer, optional, input. -! The number of levels of the multilevel preconditioner. -! If nlev is not present and ptype='ML', then nlev=2 -! is assumed. If ptype /= 'ML', nlev is ignored. ! -subroutine mld_dprecinit(p,ptype,info,nlev) +subroutine mld_dprecinit(prec,ptype,info) use psb_base_mod use mld_d_prec_mod, mld_protect_name => mld_dprecinit @@ -109,10 +105,9 @@ subroutine mld_dprecinit(p,ptype,info,nlev) implicit none ! Arguments - type(mld_dprec_type), intent(inout) :: p + class(mld_dprec_type), intent(inout) :: prec character(len=*), intent(in) :: ptype integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: nlev ! Local variables integer(psb_ipk_) :: nlev_, ilev_ @@ -120,99 +115,94 @@ subroutine mld_dprecinit(p,ptype,info,nlev) character(len=*), parameter :: name='mld_precinit' info = psb_success_ - if (allocated(p%precv)) then - call mld_precfree(p,info) + if (allocated(prec%precv)) then + call prec%free(info) if (info /= psb_success_) then ! Do we want to do something? endif endif - p%coarse_aggr_size = -1 + prec%coarse_aggr_size = -1 select case(psb_toupper(ptype(1:len_trim(ptype)))) case ('NOPREC','NONE') nlev_ = 1 ilev_ = 1 - allocate(p%precv(nlev_),stat=info) - allocate(mld_d_base_smoother_type :: p%precv(ilev_)%sm, stat=info) + allocate(prec%precv(nlev_),stat=info) + allocate(mld_d_base_smoother_type :: prec%precv(ilev_)%sm, stat=info) if (info /= psb_success_) return - allocate(mld_d_id_solver_type :: p%precv(ilev_)%sm%sv, stat=info) - call p%precv(ilev_)%default() + allocate(mld_d_id_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) + call prec%precv(ilev_)%default() case ('JAC','DIAG','JACOBI') nlev_ = 1 ilev_ = 1 - allocate(p%precv(nlev_),stat=info) - allocate(mld_d_jac_smoother_type :: p%precv(ilev_)%sm, stat=info) + allocate(prec%precv(nlev_),stat=info) + allocate(mld_d_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info) if (info /= psb_success_) return - allocate(mld_d_diag_solver_type :: p%precv(ilev_)%sm%sv, stat=info) - call p%precv(ilev_)%default() + allocate(mld_d_diag_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) + call prec%precv(ilev_)%default() case ('BJAC') nlev_ = 1 ilev_ = 1 - allocate(p%precv(nlev_),stat=info) - allocate(mld_d_jac_smoother_type :: p%precv(ilev_)%sm, stat=info) + allocate(prec%precv(nlev_),stat=info) + allocate(mld_d_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info) if (info /= psb_success_) return - allocate(mld_d_ilu_solver_type :: p%precv(ilev_)%sm%sv, stat=info) - call p%precv(ilev_)%default() + allocate(mld_d_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) + call prec%precv(ilev_)%default() case ('AS') nlev_ = 1 ilev_ = 1 - allocate(p%precv(nlev_),stat=info) - allocate(mld_d_as_smoother_type :: p%precv(ilev_)%sm, stat=info) + allocate(prec%precv(nlev_),stat=info) + allocate(mld_d_as_smoother_type :: prec%precv(ilev_)%sm, stat=info) if (info /= psb_success_) return - allocate(mld_d_ilu_solver_type :: p%precv(ilev_)%sm%sv, stat=info) - call p%precv(ilev_)%default() + allocate(mld_d_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) + call prec%precv(ilev_)%default() case ('ML') - if (present(nlev)) then - nlev_ = max(1,nlev) - p%max_prec_levs = nlev_ - else - nlev_ = p%max_prec_levs - end if + nlev_ = prec%max_prec_levs ilev_ = 1 - allocate(p%precv(nlev_),stat=info) - allocate(mld_d_as_smoother_type :: p%precv(ilev_)%sm, stat=info) + allocate(prec%precv(nlev_),stat=info) + allocate(mld_d_as_smoother_type :: prec%precv(ilev_)%sm, stat=info) if (info /= psb_success_) return - allocate(mld_d_ilu_solver_type :: p%precv(ilev_)%sm%sv, stat=info) - call p%precv(ilev_)%default() + allocate(mld_d_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) + call prec%precv(ilev_)%default() if (nlev_ == 1) return do ilev_ = 2, nlev_ -1 - allocate(mld_d_as_smoother_type :: p%precv(ilev_)%sm, stat=info) + allocate(mld_d_as_smoother_type :: prec%precv(ilev_)%sm, stat=info) if (info /= psb_success_) return - allocate(mld_d_ilu_solver_type :: p%precv(ilev_)%sm%sv, stat=info) - call p%precv(ilev_)%default() + allocate(mld_d_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) + call prec%precv(ilev_)%default() end do ilev_ = nlev_ - allocate(mld_d_jac_smoother_type :: p%precv(ilev_)%sm, stat=info) + allocate(mld_d_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info) if (info /= psb_success_) return #if defined(HAVE_UMF_) - allocate(mld_d_umf_solver_type :: p%precv(ilev_)%sm%sv, stat=info) + allocate(mld_d_umf_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) #elif defined(HAVE_SLU_) - allocate(mld_d_slu_solver_type :: p%precv(ilev_)%sm%sv, stat=info) + allocate(mld_d_slu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) #else - allocate(mld_d_ilu_solver_type :: p%precv(ilev_)%sm%sv, stat=info) + allocate(mld_d_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) #endif - call p%precv(ilev_)%default() - p%precv(ilev_)%parms%coarse_solve = mld_bjac_ - call p%precv(ilev_)%set(mld_smoother_sweeps_,4_psb_ipk_,info) - call p%precv(ilev_)%set(mld_sub_restr_,psb_none_,info) - call p%precv(ilev_)%set(mld_sub_prol_,psb_none_,info) - call p%precv(ilev_)%set(mld_sub_ovr_,izero,info) + call prec%precv(ilev_)%default() + prec%precv(ilev_)%parms%coarse_solve = mld_bjac_ + call prec%precv(ilev_)%set(mld_smoother_sweeps_,4_psb_ipk_,info) + call prec%precv(ilev_)%set(mld_sub_restr_,psb_none_,info) + call prec%precv(ilev_)%set(mld_sub_prol_,psb_none_,info) + call prec%precv(ilev_)%set(mld_sub_ovr_,izero,info) thr = 0.05_psb_dpk_ scale = 1.0_psb_dpk_ do ilev_=1,nlev_ - call p%precv(ilev_)%set(mld_aggr_thresh_,thr,info) - call p%precv(ilev_)%set(mld_aggr_scale_,scale,info) - call p%precv(ilev_)%set(mld_aggr_filter_,mld_filter_mat_,info) + call prec%precv(ilev_)%set(mld_aggr_thresh_,thr,info) + call prec%precv(ilev_)%set(mld_aggr_scale_,scale,info) + call prec%precv(ilev_)%set(mld_aggr_filter_,mld_filter_mat_,info) end do case default diff --git a/mlprec/impl/mld_s_dec_map_bld.f90 b/mlprec/impl/mld_s_dec_map_bld.f90 index 6753f2ba..fc10a736 100644 --- a/mlprec/impl/mld_s_dec_map_bld.f90 +++ b/mlprec/impl/mld_s_dec_map_bld.f90 @@ -72,6 +72,7 @@ subroutine mld_s_dec_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info) use psb_base_mod + use mld_base_prec_type use mld_s_inner_mod, mld_protect_name => mld_s_dec_map_bld implicit none diff --git a/mlprec/impl/mld_s_hierarchy_bld.f90 b/mlprec/impl/mld_s_hierarchy_bld.f90 index 9cea899d..bf3964a8 100644 --- a/mlprec/impl/mld_s_hierarchy_bld.f90 +++ b/mlprec/impl/mld_s_hierarchy_bld.f90 @@ -65,7 +65,7 @@ ! info - integer, output. ! Error code. ! -subroutine mld_s_hierarchy_bld(a,desc_a,p,info) +subroutine mld_s_hierarchy_bld(a,desc_a,prec,info) use psb_base_mod use mld_s_inner_mod @@ -76,7 +76,7 @@ subroutine mld_s_hierarchy_bld(a,desc_a,p,info) ! Arguments type(psb_sspmat_type),intent(in), target :: a type(psb_desc_type), intent(inout), target :: desc_a - type(mld_sprec_type),intent(inout),target :: p + class(mld_sprec_type),intent(inout),target :: prec integer(psb_ipk_), intent(out) :: info !!$ character, intent(in), optional :: upd @@ -106,7 +106,7 @@ subroutine mld_s_hierarchy_bld(a,desc_a,p,info) int_err(1) = 0 ictxt = desc_a%get_context() call psb_info(ictxt, me, np) - p%ictxt = ictxt + prec%ictxt = ictxt if (debug_level >= psb_debug_outer_) & & write(debug_unit,*) me,' ',trim(name),& & 'Entering ' @@ -127,7 +127,7 @@ subroutine mld_s_hierarchy_bld(a,desc_a,p,info) ! !$ endif upd_ = 'F' - if (.not.allocated(p%precv)) then + if (.not.allocated(prec%precv)) then !! Error: should have called mld_sprecinit info=3111 call psb_errpush(info,name) @@ -138,31 +138,31 @@ subroutine mld_s_hierarchy_bld(a,desc_a,p,info) ! Check to ensure all procs have the same ! newsz = -1 - casize = p%coarse_aggr_size - mxplevs = p%max_prec_levs - mnaggratio = p%min_aggr_ratio - casize = p%coarse_aggr_size - iszv = size(p%precv) + casize = prec%coarse_aggr_size + mxplevs = prec%max_prec_levs + mnaggratio = prec%min_aggr_ratio + casize = prec%coarse_aggr_size + iszv = size(prec%precv) call psb_bcast(ictxt,iszv) call psb_bcast(ictxt,casize) call psb_bcast(ictxt,mxplevs) call psb_bcast(ictxt,mnaggratio) - if (casize /= p%coarse_aggr_size) then + if (casize /= prec%coarse_aggr_size) then info=psb_err_internal_error_ call psb_errpush(info,name,a_err='Inconsistent coarse_aggr_size') goto 9999 end if - if (mxplevs /= p%max_prec_levs) then + if (mxplevs /= prec%max_prec_levs) then info=psb_err_internal_error_ call psb_errpush(info,name,a_err='Inconsistent max_prec_levs') goto 9999 end if - if (mnaggratio /= p%min_aggr_ratio) then + if (mnaggratio /= prec%min_aggr_ratio) then info=psb_err_internal_error_ call psb_errpush(info,name,a_err='Inconsistent min_aggr_ratio') goto 9999 end if - if (iszv /= size(p%precv)) then + if (iszv /= size(prec%precv)) then info=psb_err_internal_error_ call psb_errpush(info,name,a_err='Inconsistent size of precv') goto 9999 @@ -182,8 +182,8 @@ subroutine mld_s_hierarchy_bld(a,desc_a,p,info) ! This is OK, since it may be called by the user even if there ! is only one level ! - p%precv(1)%base_a => a - p%precv(1)%base_desc => desc_a + prec%precv(1)%base_a => a + prec%precv(1)%base_desc => desc_a call psb_erractionrestore(err_act) return @@ -213,13 +213,13 @@ subroutine mld_s_hierarchy_bld(a,desc_a,p,info) end if nplevs = max(itwo,mxplevs) - coarseparms = p%precv(iszv)%parms - baseparms = p%precv(1)%parms - medparms = p%precv(2)%parms + coarseparms = prec%precv(iszv)%parms + baseparms = prec%precv(1)%parms + medparms = prec%precv(2)%parms - call save_smoothers(p%precv(iszv),coarse_sm,coarse_sm2,info) - if (info == 0) call save_smoothers(p%precv(2),med_sm,med_sm2,info) - if (info == 0) call save_smoothers(p%precv(1),base_sm,base_sm2,info) + call save_smoothers(prec%precv(iszv),coarse_sm,coarse_sm2,info) + if (info == 0) call save_smoothers(prec%precv(2),med_sm,med_sm2,info) + if (info == 0) call save_smoothers(prec%precv(1),base_sm,base_sm2,info) if (info /= psb_success_) then write(0,*) 'Error in saving smoothers',info call psb_errpush(psb_err_internal_error_,name,a_err='Base level precbuild.') @@ -232,10 +232,10 @@ subroutine mld_s_hierarchy_bld(a,desc_a,p,info) allocate(tprecv(nplevs),stat=info) ! First all existing levels if (info == 0) tprecv(1)%parms = baseparms - if (info == 0) call restore_smoothers(tprecv(1),p%precv(1)%sm,p%precv(1)%sm2a,info) + if (info == 0) call restore_smoothers(tprecv(1),prec%precv(1)%sm,prec%precv(1)%sm2a,info) do i=2, min(iszv,nplevs) - 1 if (info == 0) tprecv(i)%parms = medparms - if (info == 0) call restore_smoothers(tprecv(i),p%precv(i)%sm,p%precv(i)%sm2a,info) + if (info == 0) call restore_smoothers(tprecv(i),prec%precv(i)%sm,prec%precv(i)%sm2a,info) end do ! Further intermediates, if any do i=iszv-1, nplevs - 1 @@ -252,24 +252,24 @@ subroutine mld_s_hierarchy_bld(a,desc_a,p,info) endif do i=1,iszv - call p%precv(i)%free(info) + call prec%precv(i)%free(info) end do - call move_alloc(tprecv,p%precv) - iszv = size(p%precv) + call move_alloc(tprecv,prec%precv) + iszv = size(prec%precv) end if ! ! Finest level first; remember to fix base_a and base_desc ! - p%precv(1)%base_a => a - p%precv(1)%base_desc => desc_a + prec%precv(1)%base_a => a + prec%precv(1)%base_desc => desc_a newsz = 0 array_build_loop: do i=2, iszv ! ! Check on the iprcparm contents: they should be the same ! on all processes. ! - call psb_bcast(ictxt,p%precv(i)%parms) + call psb_bcast(ictxt,prec%precv(i)%parms) ! ! Sanity checks on the parameters @@ -278,7 +278,7 @@ subroutine mld_s_hierarchy_bld(a,desc_a,p,info) ! ! A replicated matrix only makes sense at the coarsest level ! - call mld_check_def(p%precv(i)%parms%coarse_mat,'Coarse matrix',& + call mld_check_def(prec%precv(i)%parms%coarse_mat,'Coarse matrix',& & mld_distr_mat_,is_distr_ml_coarse_mat) end if @@ -289,8 +289,8 @@ subroutine mld_s_hierarchy_bld(a,desc_a,p,info) ! Build the mapping between levels i-1 and i and the matrix ! at level i ! - if (info == psb_success_) call mld_aggrmap_bld(p%precv(i),& - & p%precv(i-1)%base_a,p%precv(i-1)%base_desc,& + if (info == psb_success_) call mld_aggrmap_bld(prec%precv(i),& + & prec%precv(i-1)%base_a,prec%precv(i-1)%base_desc,& & ilaggr,nlaggr,op_prol,info) if (info /= psb_success_) then @@ -305,7 +305,7 @@ subroutine mld_s_hierarchy_bld(a,desc_a,p,info) ! ! Save op_prol just in case ! - call op_prol%clone(p%precv(i)%tprol,info) + call op_prol%clone(prec%precv(i)%tprol,info) ! ! Check for early termination of aggregation loop. ! @@ -315,9 +315,9 @@ subroutine mld_s_hierarchy_bld(a,desc_a,p,info) if (i==2) then sizeratio = desc_a%get_global_rows()/sizeratio else - sizeratio = sum(p%precv(i-1)%map%naggr)/sizeratio + sizeratio = sum(prec%precv(i-1)%map%naggr)/sizeratio end if - p%precv(i)%szratio = sizeratio + prec%precv(i)%szratio = sizeratio if (iaggsize <= casize) then newsz = i end if @@ -334,7 +334,7 @@ subroutine mld_s_hierarchy_bld(a,desc_a,p,info) end if end if - if (all(nlaggr == p%precv(i-1)%map%naggr)) then + if (all(nlaggr == prec%precv(i-1)%map%naggr)) then newsz=i-1 if (me == 0) then write(debug_unit,*) trim(name),& @@ -356,27 +356,27 @@ subroutine mld_s_hierarchy_bld(a,desc_a,p,info) ! This is awkward, we are saving the aggregation parms, for the sake ! of distr/repl matrix at coarse level. Should be rethought. ! - athresh = p%precv(newsz)%parms%aggr_thresh - ascale = p%precv(newsz)%parms%aggr_scale - aomega = p%precv(newsz)%parms%aggr_omega_val - if (info == 0) p%precv(newsz)%parms = coarseparms - p%precv(newsz)%parms%aggr_thresh = athresh - p%precv(newsz)%parms%aggr_scale = ascale - p%precv(newsz)%parms%aggr_omega_val = aomega + athresh = prec%precv(newsz)%parms%aggr_thresh + ascale = prec%precv(newsz)%parms%aggr_scale + aomega = prec%precv(newsz)%parms%aggr_omega_val + if (info == 0) prec%precv(newsz)%parms = coarseparms + prec%precv(newsz)%parms%aggr_thresh = athresh + prec%precv(newsz)%parms%aggr_scale = ascale + prec%precv(newsz)%parms%aggr_omega_val = aomega - if (info == 0) call restore_smoothers(p%precv(newsz),coarse_sm,coarse_sm2,info) + if (info == 0) call restore_smoothers(prec%precv(newsz),coarse_sm,coarse_sm2,info) if (newsz < i) then ! ! We are going back and revisit a previous leve; ! recover the aggregation. ! - ilaggr = p%precv(newsz)%map%iaggr - nlaggr = p%precv(newsz)%map%naggr - call p%precv(newsz)%tprol%clone(op_prol,info) + ilaggr = prec%precv(newsz)%map%iaggr + nlaggr = prec%precv(newsz)%map%naggr + call prec%precv(newsz)%tprol%clone(op_prol,info) end if - if (info == psb_success_) call mld_lev_mat_asb(p%precv(newsz),& - & p%precv(newsz-1)%base_a,p%precv(newsz-1)%base_desc,& + if (info == psb_success_) call mld_lev_mat_asb(prec%precv(newsz),& + & prec%precv(newsz-1)%base_a,prec%precv(newsz-1)%base_desc,& & ilaggr,nlaggr,op_prol,info) if (info /= 0) then call psb_errpush(psb_err_internal_error_,name,& @@ -385,8 +385,8 @@ subroutine mld_s_hierarchy_bld(a,desc_a,p,info) endif exit array_build_loop else - if (info == psb_success_) call mld_lev_mat_asb(p%precv(i),& - & p%precv(i-1)%base_a,p%precv(i-1)%base_desc,& + if (info == psb_success_) call mld_lev_mat_asb(prec%precv(i),& + & prec%precv(i-1)%base_a,prec%precv(i-1)%base_desc,& & ilaggr,nlaggr,op_prol,info) end if if (info /= psb_success_) then @@ -409,12 +409,12 @@ subroutine mld_s_hierarchy_bld(a,desc_a,p,info) goto 9999 endif do i=1,newsz - call p%precv(i)%move_alloc(tprecv(i),info) + call prec%precv(i)%move_alloc(tprecv(i),info) end do do i=newsz+1, iszv - call p%precv(i)%free(info) + call prec%precv(i)%free(info) end do - call move_alloc(tprecv,p%precv) + call move_alloc(tprecv,prec%precv) ! Ignore errors from transfer info = psb_success_ ! @@ -423,10 +423,10 @@ subroutine mld_s_hierarchy_bld(a,desc_a,p,info) ! Fix the pointers, but the level 1 should ! be already OK do i=2, iszv - p%precv(i)%base_a => p%precv(i)%ac - p%precv(i)%base_desc => p%precv(i)%desc_ac - p%precv(i)%map%p_desc_X => p%precv(i-1)%base_desc - p%precv(i)%map%p_desc_Y => p%precv(i)%base_desc + prec%precv(i)%base_a => prec%precv(i)%ac + prec%precv(i)%base_desc => prec%precv(i)%desc_ac + prec%precv(i)%map%p_desc_X => prec%precv(i-1)%base_desc + prec%precv(i)%map%p_desc_Y => prec%precv(i)%base_desc end do end if @@ -436,9 +436,9 @@ subroutine mld_s_hierarchy_bld(a,desc_a,p,info) goto 9999 endif - iszv = size(p%precv) + iszv = size(prec%precv) - call p%cmp_complexity() + call prec%cmp_complexity() if (debug_level >= psb_debug_outer_) & & write(debug_unit,*) me,' ',trim(name),& diff --git a/mlprec/impl/mld_s_lev_aggrmap_bld.f90 b/mlprec/impl/mld_s_lev_aggrmap_bld.f90 index 38cc5487..94ba585d 100644 --- a/mlprec/impl/mld_s_lev_aggrmap_bld.f90 +++ b/mlprec/impl/mld_s_lev_aggrmap_bld.f90 @@ -1,3 +1,4 @@ + ! ! ! MLD2P4 version 2.1 @@ -77,6 +78,7 @@ subroutine mld_s_lev_aggrmap_bld(p,a,desc_a,ilaggr,nlaggr,op_prol,info) use psb_base_mod + use mld_base_prec_type use mld_s_inner_mod, mld_protect_name => mld_s_lev_aggrmap_bld implicit none diff --git a/mlprec/impl/mld_s_lev_aggrmat_asb.f90 b/mlprec/impl/mld_s_lev_aggrmat_asb.f90 index 71306f32..a1dc8ad1 100644 --- a/mlprec/impl/mld_s_lev_aggrmat_asb.f90 +++ b/mlprec/impl/mld_s_lev_aggrmat_asb.f90 @@ -88,6 +88,7 @@ subroutine mld_s_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info) use psb_base_mod + use mld_base_prec_type use mld_s_inner_mod, mld_protect_name => mld_s_lev_aggrmat_asb implicit none diff --git a/mlprec/impl/mld_s_smoothers_bld.f90 b/mlprec/impl/mld_s_smoothers_bld.f90 index 4cbfc8af..b6f4e5b9 100644 --- a/mlprec/impl/mld_s_smoothers_bld.f90 +++ b/mlprec/impl/mld_s_smoothers_bld.f90 @@ -79,10 +79,10 @@ ! ! ! -subroutine mld_s_smoothers_bld(a,desc_a,p,info,amold,vmold,imold) +subroutine mld_s_smoothers_bld(a,desc_a,prec,info,amold,vmold,imold) use psb_base_mod - use mld_s_inner_mod + !use mld_s_inner_mod use mld_s_prec_mod, mld_protect_name => mld_s_smoothers_bld Implicit None @@ -90,7 +90,7 @@ subroutine mld_s_smoothers_bld(a,desc_a,p,info,amold,vmold,imold) ! Arguments type(psb_sspmat_type),intent(in), target :: a type(psb_desc_type), intent(inout), target :: desc_a - type(mld_sprec_type),intent(inout),target :: p + class(mld_sprec_type),intent(inout),target :: prec integer(psb_ipk_), intent(out) :: info class(psb_s_base_sparse_mat), intent(in), optional :: amold class(psb_s_base_vect_type), intent(in), optional :: vmold @@ -140,7 +140,7 @@ subroutine mld_s_smoothers_bld(a,desc_a,p,info,amold,vmold,imold) ! !$ endif upd_ = 'F' - if (.not.allocated(p%precv)) then + if (.not.allocated(prec%precv)) then !! Error: should have called mld_sprecinit info=3111 call psb_errpush(info,name) @@ -150,9 +150,9 @@ subroutine mld_s_smoothers_bld(a,desc_a,p,info,amold,vmold,imold) ! ! Check to ensure all procs have the same ! - iszv = size(p%precv) + iszv = size(prec%precv) call psb_bcast(ictxt,iszv) - if (iszv /= size(p%precv)) then + if (iszv /= size(prec%precv)) then info=psb_err_internal_error_ call psb_errpush(info,name,a_err='Inconsistent size of precv') goto 9999 @@ -174,7 +174,7 @@ subroutine mld_s_smoothers_bld(a,desc_a,p,info,amold,vmold,imold) ! ! build the base preconditioner at level i ! - call p%precv(i)%bld(info,amold=amold,vmold=vmold,imold=imold) + call prec%precv(i)%bld(info,amold=amold,vmold=vmold,imold=imold) if (info /= psb_success_) then write(ch_err,'(a,i7)') 'Error @ level',i diff --git a/mlprec/impl/mld_saggrmap_bld.f90 b/mlprec/impl/mld_saggrmap_bld.f90 index 6b615fd3..89984bb0 100644 --- a/mlprec/impl/mld_saggrmap_bld.f90 +++ b/mlprec/impl/mld_saggrmap_bld.f90 @@ -88,6 +88,7 @@ subroutine mld_saggrmap_bld(aggr_type,iorder,theta,a,desc_a,ilaggr,nlaggr,op_prol,info) use psb_base_mod + use mld_base_prec_type use mld_s_inner_mod, mld_protect_name => mld_saggrmap_bld implicit none diff --git a/mlprec/impl/mld_saggrmat_asb.f90 b/mlprec/impl/mld_saggrmat_asb.f90 index 31d6fed3..6806a86b 100644 --- a/mlprec/impl/mld_saggrmat_asb.f90 +++ b/mlprec/impl/mld_saggrmat_asb.f90 @@ -120,6 +120,7 @@ subroutine mld_saggrmat_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info) use psb_base_mod + use mld_base_prec_type use mld_s_inner_mod, mld_protect_name => mld_saggrmat_asb implicit none diff --git a/mlprec/impl/mld_saggrmat_biz_asb.f90 b/mlprec/impl/mld_saggrmat_biz_asb.f90 index 9b4f9eac..d25bd5fb 100644 --- a/mlprec/impl/mld_saggrmat_biz_asb.f90 +++ b/mlprec/impl/mld_saggrmat_biz_asb.f90 @@ -84,6 +84,7 @@ ! subroutine mld_saggrmat_biz_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info) use psb_base_mod + use mld_base_prec_type use mld_s_inner_mod, mld_protect_name => mld_saggrmat_biz_asb implicit none diff --git a/mlprec/impl/mld_saggrmat_minnrg_asb.f90 b/mlprec/impl/mld_saggrmat_minnrg_asb.f90 index f855c886..2dad8188 100644 --- a/mlprec/impl/mld_saggrmat_minnrg_asb.f90 +++ b/mlprec/impl/mld_saggrmat_minnrg_asb.f90 @@ -112,6 +112,7 @@ ! subroutine mld_saggrmat_minnrg_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info) use psb_base_mod + use mld_base_prec_type use mld_s_inner_mod, mld_protect_name => mld_saggrmat_minnrg_asb implicit none diff --git a/mlprec/impl/mld_saggrmat_nosmth_asb.f90 b/mlprec/impl/mld_saggrmat_nosmth_asb.f90 index 6097a0e6..ba99c2a5 100644 --- a/mlprec/impl/mld_saggrmat_nosmth_asb.f90 +++ b/mlprec/impl/mld_saggrmat_nosmth_asb.f90 @@ -100,6 +100,7 @@ ! subroutine mld_saggrmat_nosmth_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info) use psb_base_mod + use mld_base_prec_type use mld_s_inner_mod, mld_protect_name => mld_saggrmat_nosmth_asb implicit none diff --git a/mlprec/impl/mld_saggrmat_smth_asb.f90 b/mlprec/impl/mld_saggrmat_smth_asb.f90 index 488ad6a5..e5d83c7e 100644 --- a/mlprec/impl/mld_saggrmat_smth_asb.f90 +++ b/mlprec/impl/mld_saggrmat_smth_asb.f90 @@ -113,6 +113,7 @@ ! subroutine mld_saggrmat_smth_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info) use psb_base_mod + use mld_base_prec_type use mld_s_inner_mod, mld_protect_name => mld_saggrmat_smth_asb implicit none diff --git a/mlprec/impl/mld_smlprec_aply.f90 b/mlprec/impl/mld_smlprec_aply.f90 index 0fc7b12b..351fef8b 100644 --- a/mlprec/impl/mld_smlprec_aply.f90 +++ b/mlprec/impl/mld_smlprec_aply.f90 @@ -299,6 +299,7 @@ subroutine mld_smlprec_aply_vect(alpha,p,x,beta,y,desc_data,trans,work,info) use psb_base_mod + use mld_base_prec_type use mld_s_inner_mod, mld_protect_name => mld_smlprec_aply_vect implicit none @@ -1303,6 +1304,7 @@ end subroutine mld_smlprec_aply_vect subroutine mld_smlprec_aply(alpha,p,x,beta,y,desc_data,trans,work,info) use psb_base_mod + use mld_base_prec_type use mld_s_inner_mod, mld_protect_name => mld_smlprec_aply implicit none diff --git a/mlprec/impl/mld_smlprec_bld.f90 b/mlprec/impl/mld_smlprec_bld.f90 index c4995324..20674637 100644 --- a/mlprec/impl/mld_smlprec_bld.f90 +++ b/mlprec/impl/mld_smlprec_bld.f90 @@ -123,7 +123,7 @@ subroutine mld_smlprec_bld(a,desc_a,p,info,amold,vmold,imold) & write(debug_unit,*) me,' ',trim(name),& & 'Entering ' - call mld_s_hierarchy_bld(a,desc_a,p,info) + call p%hierarchy_build(a,desc_a,info) if (info /= psb_success_) then info=psb_err_internal_error_ @@ -133,7 +133,7 @@ subroutine mld_smlprec_bld(a,desc_a,p,info,amold,vmold,imold) iszv = p%get_nlevs() - call mld_s_smoothers_bld(a,desc_a,p,info,amold,vmold,imold) + call p%smoothers_build(a,desc_a,info,amold,vmold,imold) if (info /= psb_success_) then info=psb_err_internal_error_ diff --git a/mlprec/impl/mld_sprecaply.f90 b/mlprec/impl/mld_sprecaply.f90 index f49159ba..946001df 100644 --- a/mlprec/impl/mld_sprecaply.f90 +++ b/mlprec/impl/mld_sprecaply.f90 @@ -75,7 +75,7 @@ subroutine mld_sprecaply(prec,x,y,desc_data,info,trans,work) use psb_base_mod - use mld_s_inner_mod, mld_protect_name => mld_sprecaply + use mld_s_inner_mod!, mld_protect_name => mld_sprecaply implicit none @@ -206,7 +206,7 @@ end subroutine mld_sprecaply subroutine mld_sprecaply1(prec,x,desc_data,info,trans) use psb_base_mod - use mld_s_inner_mod, mld_protect_name => mld_sprecaply1 + use mld_s_inner_mod!, mld_protect_name => mld_sprecaply1 implicit none @@ -240,7 +240,7 @@ subroutine mld_sprecaply1(prec,x,desc_data,info,trans) goto 9999 end if - call mld_precaply(prec,x,ww,desc_data,info,trans=trans,work=w1) + call prec%apply(x,ww,desc_data,info,trans=trans,work=w1) if (info /= psb_success_) then call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_precaply') goto 9999 @@ -267,7 +267,7 @@ end subroutine mld_sprecaply1 subroutine mld_sprecaply2_vect(prec,x,y,desc_data,info,trans,work) use psb_base_mod - use mld_s_inner_mod, mld_protect_name => mld_sprecaply2_vect + use mld_s_inner_mod!, mld_protect_name => mld_sprecaply2_vect implicit none @@ -368,7 +368,7 @@ end subroutine mld_sprecaply2_vect subroutine mld_sprecaply1_vect(prec,x,desc_data,info,trans,work) use psb_base_mod - use mld_s_inner_mod, mld_protect_name => mld_sprecaply1_vect + use mld_s_inner_mod!, mld_protect_name => mld_sprecaply1_vect implicit none diff --git a/mlprec/impl/mld_sprecbld.f90 b/mlprec/impl/mld_sprecbld.f90 index e36f743c..c2e865a6 100644 --- a/mlprec/impl/mld_sprecbld.f90 +++ b/mlprec/impl/mld_sprecbld.f90 @@ -59,10 +59,9 @@ ! info - integer, output. ! Error code. ! -subroutine mld_sprecbld(a,desc_a,p,info,amold,vmold,imold) +subroutine mld_sprecbld(a,desc_a,prec,info,amold,vmold,imold) use psb_base_mod - use mld_s_inner_mod use mld_s_prec_mod, mld_protect_name => mld_sprecbld Implicit None @@ -70,7 +69,7 @@ subroutine mld_sprecbld(a,desc_a,p,info,amold,vmold,imold) ! Arguments type(psb_sspmat_type),intent(in), target :: a type(psb_desc_type), intent(inout), target :: desc_a - type(mld_sprec_type),intent(inout), target :: p + class(mld_sprec_type),intent(inout), target :: prec integer(psb_ipk_), intent(out) :: info class(psb_s_base_sparse_mat), intent(in), optional :: amold class(psb_s_base_vect_type), intent(in), optional :: vmold @@ -100,7 +99,7 @@ subroutine mld_sprecbld(a,desc_a,p,info,amold,vmold,imold) int_err(1) = 0 ictxt = desc_a%get_context() call psb_info(ictxt, me, np) - p%ictxt = ictxt + prec%ictxt = ictxt if (debug_level >= psb_debug_outer_) & & write(debug_unit,*) me,' ',trim(name),& @@ -122,7 +121,7 @@ subroutine mld_sprecbld(a,desc_a,p,info,amold,vmold,imold) !!$ endif upd_ = 'F' - if (.not.allocated(p%precv)) then + if (.not.allocated(prec%precv)) then !! Error: should have called mld_sprecinit info=3111 call psb_errpush(info,name) @@ -133,9 +132,9 @@ subroutine mld_sprecbld(a,desc_a,p,info,amold,vmold,imold) ! Check to ensure all procs have the same ! newsz = -1 - iszv = size(p%precv) + iszv = size(prec%precv) call psb_bcast(ictxt,iszv) - if (iszv /= size(p%precv)) then + if (iszv /= size(prec%precv)) then info=psb_err_internal_error_ call psb_errpush(info,name,a_err='Inconsistent size of precv') goto 9999 @@ -157,31 +156,31 @@ subroutine mld_sprecbld(a,desc_a,p,info,amold,vmold,imold) ! Check on the iprcparm contents: they should be the same ! on all processes. ! - call psb_bcast(ictxt,p%precv(1)%parms) + call psb_bcast(ictxt,prec%precv(1)%parms) - p%precv(1)%base_a => a - p%precv(1)%base_desc => desc_a + prec%precv(1)%base_a => a + prec%precv(1)%base_desc => desc_a if (info /= psb_success_) then call psb_errpush(psb_err_internal_error_,name,a_err='Base level precbuild.') goto 9999 end if - call p%precv(1)%check(info) - if (info /= psb_success_) then - write(0,*) ' Smoother check error',info - call psb_errpush(psb_err_internal_error_,name,& - & a_err='One level preconditioner check.') - goto 9999 - endif - - call p%precv(1)%sm%build(a,desc_a,upd_,info,& - & amold=amold,vmold=vmold,imold=imold) - if (info /= psb_success_) then - call psb_errpush(psb_err_internal_error_,name,& - & a_err='One level preconditioner build.') - goto 9999 - endif + call prec%precv(1)%check(info) + if (info /= psb_success_) then + write(0,*) ' Smoother check error',info + call psb_errpush(psb_err_internal_error_,name,& + & a_err='One level preconditioner check.') + goto 9999 + endif + + call prec%precv(1)%sm%build(a,desc_a,upd_,info,& + & amold=amold,vmold=vmold,imold=imold) + if (info /= psb_success_) then + call psb_errpush(psb_err_internal_error_,name,& + & a_err='One level preconditioner build.') + goto 9999 + endif ! ! Number of levels > 1 @@ -190,16 +189,25 @@ subroutine mld_sprecbld(a,desc_a,p,info,amold,vmold,imold) ! ! Build the multilevel preconditioner ! - call mld_mlprec_bld(a,desc_a,p,info,& - & amold=amold,vmold=vmold,imold=imold) + call prec%hierarchy_build(a,desc_a,info) if (info /= psb_success_) then - call psb_errpush(psb_err_internal_error_,name,& - & a_err='Multilevel preconditioner build.') + info=psb_err_internal_error_ + call psb_errpush(info,name,a_err='Error from hierarchy build') goto 9999 - endif + end if + + + call prec%smoothers_build(a,desc_a,info,amold,vmold,imold) + + if (info /= psb_success_) then + info=psb_err_internal_error_ + call psb_errpush(info,name,a_err='Error from smoothers build') + goto 9999 + end if + end if - + call psb_erractionrestore(err_act) return diff --git a/mlprec/impl/mld_sprecinit.F90 b/mlprec/impl/mld_sprecinit.F90 index 3a224683..427f3a0c 100644 --- a/mlprec/impl/mld_sprecinit.F90 +++ b/mlprec/impl/mld_sprecinit.F90 @@ -84,12 +84,8 @@ ! lowercase strings). ! info - integer, output. ! Error code. -! nlev - integer, optional, input. -! The number of levels of the multilevel preconditioner. -! If nlev is not present and ptype='ML', then nlev=2 -! is assumed. If ptype /= 'ML', nlev is ignored. ! -subroutine mld_sprecinit(p,ptype,info,nlev) +subroutine mld_sprecinit(prec,ptype,info) use psb_base_mod use mld_s_prec_mod, mld_protect_name => mld_sprecinit @@ -106,10 +102,9 @@ subroutine mld_sprecinit(p,ptype,info,nlev) implicit none ! Arguments - type(mld_sprec_type), intent(inout) :: p + class(mld_sprec_type), intent(inout) :: prec character(len=*), intent(in) :: ptype integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: nlev ! Local variables integer(psb_ipk_) :: nlev_, ilev_ @@ -117,97 +112,92 @@ subroutine mld_sprecinit(p,ptype,info,nlev) character(len=*), parameter :: name='mld_precinit' info = psb_success_ - if (allocated(p%precv)) then - call mld_precfree(p,info) + if (allocated(prec%precv)) then + call prec%free(info) if (info /= psb_success_) then ! Do we want to do something? endif endif - p%coarse_aggr_size = -1 + prec%coarse_aggr_size = -1 select case(psb_toupper(ptype(1:len_trim(ptype)))) case ('NOPREC','NONE') nlev_ = 1 ilev_ = 1 - allocate(p%precv(nlev_),stat=info) - allocate(mld_s_base_smoother_type :: p%precv(ilev_)%sm, stat=info) + allocate(prec%precv(nlev_),stat=info) + allocate(mld_s_base_smoother_type :: prec%precv(ilev_)%sm, stat=info) if (info /= psb_success_) return - allocate(mld_s_id_solver_type :: p%precv(ilev_)%sm%sv, stat=info) - call p%precv(ilev_)%default() + allocate(mld_s_id_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) + call prec%precv(ilev_)%default() case ('JAC','DIAG','JACOBI') nlev_ = 1 ilev_ = 1 - allocate(p%precv(nlev_),stat=info) - allocate(mld_s_jac_smoother_type :: p%precv(ilev_)%sm, stat=info) + allocate(prec%precv(nlev_),stat=info) + allocate(mld_s_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info) if (info /= psb_success_) return - allocate(mld_s_diag_solver_type :: p%precv(ilev_)%sm%sv, stat=info) - call p%precv(ilev_)%default() + allocate(mld_s_diag_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) + call prec%precv(ilev_)%default() case ('BJAC') nlev_ = 1 ilev_ = 1 - allocate(p%precv(nlev_),stat=info) - allocate(mld_s_jac_smoother_type :: p%precv(ilev_)%sm, stat=info) + allocate(prec%precv(nlev_),stat=info) + allocate(mld_s_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info) if (info /= psb_success_) return - allocate(mld_s_ilu_solver_type :: p%precv(ilev_)%sm%sv, stat=info) - call p%precv(ilev_)%default() + allocate(mld_s_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) + call prec%precv(ilev_)%default() case ('AS') nlev_ = 1 ilev_ = 1 - allocate(p%precv(nlev_),stat=info) - allocate(mld_s_as_smoother_type :: p%precv(ilev_)%sm, stat=info) + allocate(prec%precv(nlev_),stat=info) + allocate(mld_s_as_smoother_type :: prec%precv(ilev_)%sm, stat=info) if (info /= psb_success_) return - allocate(mld_s_ilu_solver_type :: p%precv(ilev_)%sm%sv, stat=info) - call p%precv(ilev_)%default() + allocate(mld_s_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) + call prec%precv(ilev_)%default() case ('ML') - if (present(nlev)) then - nlev_ = max(1,nlev) - p%max_prec_levs = nlev_ - else - nlev_ = p%max_prec_levs - end if + nlev_ = prec%max_prec_levs ilev_ = 1 - allocate(p%precv(nlev_),stat=info) - allocate(mld_s_as_smoother_type :: p%precv(ilev_)%sm, stat=info) + allocate(prec%precv(nlev_),stat=info) + allocate(mld_s_as_smoother_type :: prec%precv(ilev_)%sm, stat=info) if (info /= psb_success_) return - allocate(mld_s_ilu_solver_type :: p%precv(ilev_)%sm%sv, stat=info) - call p%precv(ilev_)%default() + allocate(mld_s_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) + call prec%precv(ilev_)%default() if (nlev_ == 1) return do ilev_ = 2, nlev_ -1 - allocate(mld_s_as_smoother_type :: p%precv(ilev_)%sm, stat=info) + allocate(mld_s_as_smoother_type :: prec%precv(ilev_)%sm, stat=info) if (info /= psb_success_) return - allocate(mld_s_ilu_solver_type :: p%precv(ilev_)%sm%sv, stat=info) - call p%precv(ilev_)%default() + allocate(mld_s_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) + call prec%precv(ilev_)%default() end do ilev_ = nlev_ - allocate(mld_s_jac_smoother_type :: p%precv(ilev_)%sm, stat=info) + allocate(mld_s_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info) if (info /= psb_success_) return #if defined(HAVE_SLU_) - allocate(mld_s_slu_solver_type :: p%precv(ilev_)%sm%sv, stat=info) + allocate(mld_s_slu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) #else - allocate(mld_s_ilu_solver_type :: p%precv(ilev_)%sm%sv, stat=info) + allocate(mld_s_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) #endif - call p%precv(ilev_)%default() - p%precv(ilev_)%parms%coarse_solve = mld_bjac_ - call p%precv(ilev_)%set(mld_smoother_sweeps_,4_psb_ipk_,info) - call p%precv(ilev_)%set(mld_sub_restr_,psb_none_,info) - call p%precv(ilev_)%set(mld_sub_prol_,psb_none_,info) - call p%precv(ilev_)%set(mld_sub_ovr_,izero,info) + call prec%precv(ilev_)%default() + prec%precv(ilev_)%parms%coarse_solve = mld_bjac_ + call prec%precv(ilev_)%set(mld_smoother_sweeps_,4_psb_ipk_,info) + call prec%precv(ilev_)%set(mld_sub_restr_,psb_none_,info) + call prec%precv(ilev_)%set(mld_sub_prol_,psb_none_,info) + call prec%precv(ilev_)%set(mld_sub_ovr_,izero,info) thr = 0.05_psb_spk_ scale = 1.0_psb_spk_ do ilev_=1,nlev_ - call p%precv(ilev_)%set(mld_aggr_thresh_,thr,info) - call p%precv(ilev_)%set(mld_aggr_scale_,scale,info) - call p%precv(ilev_)%set(mld_aggr_filter_,mld_filter_mat_,info) + call prec%precv(ilev_)%set(mld_aggr_thresh_,thr,info) + call prec%precv(ilev_)%set(mld_aggr_scale_,scale,info) + call prec%precv(ilev_)%set(mld_aggr_filter_,mld_filter_mat_,info) end do case default diff --git a/mlprec/impl/mld_z_dec_map_bld.f90 b/mlprec/impl/mld_z_dec_map_bld.f90 index 965ac732..e738b62e 100644 --- a/mlprec/impl/mld_z_dec_map_bld.f90 +++ b/mlprec/impl/mld_z_dec_map_bld.f90 @@ -72,6 +72,7 @@ subroutine mld_z_dec_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info) use psb_base_mod + use mld_base_prec_type use mld_z_inner_mod, mld_protect_name => mld_z_dec_map_bld implicit none diff --git a/mlprec/impl/mld_z_hierarchy_bld.f90 b/mlprec/impl/mld_z_hierarchy_bld.f90 index 91904f9f..19b2537d 100644 --- a/mlprec/impl/mld_z_hierarchy_bld.f90 +++ b/mlprec/impl/mld_z_hierarchy_bld.f90 @@ -65,7 +65,7 @@ ! info - integer, output. ! Error code. ! -subroutine mld_z_hierarchy_bld(a,desc_a,p,info) +subroutine mld_z_hierarchy_bld(a,desc_a,prec,info) use psb_base_mod use mld_z_inner_mod @@ -76,7 +76,7 @@ subroutine mld_z_hierarchy_bld(a,desc_a,p,info) ! Arguments type(psb_zspmat_type),intent(in), target :: a type(psb_desc_type), intent(inout), target :: desc_a - type(mld_zprec_type),intent(inout),target :: p + class(mld_zprec_type),intent(inout),target :: prec integer(psb_ipk_), intent(out) :: info !!$ character, intent(in), optional :: upd @@ -106,7 +106,7 @@ subroutine mld_z_hierarchy_bld(a,desc_a,p,info) int_err(1) = 0 ictxt = desc_a%get_context() call psb_info(ictxt, me, np) - p%ictxt = ictxt + prec%ictxt = ictxt if (debug_level >= psb_debug_outer_) & & write(debug_unit,*) me,' ',trim(name),& & 'Entering ' @@ -127,7 +127,7 @@ subroutine mld_z_hierarchy_bld(a,desc_a,p,info) ! !$ endif upd_ = 'F' - if (.not.allocated(p%precv)) then + if (.not.allocated(prec%precv)) then !! Error: should have called mld_zprecinit info=3111 call psb_errpush(info,name) @@ -138,31 +138,31 @@ subroutine mld_z_hierarchy_bld(a,desc_a,p,info) ! Check to ensure all procs have the same ! newsz = -1 - casize = p%coarse_aggr_size - mxplevs = p%max_prec_levs - mnaggratio = p%min_aggr_ratio - casize = p%coarse_aggr_size - iszv = size(p%precv) + casize = prec%coarse_aggr_size + mxplevs = prec%max_prec_levs + mnaggratio = prec%min_aggr_ratio + casize = prec%coarse_aggr_size + iszv = size(prec%precv) call psb_bcast(ictxt,iszv) call psb_bcast(ictxt,casize) call psb_bcast(ictxt,mxplevs) call psb_bcast(ictxt,mnaggratio) - if (casize /= p%coarse_aggr_size) then + if (casize /= prec%coarse_aggr_size) then info=psb_err_internal_error_ call psb_errpush(info,name,a_err='Inconsistent coarse_aggr_size') goto 9999 end if - if (mxplevs /= p%max_prec_levs) then + if (mxplevs /= prec%max_prec_levs) then info=psb_err_internal_error_ call psb_errpush(info,name,a_err='Inconsistent max_prec_levs') goto 9999 end if - if (mnaggratio /= p%min_aggr_ratio) then + if (mnaggratio /= prec%min_aggr_ratio) then info=psb_err_internal_error_ call psb_errpush(info,name,a_err='Inconsistent min_aggr_ratio') goto 9999 end if - if (iszv /= size(p%precv)) then + if (iszv /= size(prec%precv)) then info=psb_err_internal_error_ call psb_errpush(info,name,a_err='Inconsistent size of precv') goto 9999 @@ -182,8 +182,8 @@ subroutine mld_z_hierarchy_bld(a,desc_a,p,info) ! This is OK, since it may be called by the user even if there ! is only one level ! - p%precv(1)%base_a => a - p%precv(1)%base_desc => desc_a + prec%precv(1)%base_a => a + prec%precv(1)%base_desc => desc_a call psb_erractionrestore(err_act) return @@ -213,13 +213,13 @@ subroutine mld_z_hierarchy_bld(a,desc_a,p,info) end if nplevs = max(itwo,mxplevs) - coarseparms = p%precv(iszv)%parms - baseparms = p%precv(1)%parms - medparms = p%precv(2)%parms + coarseparms = prec%precv(iszv)%parms + baseparms = prec%precv(1)%parms + medparms = prec%precv(2)%parms - call save_smoothers(p%precv(iszv),coarse_sm,coarse_sm2,info) - if (info == 0) call save_smoothers(p%precv(2),med_sm,med_sm2,info) - if (info == 0) call save_smoothers(p%precv(1),base_sm,base_sm2,info) + call save_smoothers(prec%precv(iszv),coarse_sm,coarse_sm2,info) + if (info == 0) call save_smoothers(prec%precv(2),med_sm,med_sm2,info) + if (info == 0) call save_smoothers(prec%precv(1),base_sm,base_sm2,info) if (info /= psb_success_) then write(0,*) 'Error in saving smoothers',info call psb_errpush(psb_err_internal_error_,name,a_err='Base level precbuild.') @@ -232,10 +232,10 @@ subroutine mld_z_hierarchy_bld(a,desc_a,p,info) allocate(tprecv(nplevs),stat=info) ! First all existing levels if (info == 0) tprecv(1)%parms = baseparms - if (info == 0) call restore_smoothers(tprecv(1),p%precv(1)%sm,p%precv(1)%sm2a,info) + if (info == 0) call restore_smoothers(tprecv(1),prec%precv(1)%sm,prec%precv(1)%sm2a,info) do i=2, min(iszv,nplevs) - 1 if (info == 0) tprecv(i)%parms = medparms - if (info == 0) call restore_smoothers(tprecv(i),p%precv(i)%sm,p%precv(i)%sm2a,info) + if (info == 0) call restore_smoothers(tprecv(i),prec%precv(i)%sm,prec%precv(i)%sm2a,info) end do ! Further intermediates, if any do i=iszv-1, nplevs - 1 @@ -252,24 +252,24 @@ subroutine mld_z_hierarchy_bld(a,desc_a,p,info) endif do i=1,iszv - call p%precv(i)%free(info) + call prec%precv(i)%free(info) end do - call move_alloc(tprecv,p%precv) - iszv = size(p%precv) + call move_alloc(tprecv,prec%precv) + iszv = size(prec%precv) end if ! ! Finest level first; remember to fix base_a and base_desc ! - p%precv(1)%base_a => a - p%precv(1)%base_desc => desc_a + prec%precv(1)%base_a => a + prec%precv(1)%base_desc => desc_a newsz = 0 array_build_loop: do i=2, iszv ! ! Check on the iprcparm contents: they should be the same ! on all processes. ! - call psb_bcast(ictxt,p%precv(i)%parms) + call psb_bcast(ictxt,prec%precv(i)%parms) ! ! Sanity checks on the parameters @@ -278,7 +278,7 @@ subroutine mld_z_hierarchy_bld(a,desc_a,p,info) ! ! A replicated matrix only makes sense at the coarsest level ! - call mld_check_def(p%precv(i)%parms%coarse_mat,'Coarse matrix',& + call mld_check_def(prec%precv(i)%parms%coarse_mat,'Coarse matrix',& & mld_distr_mat_,is_distr_ml_coarse_mat) end if @@ -289,8 +289,8 @@ subroutine mld_z_hierarchy_bld(a,desc_a,p,info) ! Build the mapping between levels i-1 and i and the matrix ! at level i ! - if (info == psb_success_) call mld_aggrmap_bld(p%precv(i),& - & p%precv(i-1)%base_a,p%precv(i-1)%base_desc,& + if (info == psb_success_) call mld_aggrmap_bld(prec%precv(i),& + & prec%precv(i-1)%base_a,prec%precv(i-1)%base_desc,& & ilaggr,nlaggr,op_prol,info) if (info /= psb_success_) then @@ -305,7 +305,7 @@ subroutine mld_z_hierarchy_bld(a,desc_a,p,info) ! ! Save op_prol just in case ! - call op_prol%clone(p%precv(i)%tprol,info) + call op_prol%clone(prec%precv(i)%tprol,info) ! ! Check for early termination of aggregation loop. ! @@ -315,9 +315,9 @@ subroutine mld_z_hierarchy_bld(a,desc_a,p,info) if (i==2) then sizeratio = desc_a%get_global_rows()/sizeratio else - sizeratio = sum(p%precv(i-1)%map%naggr)/sizeratio + sizeratio = sum(prec%precv(i-1)%map%naggr)/sizeratio end if - p%precv(i)%szratio = sizeratio + prec%precv(i)%szratio = sizeratio if (iaggsize <= casize) then newsz = i end if @@ -334,7 +334,7 @@ subroutine mld_z_hierarchy_bld(a,desc_a,p,info) end if end if - if (all(nlaggr == p%precv(i-1)%map%naggr)) then + if (all(nlaggr == prec%precv(i-1)%map%naggr)) then newsz=i-1 if (me == 0) then write(debug_unit,*) trim(name),& @@ -356,27 +356,27 @@ subroutine mld_z_hierarchy_bld(a,desc_a,p,info) ! This is awkward, we are saving the aggregation parms, for the sake ! of distr/repl matrix at coarse level. Should be rethought. ! - athresh = p%precv(newsz)%parms%aggr_thresh - ascale = p%precv(newsz)%parms%aggr_scale - aomega = p%precv(newsz)%parms%aggr_omega_val - if (info == 0) p%precv(newsz)%parms = coarseparms - p%precv(newsz)%parms%aggr_thresh = athresh - p%precv(newsz)%parms%aggr_scale = ascale - p%precv(newsz)%parms%aggr_omega_val = aomega + athresh = prec%precv(newsz)%parms%aggr_thresh + ascale = prec%precv(newsz)%parms%aggr_scale + aomega = prec%precv(newsz)%parms%aggr_omega_val + if (info == 0) prec%precv(newsz)%parms = coarseparms + prec%precv(newsz)%parms%aggr_thresh = athresh + prec%precv(newsz)%parms%aggr_scale = ascale + prec%precv(newsz)%parms%aggr_omega_val = aomega - if (info == 0) call restore_smoothers(p%precv(newsz),coarse_sm,coarse_sm2,info) + if (info == 0) call restore_smoothers(prec%precv(newsz),coarse_sm,coarse_sm2,info) if (newsz < i) then ! ! We are going back and revisit a previous leve; ! recover the aggregation. ! - ilaggr = p%precv(newsz)%map%iaggr - nlaggr = p%precv(newsz)%map%naggr - call p%precv(newsz)%tprol%clone(op_prol,info) + ilaggr = prec%precv(newsz)%map%iaggr + nlaggr = prec%precv(newsz)%map%naggr + call prec%precv(newsz)%tprol%clone(op_prol,info) end if - if (info == psb_success_) call mld_lev_mat_asb(p%precv(newsz),& - & p%precv(newsz-1)%base_a,p%precv(newsz-1)%base_desc,& + if (info == psb_success_) call mld_lev_mat_asb(prec%precv(newsz),& + & prec%precv(newsz-1)%base_a,prec%precv(newsz-1)%base_desc,& & ilaggr,nlaggr,op_prol,info) if (info /= 0) then call psb_errpush(psb_err_internal_error_,name,& @@ -385,8 +385,8 @@ subroutine mld_z_hierarchy_bld(a,desc_a,p,info) endif exit array_build_loop else - if (info == psb_success_) call mld_lev_mat_asb(p%precv(i),& - & p%precv(i-1)%base_a,p%precv(i-1)%base_desc,& + if (info == psb_success_) call mld_lev_mat_asb(prec%precv(i),& + & prec%precv(i-1)%base_a,prec%precv(i-1)%base_desc,& & ilaggr,nlaggr,op_prol,info) end if if (info /= psb_success_) then @@ -409,12 +409,12 @@ subroutine mld_z_hierarchy_bld(a,desc_a,p,info) goto 9999 endif do i=1,newsz - call p%precv(i)%move_alloc(tprecv(i),info) + call prec%precv(i)%move_alloc(tprecv(i),info) end do do i=newsz+1, iszv - call p%precv(i)%free(info) + call prec%precv(i)%free(info) end do - call move_alloc(tprecv,p%precv) + call move_alloc(tprecv,prec%precv) ! Ignore errors from transfer info = psb_success_ ! @@ -423,10 +423,10 @@ subroutine mld_z_hierarchy_bld(a,desc_a,p,info) ! Fix the pointers, but the level 1 should ! be already OK do i=2, iszv - p%precv(i)%base_a => p%precv(i)%ac - p%precv(i)%base_desc => p%precv(i)%desc_ac - p%precv(i)%map%p_desc_X => p%precv(i-1)%base_desc - p%precv(i)%map%p_desc_Y => p%precv(i)%base_desc + prec%precv(i)%base_a => prec%precv(i)%ac + prec%precv(i)%base_desc => prec%precv(i)%desc_ac + prec%precv(i)%map%p_desc_X => prec%precv(i-1)%base_desc + prec%precv(i)%map%p_desc_Y => prec%precv(i)%base_desc end do end if @@ -436,9 +436,9 @@ subroutine mld_z_hierarchy_bld(a,desc_a,p,info) goto 9999 endif - iszv = size(p%precv) + iszv = size(prec%precv) - call p%cmp_complexity() + call prec%cmp_complexity() if (debug_level >= psb_debug_outer_) & & write(debug_unit,*) me,' ',trim(name),& diff --git a/mlprec/impl/mld_z_lev_aggrmap_bld.f90 b/mlprec/impl/mld_z_lev_aggrmap_bld.f90 index 828add71..10e7acc7 100644 --- a/mlprec/impl/mld_z_lev_aggrmap_bld.f90 +++ b/mlprec/impl/mld_z_lev_aggrmap_bld.f90 @@ -1,3 +1,4 @@ + ! ! ! MLD2P4 version 2.1 @@ -77,6 +78,7 @@ subroutine mld_z_lev_aggrmap_bld(p,a,desc_a,ilaggr,nlaggr,op_prol,info) use psb_base_mod + use mld_base_prec_type use mld_z_inner_mod, mld_protect_name => mld_z_lev_aggrmap_bld implicit none diff --git a/mlprec/impl/mld_z_lev_aggrmat_asb.f90 b/mlprec/impl/mld_z_lev_aggrmat_asb.f90 index 5e8db248..45c806e4 100644 --- a/mlprec/impl/mld_z_lev_aggrmat_asb.f90 +++ b/mlprec/impl/mld_z_lev_aggrmat_asb.f90 @@ -88,6 +88,7 @@ subroutine mld_z_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info) use psb_base_mod + use mld_base_prec_type use mld_z_inner_mod, mld_protect_name => mld_z_lev_aggrmat_asb implicit none diff --git a/mlprec/impl/mld_z_smoothers_bld.f90 b/mlprec/impl/mld_z_smoothers_bld.f90 index 3ada3a3b..2fbaa5a6 100644 --- a/mlprec/impl/mld_z_smoothers_bld.f90 +++ b/mlprec/impl/mld_z_smoothers_bld.f90 @@ -79,10 +79,10 @@ ! ! ! -subroutine mld_z_smoothers_bld(a,desc_a,p,info,amold,vmold,imold) +subroutine mld_z_smoothers_bld(a,desc_a,prec,info,amold,vmold,imold) use psb_base_mod - use mld_z_inner_mod + !use mld_z_inner_mod use mld_z_prec_mod, mld_protect_name => mld_z_smoothers_bld Implicit None @@ -90,7 +90,7 @@ subroutine mld_z_smoothers_bld(a,desc_a,p,info,amold,vmold,imold) ! Arguments type(psb_zspmat_type),intent(in), target :: a type(psb_desc_type), intent(inout), target :: desc_a - type(mld_zprec_type),intent(inout),target :: p + class(mld_zprec_type),intent(inout),target :: prec integer(psb_ipk_), intent(out) :: info class(psb_z_base_sparse_mat), intent(in), optional :: amold class(psb_z_base_vect_type), intent(in), optional :: vmold @@ -140,7 +140,7 @@ subroutine mld_z_smoothers_bld(a,desc_a,p,info,amold,vmold,imold) ! !$ endif upd_ = 'F' - if (.not.allocated(p%precv)) then + if (.not.allocated(prec%precv)) then !! Error: should have called mld_zprecinit info=3111 call psb_errpush(info,name) @@ -150,9 +150,9 @@ subroutine mld_z_smoothers_bld(a,desc_a,p,info,amold,vmold,imold) ! ! Check to ensure all procs have the same ! - iszv = size(p%precv) + iszv = size(prec%precv) call psb_bcast(ictxt,iszv) - if (iszv /= size(p%precv)) then + if (iszv /= size(prec%precv)) then info=psb_err_internal_error_ call psb_errpush(info,name,a_err='Inconsistent size of precv') goto 9999 @@ -174,7 +174,7 @@ subroutine mld_z_smoothers_bld(a,desc_a,p,info,amold,vmold,imold) ! ! build the base preconditioner at level i ! - call p%precv(i)%bld(info,amold=amold,vmold=vmold,imold=imold) + call prec%precv(i)%bld(info,amold=amold,vmold=vmold,imold=imold) if (info /= psb_success_) then write(ch_err,'(a,i7)') 'Error @ level',i diff --git a/mlprec/impl/mld_zaggrmap_bld.f90 b/mlprec/impl/mld_zaggrmap_bld.f90 index 706bd778..8f7eb4d3 100644 --- a/mlprec/impl/mld_zaggrmap_bld.f90 +++ b/mlprec/impl/mld_zaggrmap_bld.f90 @@ -88,6 +88,7 @@ subroutine mld_zaggrmap_bld(aggr_type,iorder,theta,a,desc_a,ilaggr,nlaggr,op_prol,info) use psb_base_mod + use mld_base_prec_type use mld_z_inner_mod, mld_protect_name => mld_zaggrmap_bld implicit none diff --git a/mlprec/impl/mld_zaggrmat_asb.f90 b/mlprec/impl/mld_zaggrmat_asb.f90 index 69f8a2d7..b1525418 100644 --- a/mlprec/impl/mld_zaggrmat_asb.f90 +++ b/mlprec/impl/mld_zaggrmat_asb.f90 @@ -120,6 +120,7 @@ subroutine mld_zaggrmat_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info) use psb_base_mod + use mld_base_prec_type use mld_z_inner_mod, mld_protect_name => mld_zaggrmat_asb implicit none diff --git a/mlprec/impl/mld_zaggrmat_biz_asb.f90 b/mlprec/impl/mld_zaggrmat_biz_asb.f90 index b0c154dd..d3236d36 100644 --- a/mlprec/impl/mld_zaggrmat_biz_asb.f90 +++ b/mlprec/impl/mld_zaggrmat_biz_asb.f90 @@ -84,6 +84,7 @@ ! subroutine mld_zaggrmat_biz_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info) use psb_base_mod + use mld_base_prec_type use mld_z_inner_mod, mld_protect_name => mld_zaggrmat_biz_asb implicit none diff --git a/mlprec/impl/mld_zaggrmat_minnrg_asb.f90 b/mlprec/impl/mld_zaggrmat_minnrg_asb.f90 index 314fcd94..9f9d7e18 100644 --- a/mlprec/impl/mld_zaggrmat_minnrg_asb.f90 +++ b/mlprec/impl/mld_zaggrmat_minnrg_asb.f90 @@ -112,6 +112,7 @@ ! subroutine mld_zaggrmat_minnrg_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info) use psb_base_mod + use mld_base_prec_type use mld_z_inner_mod, mld_protect_name => mld_zaggrmat_minnrg_asb implicit none diff --git a/mlprec/impl/mld_zaggrmat_nosmth_asb.f90 b/mlprec/impl/mld_zaggrmat_nosmth_asb.f90 index 474ff222..977d1cf7 100644 --- a/mlprec/impl/mld_zaggrmat_nosmth_asb.f90 +++ b/mlprec/impl/mld_zaggrmat_nosmth_asb.f90 @@ -100,6 +100,7 @@ ! subroutine mld_zaggrmat_nosmth_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info) use psb_base_mod + use mld_base_prec_type use mld_z_inner_mod, mld_protect_name => mld_zaggrmat_nosmth_asb implicit none diff --git a/mlprec/impl/mld_zaggrmat_smth_asb.f90 b/mlprec/impl/mld_zaggrmat_smth_asb.f90 index 92825e22..2dddf177 100644 --- a/mlprec/impl/mld_zaggrmat_smth_asb.f90 +++ b/mlprec/impl/mld_zaggrmat_smth_asb.f90 @@ -113,6 +113,7 @@ ! subroutine mld_zaggrmat_smth_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info) use psb_base_mod + use mld_base_prec_type use mld_z_inner_mod, mld_protect_name => mld_zaggrmat_smth_asb implicit none diff --git a/mlprec/impl/mld_zmlprec_aply.f90 b/mlprec/impl/mld_zmlprec_aply.f90 index 22e396f6..56b2ad54 100644 --- a/mlprec/impl/mld_zmlprec_aply.f90 +++ b/mlprec/impl/mld_zmlprec_aply.f90 @@ -299,6 +299,7 @@ subroutine mld_zmlprec_aply_vect(alpha,p,x,beta,y,desc_data,trans,work,info) use psb_base_mod + use mld_base_prec_type use mld_z_inner_mod, mld_protect_name => mld_zmlprec_aply_vect implicit none @@ -1303,6 +1304,7 @@ end subroutine mld_zmlprec_aply_vect subroutine mld_zmlprec_aply(alpha,p,x,beta,y,desc_data,trans,work,info) use psb_base_mod + use mld_base_prec_type use mld_z_inner_mod, mld_protect_name => mld_zmlprec_aply implicit none diff --git a/mlprec/impl/mld_zmlprec_bld.f90 b/mlprec/impl/mld_zmlprec_bld.f90 index 6b2c7af3..58349f14 100644 --- a/mlprec/impl/mld_zmlprec_bld.f90 +++ b/mlprec/impl/mld_zmlprec_bld.f90 @@ -123,7 +123,7 @@ subroutine mld_zmlprec_bld(a,desc_a,p,info,amold,vmold,imold) & write(debug_unit,*) me,' ',trim(name),& & 'Entering ' - call mld_z_hierarchy_bld(a,desc_a,p,info) + call p%hierarchy_build(a,desc_a,info) if (info /= psb_success_) then info=psb_err_internal_error_ @@ -133,7 +133,7 @@ subroutine mld_zmlprec_bld(a,desc_a,p,info,amold,vmold,imold) iszv = p%get_nlevs() - call mld_z_smoothers_bld(a,desc_a,p,info,amold,vmold,imold) + call p%smoothers_build(a,desc_a,info,amold,vmold,imold) if (info /= psb_success_) then info=psb_err_internal_error_ diff --git a/mlprec/impl/mld_zprecaply.f90 b/mlprec/impl/mld_zprecaply.f90 index 1b5732cb..96d32a2a 100644 --- a/mlprec/impl/mld_zprecaply.f90 +++ b/mlprec/impl/mld_zprecaply.f90 @@ -75,7 +75,7 @@ subroutine mld_zprecaply(prec,x,y,desc_data,info,trans,work) use psb_base_mod - use mld_z_inner_mod, mld_protect_name => mld_zprecaply + use mld_z_inner_mod!, mld_protect_name => mld_zprecaply implicit none @@ -206,7 +206,7 @@ end subroutine mld_zprecaply subroutine mld_zprecaply1(prec,x,desc_data,info,trans) use psb_base_mod - use mld_z_inner_mod, mld_protect_name => mld_zprecaply1 + use mld_z_inner_mod!, mld_protect_name => mld_zprecaply1 implicit none @@ -240,7 +240,7 @@ subroutine mld_zprecaply1(prec,x,desc_data,info,trans) goto 9999 end if - call mld_precaply(prec,x,ww,desc_data,info,trans=trans,work=w1) + call prec%apply(x,ww,desc_data,info,trans=trans,work=w1) if (info /= psb_success_) then call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_precaply') goto 9999 @@ -267,7 +267,7 @@ end subroutine mld_zprecaply1 subroutine mld_zprecaply2_vect(prec,x,y,desc_data,info,trans,work) use psb_base_mod - use mld_z_inner_mod, mld_protect_name => mld_zprecaply2_vect + use mld_z_inner_mod!, mld_protect_name => mld_zprecaply2_vect implicit none @@ -368,7 +368,7 @@ end subroutine mld_zprecaply2_vect subroutine mld_zprecaply1_vect(prec,x,desc_data,info,trans,work) use psb_base_mod - use mld_z_inner_mod, mld_protect_name => mld_zprecaply1_vect + use mld_z_inner_mod!, mld_protect_name => mld_zprecaply1_vect implicit none diff --git a/mlprec/impl/mld_zprecbld.f90 b/mlprec/impl/mld_zprecbld.f90 index 1632334a..6e9a12d9 100644 --- a/mlprec/impl/mld_zprecbld.f90 +++ b/mlprec/impl/mld_zprecbld.f90 @@ -59,10 +59,9 @@ ! info - integer, output. ! Error code. ! -subroutine mld_zprecbld(a,desc_a,p,info,amold,vmold,imold) +subroutine mld_zprecbld(a,desc_a,prec,info,amold,vmold,imold) use psb_base_mod - use mld_z_inner_mod use mld_z_prec_mod, mld_protect_name => mld_zprecbld Implicit None @@ -70,7 +69,7 @@ subroutine mld_zprecbld(a,desc_a,p,info,amold,vmold,imold) ! Arguments type(psb_zspmat_type),intent(in), target :: a type(psb_desc_type), intent(inout), target :: desc_a - type(mld_zprec_type),intent(inout), target :: p + class(mld_zprec_type),intent(inout), target :: prec integer(psb_ipk_), intent(out) :: info class(psb_z_base_sparse_mat), intent(in), optional :: amold class(psb_z_base_vect_type), intent(in), optional :: vmold @@ -100,7 +99,7 @@ subroutine mld_zprecbld(a,desc_a,p,info,amold,vmold,imold) int_err(1) = 0 ictxt = desc_a%get_context() call psb_info(ictxt, me, np) - p%ictxt = ictxt + prec%ictxt = ictxt if (debug_level >= psb_debug_outer_) & & write(debug_unit,*) me,' ',trim(name),& @@ -122,7 +121,7 @@ subroutine mld_zprecbld(a,desc_a,p,info,amold,vmold,imold) !!$ endif upd_ = 'F' - if (.not.allocated(p%precv)) then + if (.not.allocated(prec%precv)) then !! Error: should have called mld_zprecinit info=3111 call psb_errpush(info,name) @@ -133,9 +132,9 @@ subroutine mld_zprecbld(a,desc_a,p,info,amold,vmold,imold) ! Check to ensure all procs have the same ! newsz = -1 - iszv = size(p%precv) + iszv = size(prec%precv) call psb_bcast(ictxt,iszv) - if (iszv /= size(p%precv)) then + if (iszv /= size(prec%precv)) then info=psb_err_internal_error_ call psb_errpush(info,name,a_err='Inconsistent size of precv') goto 9999 @@ -157,31 +156,31 @@ subroutine mld_zprecbld(a,desc_a,p,info,amold,vmold,imold) ! Check on the iprcparm contents: they should be the same ! on all processes. ! - call psb_bcast(ictxt,p%precv(1)%parms) + call psb_bcast(ictxt,prec%precv(1)%parms) - p%precv(1)%base_a => a - p%precv(1)%base_desc => desc_a + prec%precv(1)%base_a => a + prec%precv(1)%base_desc => desc_a if (info /= psb_success_) then call psb_errpush(psb_err_internal_error_,name,a_err='Base level precbuild.') goto 9999 end if - call p%precv(1)%check(info) - if (info /= psb_success_) then - write(0,*) ' Smoother check error',info - call psb_errpush(psb_err_internal_error_,name,& - & a_err='One level preconditioner check.') - goto 9999 - endif - - call p%precv(1)%sm%build(a,desc_a,upd_,info,& - & amold=amold,vmold=vmold,imold=imold) - if (info /= psb_success_) then - call psb_errpush(psb_err_internal_error_,name,& - & a_err='One level preconditioner build.') - goto 9999 - endif + call prec%precv(1)%check(info) + if (info /= psb_success_) then + write(0,*) ' Smoother check error',info + call psb_errpush(psb_err_internal_error_,name,& + & a_err='One level preconditioner check.') + goto 9999 + endif + + call prec%precv(1)%sm%build(a,desc_a,upd_,info,& + & amold=amold,vmold=vmold,imold=imold) + if (info /= psb_success_) then + call psb_errpush(psb_err_internal_error_,name,& + & a_err='One level preconditioner build.') + goto 9999 + endif ! ! Number of levels > 1 @@ -190,16 +189,25 @@ subroutine mld_zprecbld(a,desc_a,p,info,amold,vmold,imold) ! ! Build the multilevel preconditioner ! - call mld_mlprec_bld(a,desc_a,p,info,& - & amold=amold,vmold=vmold,imold=imold) + call prec%hierarchy_build(a,desc_a,info) if (info /= psb_success_) then - call psb_errpush(psb_err_internal_error_,name,& - & a_err='Multilevel preconditioner build.') + info=psb_err_internal_error_ + call psb_errpush(info,name,a_err='Error from hierarchy build') goto 9999 - endif + end if + + + call prec%smoothers_build(a,desc_a,info,amold,vmold,imold) + + if (info /= psb_success_) then + info=psb_err_internal_error_ + call psb_errpush(info,name,a_err='Error from smoothers build') + goto 9999 + end if + end if - + call psb_erractionrestore(err_act) return diff --git a/mlprec/impl/mld_zprecinit.F90 b/mlprec/impl/mld_zprecinit.F90 index fe6e8ed6..20e03db0 100644 --- a/mlprec/impl/mld_zprecinit.F90 +++ b/mlprec/impl/mld_zprecinit.F90 @@ -84,12 +84,8 @@ ! lowercase strings). ! info - integer, output. ! Error code. -! nlev - integer, optional, input. -! The number of levels of the multilevel preconditioner. -! If nlev is not present and ptype='ML', then nlev=2 -! is assumed. If ptype /= 'ML', nlev is ignored. ! -subroutine mld_zprecinit(p,ptype,info,nlev) +subroutine mld_zprecinit(prec,ptype,info) use psb_base_mod use mld_z_prec_mod, mld_protect_name => mld_zprecinit @@ -109,10 +105,9 @@ subroutine mld_zprecinit(p,ptype,info,nlev) implicit none ! Arguments - type(mld_zprec_type), intent(inout) :: p + class(mld_zprec_type), intent(inout) :: prec character(len=*), intent(in) :: ptype integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: nlev ! Local variables integer(psb_ipk_) :: nlev_, ilev_ @@ -120,99 +115,94 @@ subroutine mld_zprecinit(p,ptype,info,nlev) character(len=*), parameter :: name='mld_precinit' info = psb_success_ - if (allocated(p%precv)) then - call mld_precfree(p,info) + if (allocated(prec%precv)) then + call prec%free(info) if (info /= psb_success_) then ! Do we want to do something? endif endif - p%coarse_aggr_size = -1 + prec%coarse_aggr_size = -1 select case(psb_toupper(ptype(1:len_trim(ptype)))) case ('NOPREC','NONE') nlev_ = 1 ilev_ = 1 - allocate(p%precv(nlev_),stat=info) - allocate(mld_z_base_smoother_type :: p%precv(ilev_)%sm, stat=info) + allocate(prec%precv(nlev_),stat=info) + allocate(mld_z_base_smoother_type :: prec%precv(ilev_)%sm, stat=info) if (info /= psb_success_) return - allocate(mld_z_id_solver_type :: p%precv(ilev_)%sm%sv, stat=info) - call p%precv(ilev_)%default() + allocate(mld_z_id_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) + call prec%precv(ilev_)%default() case ('JAC','DIAG','JACOBI') nlev_ = 1 ilev_ = 1 - allocate(p%precv(nlev_),stat=info) - allocate(mld_z_jac_smoother_type :: p%precv(ilev_)%sm, stat=info) + allocate(prec%precv(nlev_),stat=info) + allocate(mld_z_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info) if (info /= psb_success_) return - allocate(mld_z_diag_solver_type :: p%precv(ilev_)%sm%sv, stat=info) - call p%precv(ilev_)%default() + allocate(mld_z_diag_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) + call prec%precv(ilev_)%default() case ('BJAC') nlev_ = 1 ilev_ = 1 - allocate(p%precv(nlev_),stat=info) - allocate(mld_z_jac_smoother_type :: p%precv(ilev_)%sm, stat=info) + allocate(prec%precv(nlev_),stat=info) + allocate(mld_z_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info) if (info /= psb_success_) return - allocate(mld_z_ilu_solver_type :: p%precv(ilev_)%sm%sv, stat=info) - call p%precv(ilev_)%default() + allocate(mld_z_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) + call prec%precv(ilev_)%default() case ('AS') nlev_ = 1 ilev_ = 1 - allocate(p%precv(nlev_),stat=info) - allocate(mld_z_as_smoother_type :: p%precv(ilev_)%sm, stat=info) + allocate(prec%precv(nlev_),stat=info) + allocate(mld_z_as_smoother_type :: prec%precv(ilev_)%sm, stat=info) if (info /= psb_success_) return - allocate(mld_z_ilu_solver_type :: p%precv(ilev_)%sm%sv, stat=info) - call p%precv(ilev_)%default() + allocate(mld_z_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) + call prec%precv(ilev_)%default() case ('ML') - if (present(nlev)) then - nlev_ = max(1,nlev) - p%max_prec_levs = nlev_ - else - nlev_ = p%max_prec_levs - end if + nlev_ = prec%max_prec_levs ilev_ = 1 - allocate(p%precv(nlev_),stat=info) - allocate(mld_z_as_smoother_type :: p%precv(ilev_)%sm, stat=info) + allocate(prec%precv(nlev_),stat=info) + allocate(mld_z_as_smoother_type :: prec%precv(ilev_)%sm, stat=info) if (info /= psb_success_) return - allocate(mld_z_ilu_solver_type :: p%precv(ilev_)%sm%sv, stat=info) - call p%precv(ilev_)%default() + allocate(mld_z_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) + call prec%precv(ilev_)%default() if (nlev_ == 1) return do ilev_ = 2, nlev_ -1 - allocate(mld_z_as_smoother_type :: p%precv(ilev_)%sm, stat=info) + allocate(mld_z_as_smoother_type :: prec%precv(ilev_)%sm, stat=info) if (info /= psb_success_) return - allocate(mld_z_ilu_solver_type :: p%precv(ilev_)%sm%sv, stat=info) - call p%precv(ilev_)%default() + allocate(mld_z_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) + call prec%precv(ilev_)%default() end do ilev_ = nlev_ - allocate(mld_z_jac_smoother_type :: p%precv(ilev_)%sm, stat=info) + allocate(mld_z_jac_smoother_type :: prec%precv(ilev_)%sm, stat=info) if (info /= psb_success_) return #if defined(HAVE_UMF_) - allocate(mld_z_umf_solver_type :: p%precv(ilev_)%sm%sv, stat=info) + allocate(mld_z_umf_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) #elif defined(HAVE_SLU_) - allocate(mld_z_slu_solver_type :: p%precv(ilev_)%sm%sv, stat=info) + allocate(mld_z_slu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) #else - allocate(mld_z_ilu_solver_type :: p%precv(ilev_)%sm%sv, stat=info) + allocate(mld_z_ilu_solver_type :: prec%precv(ilev_)%sm%sv, stat=info) #endif - call p%precv(ilev_)%default() - p%precv(ilev_)%parms%coarse_solve = mld_bjac_ - call p%precv(ilev_)%set(mld_smoother_sweeps_,4_psb_ipk_,info) - call p%precv(ilev_)%set(mld_sub_restr_,psb_none_,info) - call p%precv(ilev_)%set(mld_sub_prol_,psb_none_,info) - call p%precv(ilev_)%set(mld_sub_ovr_,izero,info) + call prec%precv(ilev_)%default() + prec%precv(ilev_)%parms%coarse_solve = mld_bjac_ + call prec%precv(ilev_)%set(mld_smoother_sweeps_,4_psb_ipk_,info) + call prec%precv(ilev_)%set(mld_sub_restr_,psb_none_,info) + call prec%precv(ilev_)%set(mld_sub_prol_,psb_none_,info) + call prec%precv(ilev_)%set(mld_sub_ovr_,izero,info) thr = 0.05_psb_dpk_ scale = 1.0_psb_dpk_ do ilev_=1,nlev_ - call p%precv(ilev_)%set(mld_aggr_thresh_,thr,info) - call p%precv(ilev_)%set(mld_aggr_scale_,scale,info) - call p%precv(ilev_)%set(mld_aggr_filter_,mld_filter_mat_,info) + call prec%precv(ilev_)%set(mld_aggr_thresh_,thr,info) + call prec%precv(ilev_)%set(mld_aggr_scale_,scale,info) + call prec%precv(ilev_)%set(mld_aggr_filter_,mld_filter_mat_,info) end do case default diff --git a/mlprec/impl/smoother/Makefile b/mlprec/impl/smoother/Makefile index 7e955820..2a4490ab 100644 --- a/mlprec/impl/smoother/Makefile +++ b/mlprec/impl/smoother/Makefile @@ -171,7 +171,7 @@ lib: $(OBJS) $(RANLIB) $(HERE)/$(LIBNAME) mpobjs: - (make $(MPFOBJS) F90="$(MPF90)" F90COPT="$(F90COPT)") + (make $(MPFOBJS) FC="$(MPFC)" FCOPT="$(FCOPT)") (make $(MPCOBJS) CC="$(MPCC)" CCOPT="$(CCOPT)") veryclean: clean diff --git a/mlprec/impl/solver/Makefile b/mlprec/impl/solver/Makefile index 2865a322..f7531521 100644 --- a/mlprec/impl/solver/Makefile +++ b/mlprec/impl/solver/Makefile @@ -184,7 +184,7 @@ lib: $(OBJS) $(RANLIB) $(HERE)/$(LIBNAME) mpobjs: - (make $(MPFOBJS) F90="$(MPF90)" F90COPT="$(F90COPT)") + (make $(MPFOBJS) FC="$(MPFC)" FCOPT="$(FCOPT)") (make $(MPCOBJS) CC="$(MPCC)" CCOPT="$(CCOPT)") veryclean: clean diff --git a/mlprec/mld_c_inner_mod.f90 b/mlprec/mld_c_inner_mod.f90 index f3e18a3f..ceb45c10 100644 --- a/mlprec/mld_c_inner_mod.f90 +++ b/mlprec/mld_c_inner_mod.f90 @@ -46,13 +46,17 @@ ! The interfaces of the user level routines are defined in mld_prec_mod.f90. ! module mld_c_inner_mod - use mld_c_prec_type +! use mld_c_prec_type, only : mld_c_prec_type + use psb_base_mod, only : psb_cspmat_type, psb_desc_type, psb_i_base_vect_type, & + & psb_spk_, psb_c_base_sparse_mat, psb_c_base_vect_type, psb_ipk_, & + & psb_c_vect_type + use mld_c_prec_type, only : mld_cprec_type, mld_sml_parms, mld_c_onelev_type interface mld_mlprec_bld subroutine mld_cmlprec_bld(a,desc_a,prec,info, amold, vmold,imold) - use psb_base_mod, only : psb_cspmat_type, psb_desc_type, psb_i_base_vect_type, & + import :: psb_cspmat_type, psb_desc_type, psb_i_base_vect_type, & & psb_spk_, psb_c_base_sparse_mat, psb_c_base_vect_type, psb_ipk_ - use mld_c_prec_type, only : mld_cprec_type + import :: mld_cprec_type implicit none type(psb_cspmat_type), intent(in), target :: a type(psb_desc_type), intent(inout), target :: desc_a @@ -61,14 +65,13 @@ module mld_c_inner_mod class(psb_c_base_sparse_mat), intent(in), optional :: amold class(psb_c_base_vect_type), intent(in), optional :: vmold class(psb_i_base_vect_type), intent(in), optional :: imold -! !$ character, intent(in),optional :: upd end subroutine mld_cmlprec_bld end interface mld_mlprec_bld interface mld_mlprec_aply subroutine mld_cmlprec_aply(alpha,p,x,beta,y,desc_data,trans,work,info) - use psb_base_mod, only : psb_cspmat_type, psb_desc_type, psb_spk_, psb_ipk_ - use mld_c_prec_type, only : mld_cprec_type + import :: psb_cspmat_type, psb_desc_type, psb_spk_, psb_ipk_ + import :: mld_cprec_type implicit none type(psb_desc_type),intent(in) :: desc_data type(mld_cprec_type), intent(inout) :: p @@ -80,9 +83,9 @@ module mld_c_inner_mod integer(psb_ipk_), intent(out) :: info end subroutine mld_cmlprec_aply subroutine mld_cmlprec_aply_vect(alpha,p,x,beta,y,desc_data,trans,work,info) - use psb_base_mod, only : psb_cspmat_type, psb_desc_type, & + import :: psb_cspmat_type, psb_desc_type, & & psb_spk_, psb_c_vect_type, psb_ipk_ - use mld_c_prec_type, only : mld_cprec_type + import :: mld_cprec_type implicit none type(psb_desc_type),intent(in) :: desc_data type(mld_cprec_type), intent(inout) :: p @@ -97,8 +100,8 @@ module mld_c_inner_mod interface mld_aggrmap_bld subroutine mld_c_lev_aggrmap_bld(p,a,desc_a,ilaggr,nlaggr,op_prol,info) - use psb_base_mod, only : psb_cspmat_type, psb_desc_type, psb_spk_, psb_ipk_ - use mld_c_prec_type, only : mld_c_onelev_type + import :: psb_cspmat_type, psb_desc_type, psb_spk_, psb_ipk_ + import :: mld_c_onelev_type implicit none type(mld_c_onelev_type), intent(inout), target :: p type(psb_cspmat_type), intent(in) :: a @@ -108,7 +111,7 @@ module mld_c_inner_mod integer(psb_ipk_), intent(out) :: info end subroutine mld_c_lev_aggrmap_bld subroutine mld_caggrmap_bld(aggr_type,iorder,theta,a,desc_a,ilaggr,nlaggr,op_prol,info) - use psb_base_mod, only : psb_cspmat_type, psb_desc_type, psb_spk_, psb_ipk_ + import :: psb_cspmat_type, psb_desc_type, psb_spk_, psb_ipk_ implicit none integer(psb_ipk_), intent(in) :: iorder integer(psb_ipk_), intent(in) :: aggr_type @@ -124,7 +127,7 @@ module mld_c_inner_mod interface mld_dec_map_bld subroutine mld_c_dec_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info) - use psb_base_mod, only : psb_cspmat_type, psb_desc_type, psb_spk_, psb_ipk_ + import :: psb_cspmat_type, psb_desc_type, psb_spk_, psb_ipk_ implicit none integer(psb_ipk_), intent(in) :: iorder type(psb_cspmat_type), intent(in) :: a @@ -138,8 +141,8 @@ module mld_c_inner_mod interface mld_lev_mat_asb subroutine mld_c_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info) - use psb_base_mod, only : psb_cspmat_type, psb_desc_type, psb_spk_, psb_ipk_ - use mld_c_prec_type, only : mld_c_onelev_type + import :: psb_cspmat_type, psb_desc_type, psb_spk_, psb_ipk_ + import :: mld_c_onelev_type implicit none type(mld_c_onelev_type), intent(inout), target :: p type(psb_cspmat_type), intent(in) :: a @@ -152,8 +155,8 @@ module mld_c_inner_mod interface mld_aggrmat_asb subroutine mld_caggrmat_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info) - use psb_base_mod, only : psb_cspmat_type, psb_desc_type, psb_spk_, psb_ipk_ - use mld_c_prec_type, only : mld_sml_parms + import :: psb_cspmat_type, psb_desc_type, psb_spk_, psb_ipk_ + import :: mld_sml_parms implicit none type(psb_cspmat_type), intent(in) :: a type(psb_desc_type), intent(in) :: desc_a @@ -166,8 +169,8 @@ module mld_c_inner_mod abstract interface subroutine mld_caggrmat_var_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info) - use psb_base_mod, only : psb_cspmat_type, psb_desc_type, psb_spk_, psb_ipk_ - use mld_c_prec_type, only : mld_c_onelev_type, mld_sml_parms + import :: psb_cspmat_type, psb_desc_type, psb_spk_, psb_ipk_ + import :: mld_c_onelev_type, mld_sml_parms implicit none type(psb_cspmat_type), intent(in) :: a type(psb_desc_type), intent(in) :: desc_a diff --git a/mlprec/mld_c_onelev_mod.f90 b/mlprec/mld_c_onelev_mod.f90 index 9c633d25..a2facb61 100644 --- a/mlprec/mld_c_onelev_mod.f90 +++ b/mlprec/mld_c_onelev_mod.f90 @@ -435,7 +435,7 @@ contains lv%parms%sweeps = 1 lv%parms%sweeps_pre = 1 lv%parms%sweeps_post = 1 - lv%parms%ml_type = mld_mult_ml_ + lv%parms%ml_type = mld_vcycle_ml_ lv%parms%aggr_alg = mld_dec_aggr_ lv%parms%aggr_ord = mld_aggr_ord_nat_ lv%parms%aggr_kind = mld_smooth_prol_ diff --git a/mlprec/mld_c_prec_mod.f90 b/mlprec/mld_c_prec_mod.f90 index 360ba8cd..81cf6db6 100644 --- a/mlprec/mld_c_prec_mod.f90 +++ b/mlprec/mld_c_prec_mod.f90 @@ -54,53 +54,12 @@ module mld_c_prec_mod use mld_c_ilu_solver use mld_c_gs_solver - interface mld_precinit - subroutine mld_cprecinit(p,ptype,info,nlev) - import :: psb_cspmat_type, psb_desc_type, psb_spk_, & - & mld_cprec_type, psb_ipk_ - type(mld_cprec_type), intent(inout) :: p - character(len=*), intent(in) :: ptype - integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: nlev - end subroutine mld_cprecinit - end interface mld_precinit - interface mld_precset module procedure mld_c_iprecsetsm, mld_c_iprecsetsv, & & mld_c_iprecseti, mld_c_iprecsetc, mld_c_iprecsetr, & & mld_c_cprecseti, mld_c_cprecsetc, mld_c_cprecsetr end interface mld_precset - interface mld_precbld - subroutine mld_cprecbld(a,desc_a,prec,info,amold,vmold,imold) - import :: psb_cspmat_type, psb_desc_type, psb_spk_, & - & psb_c_base_sparse_mat, psb_c_base_vect_type, & - & psb_i_base_vect_type, mld_cprec_type, psb_ipk_ - implicit none - type(psb_cspmat_type), intent(in), target :: a - type(psb_desc_type), intent(inout), target :: desc_a - type(mld_cprec_type), intent(inout), target :: prec - integer(psb_ipk_), intent(out) :: info - class(psb_c_base_sparse_mat), intent(in), optional :: amold - class(psb_c_base_vect_type), intent(in), optional :: vmold - class(psb_i_base_vect_type), intent(in), optional :: imold - ! character, intent(in),optional :: upd - end subroutine mld_cprecbld - end interface mld_precbld - - interface mld_hierarchy_bld - subroutine mld_c_hierarchy_bld(a,desc_a,prec,info) - import :: psb_cspmat_type, psb_desc_type, psb_spk_, & - & mld_cprec_type, psb_ipk_ - implicit none - type(psb_cspmat_type), intent(in), target :: a - type(psb_desc_type), intent(inout), target :: desc_a - type(mld_cprec_type), intent(inout), target :: prec - integer(psb_ipk_), intent(out) :: info - ! character, intent(in),optional :: upd - end subroutine mld_c_hierarchy_bld - end interface mld_hierarchy_bld - interface mld_extprol_bld subroutine mld_c_extprol_bld(a,desc_a,p,prolv,restrv,info,amold,vmold,imold) import :: psb_cspmat_type, psb_desc_type, psb_spk_, & @@ -121,23 +80,6 @@ module mld_c_prec_mod end subroutine mld_c_extprol_bld end interface mld_extprol_bld - interface mld_smoothers_bld - subroutine mld_c_smoothers_bld(a,desc_a,prec,info,amold,vmold,imold) - import :: psb_cspmat_type, psb_desc_type, psb_spk_, & - & psb_c_base_sparse_mat, psb_c_base_vect_type, & - & psb_i_base_vect_type, mld_cprec_type, psb_ipk_ - implicit none - type(psb_cspmat_type), intent(in), target :: a - type(psb_desc_type), intent(inout), target :: desc_a - type(mld_cprec_type), intent(inout), target :: prec - integer(psb_ipk_), intent(out) :: info - class(psb_c_base_sparse_mat), intent(in), optional :: amold - class(psb_c_base_vect_type), intent(in), optional :: vmold - class(psb_i_base_vect_type), intent(in), optional :: imold - ! character, intent(in),optional :: upd - end subroutine mld_c_smoothers_bld - end interface mld_smoothers_bld - contains subroutine mld_c_iprecsetsm(p,val,info,pos) diff --git a/mlprec/mld_c_prec_type.f90 b/mlprec/mld_c_prec_type.f90 index 60ce904c..92ecd8b2 100644 --- a/mlprec/mld_c_prec_type.f90 +++ b/mlprec/mld_c_prec_type.f90 @@ -136,6 +136,11 @@ module mld_c_prec_type procedure, pass(prec) :: get_smoother => mld_c_get_smootherp procedure, pass(prec) :: get_solver => mld_c_get_solverp procedure, pass(prec) :: move_alloc => c_prec_move_alloc + procedure, pass(prec) :: init => mld_cprecinit + procedure, pass(prec) :: build => mld_cprecbld + procedure, pass(prec) :: hierarchy_build => mld_c_hierarchy_bld + procedure, pass(prec) :: smoothers_build => mld_c_smoothers_bld + procedure, pass(prec) :: descr => mld_cfile_prec_descr end type mld_cprec_type private :: mld_c_dump, mld_c_get_compl, mld_c_cmp_compl,& @@ -160,7 +165,7 @@ module mld_c_prec_type module procedure mld_cprec_sizeof end interface - interface mld_precaply + interface mld_precapply subroutine mld_cprecaply2_vect(prec,x,y,desc_data,info,trans,work) import :: psb_cspmat_type, psb_desc_type, & & psb_spk_, psb_c_vect_type, mld_cprec_type, psb_ipk_ @@ -283,6 +288,63 @@ module mld_c_prec_type end subroutine mld_ccprecsetc end interface + interface mld_precinit + subroutine mld_cprecinit(prec,ptype,info) + import :: psb_cspmat_type, psb_desc_type, psb_spk_, & + & mld_cprec_type, psb_ipk_ + class(mld_cprec_type), intent(inout) :: prec + character(len=*), intent(in) :: ptype + integer(psb_ipk_), intent(out) :: info + end subroutine mld_cprecinit + end interface mld_precinit + + interface mld_precbld + subroutine mld_cprecbld(a,desc_a,prec,info,amold,vmold,imold) + import :: psb_cspmat_type, psb_desc_type, psb_spk_, & + & psb_c_base_sparse_mat, psb_c_base_vect_type, & + & psb_i_base_vect_type, mld_cprec_type, psb_ipk_ + implicit none + type(psb_cspmat_type), intent(in), target :: a + type(psb_desc_type), intent(inout), target :: desc_a + class(mld_cprec_type), intent(inout), target :: prec + integer(psb_ipk_), intent(out) :: info + class(psb_c_base_sparse_mat), intent(in), optional :: amold + class(psb_c_base_vect_type), intent(in), optional :: vmold + class(psb_i_base_vect_type), intent(in), optional :: imold + ! character, intent(in),optional :: upd + end subroutine mld_cprecbld + end interface mld_precbld + + interface mld_hierarchy_bld + subroutine mld_c_hierarchy_bld(a,desc_a,prec,info) + import :: psb_cspmat_type, psb_desc_type, psb_spk_, & + & mld_cprec_type, psb_ipk_ + implicit none + type(psb_cspmat_type), intent(in), target :: a + type(psb_desc_type), intent(inout), target :: desc_a + class(mld_cprec_type), intent(inout), target :: prec + integer(psb_ipk_), intent(out) :: info + ! character, intent(in),optional :: upd + end subroutine mld_c_hierarchy_bld + end interface mld_hierarchy_bld + + interface mld_smoothers_bld + subroutine mld_c_smoothers_bld(a,desc_a,prec,info,amold,vmold,imold) + import :: psb_cspmat_type, psb_desc_type, psb_spk_, & + & psb_c_base_sparse_mat, psb_c_base_vect_type, & + & psb_i_base_vect_type, mld_cprec_type, psb_ipk_ + implicit none + type(psb_cspmat_type), intent(in), target :: a + type(psb_desc_type), intent(inout), target :: desc_a + class(mld_cprec_type), intent(inout), target :: prec + integer(psb_ipk_), intent(out) :: info + class(psb_c_base_sparse_mat), intent(in), optional :: amold + class(psb_c_base_vect_type), intent(in), optional :: vmold + class(psb_i_base_vect_type), intent(in), optional :: imold + ! character, intent(in),optional :: upd + end subroutine mld_c_smoothers_bld + end interface mld_smoothers_bld + contains ! ! Function returning a pointer to the smoother @@ -450,16 +512,15 @@ contains ! The id of the process printing the message; -1 acts as a wildcard. ! Default is psb_root_ ! - subroutine mld_cfile_prec_descr(p,info,iout,root) + subroutine mld_cfile_prec_descr(prec,iout,root) implicit none ! Arguments - type(mld_cprec_type), intent(in) :: p - integer(psb_ipk_), intent(out) :: info + class(mld_cprec_type), intent(in) :: prec integer(psb_ipk_), intent(in), optional :: iout integer(psb_ipk_), intent(in), optional :: root ! Local variables - integer(psb_ipk_) :: ilev, nlev, ilmin + integer(psb_ipk_) :: ilev, nlev, ilmin, info integer(psb_ipk_) :: ictxt, me, np character(len=20), parameter :: name='mld_file_prec_descr' integer(psb_ipk_) :: iout_ @@ -473,9 +534,9 @@ contains end if if (iout_ < 0) iout_ = 6 - ictxt = p%ictxt + ictxt = prec%ictxt - if (allocated(p%precv)) then + if (allocated(prec%precv)) then call psb_info(ictxt,me,np) if (present(root)) then @@ -492,9 +553,9 @@ contains ! ensured by mld_precbld). ! if (me == root_) then - nlev = size(p%precv) + nlev = size(prec%precv) do ilev = 1, nlev - if (.not.allocated(p%precv(ilev)%sm)) then + if (.not.allocated(prec%precv(ilev)%sm)) then info = 3111 write(iout_,*) ' ',name,& & ': error: inconsistent MLPREC part, should call MLD_PRECINIT' @@ -510,26 +571,26 @@ contains ! if (nlev > 1) then write(iout_,*) 'Multilevel Preconditioner' - write(iout_,*) 'Outer sweeps:',p%outer_sweeps + write(iout_,*) 'Outer sweeps:',prec%outer_sweeps write(iout_,*) write(iout_,*) 'Base preconditioner (smoother) details' endif - call p%precv(1)%sm%descr(info,iout=iout_) + call prec%precv(1)%sm%descr(info,iout=iout_) if (nlev == 1) then - if (p%precv(1)%parms%sweeps > 1) then + if (prec%precv(1)%parms%sweeps > 1) then write(iout_,*) ' Number of smoother sweeps : ',& - & p%precv(1)%parms%sweeps + & prec%precv(1)%parms%sweeps end if write(iout_,*) return end if - if (allocated(p%precv(1)%sm2a)) then + if (allocated(prec%precv(1)%sm2a)) then write(iout_,*) 'Post smoother details' - call p%precv(1)%sm2a%descr(info,iout=iout_) + call prec%precv(1)%sm2a%descr(info,iout=iout_) if (nlev == 1) then - if (p%precv(1)%parms%sweeps > 1) then + if (prec%precv(1)%parms%sweeps > 1) then write(iout_,*) ' Number of smoother sweeps : ',& - & p%precv(1)%parms%sweeps + & prec%precv(1)%parms%sweeps end if write(iout_,*) return @@ -543,11 +604,11 @@ contains write(iout_,*) write(iout_,*) 'Multilevel details' write(iout_,*) ' Number of levels : ',nlev - write(iout_,*) ' Operator complexity: ',p%get_complexity() + write(iout_,*) ' Operator complexity: ',prec%get_complexity() ilmin = 2 if (nlev == 2) ilmin=1 do ilev=ilmin,nlev - call p%precv(ilev)%descr(ilev,nlev,ilmin,info,iout=iout_) + call prec%precv(ilev)%descr(ilev,nlev,ilmin,info,iout=iout_) end do write(iout_,*) @@ -656,7 +717,7 @@ contains select type(prec) type is (mld_cprec_type) - call mld_precaply(prec,x,y,desc_data,info,trans,work) + call mld_precapply(prec,x,y,desc_data,info,trans,work) class default info = psb_err_missing_override_method_ call psb_errpush(info,name) @@ -686,7 +747,7 @@ contains select type(prec) type is (mld_cprec_type) - call mld_precaply(prec,x,desc_data,info,trans,work) + call mld_precapply(prec,x,desc_data,info,trans,work) class default info = psb_err_missing_override_method_ call psb_errpush(info,name) @@ -718,7 +779,7 @@ contains select type(prec) type is (mld_cprec_type) - call mld_precaply(prec,x,y,desc_data,info,trans,work) + call mld_precapply(prec,x,y,desc_data,info,trans,work) class default info = psb_err_missing_override_method_ call psb_errpush(info,name) @@ -747,7 +808,7 @@ contains select type(prec) type is (mld_cprec_type) - call mld_precaply(prec,x,desc_data,info,trans) + call mld_precapply(prec,x,desc_data,info,trans) class default info = psb_err_missing_override_method_ call psb_errpush(info,name) diff --git a/mlprec/mld_d_inner_mod.f90 b/mlprec/mld_d_inner_mod.f90 index b573f70b..99ee3ffc 100644 --- a/mlprec/mld_d_inner_mod.f90 +++ b/mlprec/mld_d_inner_mod.f90 @@ -46,13 +46,17 @@ ! The interfaces of the user level routines are defined in mld_prec_mod.f90. ! module mld_d_inner_mod - use mld_d_prec_type +! use mld_d_prec_type, only : mld_d_prec_type + use psb_base_mod, only : psb_dspmat_type, psb_desc_type, psb_i_base_vect_type, & + & psb_dpk_, psb_d_base_sparse_mat, psb_d_base_vect_type, psb_ipk_, & + & psb_d_vect_type + use mld_d_prec_type, only : mld_dprec_type, mld_dml_parms, mld_d_onelev_type interface mld_mlprec_bld subroutine mld_dmlprec_bld(a,desc_a,prec,info, amold, vmold,imold) - use psb_base_mod, only : psb_dspmat_type, psb_desc_type, psb_i_base_vect_type, & + import :: psb_dspmat_type, psb_desc_type, psb_i_base_vect_type, & & psb_dpk_, psb_d_base_sparse_mat, psb_d_base_vect_type, psb_ipk_ - use mld_d_prec_type, only : mld_dprec_type + import :: mld_dprec_type implicit none type(psb_dspmat_type), intent(in), target :: a type(psb_desc_type), intent(inout), target :: desc_a @@ -61,14 +65,13 @@ module mld_d_inner_mod class(psb_d_base_sparse_mat), intent(in), optional :: amold class(psb_d_base_vect_type), intent(in), optional :: vmold class(psb_i_base_vect_type), intent(in), optional :: imold -! !$ character, intent(in),optional :: upd end subroutine mld_dmlprec_bld end interface mld_mlprec_bld interface mld_mlprec_aply subroutine mld_dmlprec_aply(alpha,p,x,beta,y,desc_data,trans,work,info) - use psb_base_mod, only : psb_dspmat_type, psb_desc_type, psb_dpk_, psb_ipk_ - use mld_d_prec_type, only : mld_dprec_type + import :: psb_dspmat_type, psb_desc_type, psb_dpk_, psb_ipk_ + import :: mld_dprec_type implicit none type(psb_desc_type),intent(in) :: desc_data type(mld_dprec_type), intent(inout) :: p @@ -80,9 +83,9 @@ module mld_d_inner_mod integer(psb_ipk_), intent(out) :: info end subroutine mld_dmlprec_aply subroutine mld_dmlprec_aply_vect(alpha,p,x,beta,y,desc_data,trans,work,info) - use psb_base_mod, only : psb_dspmat_type, psb_desc_type, & + import :: psb_dspmat_type, psb_desc_type, & & psb_dpk_, psb_d_vect_type, psb_ipk_ - use mld_d_prec_type, only : mld_dprec_type + import :: mld_dprec_type implicit none type(psb_desc_type),intent(in) :: desc_data type(mld_dprec_type), intent(inout) :: p @@ -97,8 +100,8 @@ module mld_d_inner_mod interface mld_aggrmap_bld subroutine mld_d_lev_aggrmap_bld(p,a,desc_a,ilaggr,nlaggr,op_prol,info) - use psb_base_mod, only : psb_dspmat_type, psb_desc_type, psb_dpk_, psb_ipk_ - use mld_d_prec_type, only : mld_d_onelev_type + import :: psb_dspmat_type, psb_desc_type, psb_dpk_, psb_ipk_ + import :: mld_d_onelev_type implicit none type(mld_d_onelev_type), intent(inout), target :: p type(psb_dspmat_type), intent(in) :: a @@ -108,7 +111,7 @@ module mld_d_inner_mod integer(psb_ipk_), intent(out) :: info end subroutine mld_d_lev_aggrmap_bld subroutine mld_daggrmap_bld(aggr_type,iorder,theta,a,desc_a,ilaggr,nlaggr,op_prol,info) - use psb_base_mod, only : psb_dspmat_type, psb_desc_type, psb_dpk_, psb_ipk_ + import :: psb_dspmat_type, psb_desc_type, psb_dpk_, psb_ipk_ implicit none integer(psb_ipk_), intent(in) :: iorder integer(psb_ipk_), intent(in) :: aggr_type @@ -124,7 +127,7 @@ module mld_d_inner_mod interface mld_dec_map_bld subroutine mld_d_dec_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info) - use psb_base_mod, only : psb_dspmat_type, psb_desc_type, psb_dpk_, psb_ipk_ + import :: psb_dspmat_type, psb_desc_type, psb_dpk_, psb_ipk_ implicit none integer(psb_ipk_), intent(in) :: iorder type(psb_dspmat_type), intent(in) :: a @@ -138,8 +141,8 @@ module mld_d_inner_mod interface mld_lev_mat_asb subroutine mld_d_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info) - use psb_base_mod, only : psb_dspmat_type, psb_desc_type, psb_dpk_, psb_ipk_ - use mld_d_prec_type, only : mld_d_onelev_type + import :: psb_dspmat_type, psb_desc_type, psb_dpk_, psb_ipk_ + import :: mld_d_onelev_type implicit none type(mld_d_onelev_type), intent(inout), target :: p type(psb_dspmat_type), intent(in) :: a @@ -152,8 +155,8 @@ module mld_d_inner_mod interface mld_aggrmat_asb subroutine mld_daggrmat_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info) - use psb_base_mod, only : psb_dspmat_type, psb_desc_type, psb_dpk_, psb_ipk_ - use mld_d_prec_type, only : mld_dml_parms + import :: psb_dspmat_type, psb_desc_type, psb_dpk_, psb_ipk_ + import :: mld_dml_parms implicit none type(psb_dspmat_type), intent(in) :: a type(psb_desc_type), intent(in) :: desc_a @@ -166,8 +169,8 @@ module mld_d_inner_mod abstract interface subroutine mld_daggrmat_var_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info) - use psb_base_mod, only : psb_dspmat_type, psb_desc_type, psb_dpk_, psb_ipk_ - use mld_d_prec_type, only : mld_d_onelev_type, mld_dml_parms + import :: psb_dspmat_type, psb_desc_type, psb_dpk_, psb_ipk_ + import :: mld_d_onelev_type, mld_dml_parms implicit none type(psb_dspmat_type), intent(in) :: a type(psb_desc_type), intent(in) :: desc_a diff --git a/mlprec/mld_d_onelev_mod.f90 b/mlprec/mld_d_onelev_mod.f90 index 65b9d1ee..fecfd8b5 100644 --- a/mlprec/mld_d_onelev_mod.f90 +++ b/mlprec/mld_d_onelev_mod.f90 @@ -435,7 +435,7 @@ contains lv%parms%sweeps = 1 lv%parms%sweeps_pre = 1 lv%parms%sweeps_post = 1 - lv%parms%ml_type = mld_mult_ml_ + lv%parms%ml_type = mld_vcycle_ml_ lv%parms%aggr_alg = mld_dec_aggr_ lv%parms%aggr_ord = mld_aggr_ord_nat_ lv%parms%aggr_kind = mld_smooth_prol_ diff --git a/mlprec/mld_d_prec_mod.f90 b/mlprec/mld_d_prec_mod.f90 index 31879b92..79a2a6ab 100644 --- a/mlprec/mld_d_prec_mod.f90 +++ b/mlprec/mld_d_prec_mod.f90 @@ -54,53 +54,12 @@ module mld_d_prec_mod use mld_d_ilu_solver use mld_d_gs_solver - interface mld_precinit - subroutine mld_dprecinit(p,ptype,info,nlev) - import :: psb_dspmat_type, psb_desc_type, psb_dpk_, & - & mld_dprec_type, psb_ipk_ - type(mld_dprec_type), intent(inout) :: p - character(len=*), intent(in) :: ptype - integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: nlev - end subroutine mld_dprecinit - end interface mld_precinit - interface mld_precset module procedure mld_d_iprecsetsm, mld_d_iprecsetsv, & & mld_d_iprecseti, mld_d_iprecsetc, mld_d_iprecsetr, & & mld_d_cprecseti, mld_d_cprecsetc, mld_d_cprecsetr end interface mld_precset -!!$ interface mld_precbld -!!$ subroutine mld_dprecbld(a,desc_a,prec,info,upd,amold,vmold,imold) -!!$ import :: psb_dspmat_type, psb_desc_type, psb_dpk_, & -!!$ & psb_d_base_sparse_mat, psb_d_base_vect_type, & -!!$ & psb_i_base_vect_type, mld_dprec_type, psb_ipk_ -!!$ implicit none -!!$ type(psb_dspmat_type), intent(in), target :: a -!!$ type(psb_desc_type), intent(inout), target :: desc_a -!!$ type(mld_dprec_type), intent(inout), target :: prec -!!$ integer(psb_ipk_), intent(out) :: info -!!$ class(psb_d_base_sparse_mat), intent(in), optional :: amold -!!$ class(psb_d_base_vect_type), intent(in), optional :: vmold -!!$ class(psb_i_base_vect_type), intent(in), optional :: imold -!!$ character, intent(in),optional :: upd -!!$ end subroutine mld_dprecbld -!!$ end interface mld_precbld -!!$ - interface mld_hierarchy_bld - subroutine mld_d_hierarchy_bld(a,desc_a,prec,info) - import :: psb_dspmat_type, psb_desc_type, psb_dpk_, & - & mld_dprec_type, psb_ipk_ - implicit none - type(psb_dspmat_type), intent(in), target :: a - type(psb_desc_type), intent(inout), target :: desc_a - type(mld_dprec_type), intent(inout), target :: prec - integer(psb_ipk_), intent(out) :: info - ! character, intent(in),optional :: upd - end subroutine mld_d_hierarchy_bld - end interface mld_hierarchy_bld - interface mld_extprol_bld subroutine mld_d_extprol_bld(a,desc_a,p,prolv,restrv,info,amold,vmold,imold) import :: psb_dspmat_type, psb_desc_type, psb_dpk_, & @@ -121,23 +80,6 @@ module mld_d_prec_mod end subroutine mld_d_extprol_bld end interface mld_extprol_bld - interface mld_smoothers_bld - subroutine mld_d_smoothers_bld(a,desc_a,prec,info,amold,vmold,imold) - import :: psb_dspmat_type, psb_desc_type, psb_dpk_, & - & psb_d_base_sparse_mat, psb_d_base_vect_type, & - & psb_i_base_vect_type, mld_dprec_type, psb_ipk_ - implicit none - type(psb_dspmat_type), intent(in), target :: a - type(psb_desc_type), intent(inout), target :: desc_a - type(mld_dprec_type), intent(inout), target :: prec - integer(psb_ipk_), intent(out) :: info - class(psb_d_base_sparse_mat), intent(in), optional :: amold - class(psb_d_base_vect_type), intent(in), optional :: vmold - class(psb_i_base_vect_type), intent(in), optional :: imold - ! character, intent(in),optional :: upd - end subroutine mld_d_smoothers_bld - end interface mld_smoothers_bld - contains subroutine mld_d_iprecsetsm(p,val,info,pos) diff --git a/mlprec/mld_d_prec_type.f90 b/mlprec/mld_d_prec_type.f90 index 6f85356a..07aafbc5 100644 --- a/mlprec/mld_d_prec_type.f90 +++ b/mlprec/mld_d_prec_type.f90 @@ -136,28 +136,16 @@ module mld_d_prec_type procedure, pass(prec) :: get_smoother => mld_d_get_smootherp procedure, pass(prec) :: get_solver => mld_d_get_solverp procedure, pass(prec) :: move_alloc => d_prec_move_alloc + procedure, pass(prec) :: init => mld_dprecinit procedure, pass(prec) :: build => mld_dprecbld + procedure, pass(prec) :: hierarchy_build => mld_d_hierarchy_bld + procedure, pass(prec) :: smoothers_build => mld_d_smoothers_bld + procedure, pass(prec) :: descr => mld_dfile_prec_descr end type mld_dprec_type private :: mld_d_dump, mld_d_get_compl, mld_d_cmp_compl,& & mld_d_get_nzeros, mld_d_get_nlevs, d_prec_move_alloc - - interface mld_precbld - subroutine mld_dprecbld(a,desc_a,prec,info,amold,vmold,imold) - import :: psb_dspmat_type, psb_desc_type, psb_dpk_, & - & psb_d_base_sparse_mat, psb_d_base_vect_type, & - & psb_i_base_vect_type, mld_dprec_type, psb_ipk_ - implicit none - type(psb_dspmat_type), intent(in), target :: a - type(psb_desc_type), intent(inout), target :: desc_a - class(mld_dprec_type), intent(inout), target :: prec - integer(psb_ipk_), intent(out) :: info - class(psb_d_base_sparse_mat), intent(in), optional :: amold - class(psb_d_base_vect_type), intent(in), optional :: vmold - class(psb_i_base_vect_type), intent(in), optional :: imold - end subroutine mld_dprecbld - end interface mld_precbld ! ! Interfaces to routines for checking the definition of the preconditioner, @@ -177,7 +165,7 @@ module mld_d_prec_type module procedure mld_dprec_sizeof end interface - interface mld_precaply + interface mld_precapply subroutine mld_dprecaply2_vect(prec,x,y,desc_data,info,trans,work) import :: psb_dspmat_type, psb_desc_type, & & psb_dpk_, psb_d_vect_type, mld_dprec_type, psb_ipk_ @@ -300,6 +288,63 @@ module mld_d_prec_type end subroutine mld_dcprecsetc end interface + interface mld_precinit + subroutine mld_dprecinit(prec,ptype,info) + import :: psb_dspmat_type, psb_desc_type, psb_dpk_, & + & mld_dprec_type, psb_ipk_ + class(mld_dprec_type), intent(inout) :: prec + character(len=*), intent(in) :: ptype + integer(psb_ipk_), intent(out) :: info + end subroutine mld_dprecinit + end interface mld_precinit + + interface mld_precbld + subroutine mld_dprecbld(a,desc_a,prec,info,amold,vmold,imold) + import :: psb_dspmat_type, psb_desc_type, psb_dpk_, & + & psb_d_base_sparse_mat, psb_d_base_vect_type, & + & psb_i_base_vect_type, mld_dprec_type, psb_ipk_ + implicit none + type(psb_dspmat_type), intent(in), target :: a + type(psb_desc_type), intent(inout), target :: desc_a + class(mld_dprec_type), intent(inout), target :: prec + integer(psb_ipk_), intent(out) :: info + class(psb_d_base_sparse_mat), intent(in), optional :: amold + class(psb_d_base_vect_type), intent(in), optional :: vmold + class(psb_i_base_vect_type), intent(in), optional :: imold + ! character, intent(in),optional :: upd + end subroutine mld_dprecbld + end interface mld_precbld + + interface mld_hierarchy_bld + subroutine mld_d_hierarchy_bld(a,desc_a,prec,info) + import :: psb_dspmat_type, psb_desc_type, psb_dpk_, & + & mld_dprec_type, psb_ipk_ + implicit none + type(psb_dspmat_type), intent(in), target :: a + type(psb_desc_type), intent(inout), target :: desc_a + class(mld_dprec_type), intent(inout), target :: prec + integer(psb_ipk_), intent(out) :: info + ! character, intent(in),optional :: upd + end subroutine mld_d_hierarchy_bld + end interface mld_hierarchy_bld + + interface mld_smoothers_bld + subroutine mld_d_smoothers_bld(a,desc_a,prec,info,amold,vmold,imold) + import :: psb_dspmat_type, psb_desc_type, psb_dpk_, & + & psb_d_base_sparse_mat, psb_d_base_vect_type, & + & psb_i_base_vect_type, mld_dprec_type, psb_ipk_ + implicit none + type(psb_dspmat_type), intent(in), target :: a + type(psb_desc_type), intent(inout), target :: desc_a + class(mld_dprec_type), intent(inout), target :: prec + integer(psb_ipk_), intent(out) :: info + class(psb_d_base_sparse_mat), intent(in), optional :: amold + class(psb_d_base_vect_type), intent(in), optional :: vmold + class(psb_i_base_vect_type), intent(in), optional :: imold + ! character, intent(in),optional :: upd + end subroutine mld_d_smoothers_bld + end interface mld_smoothers_bld + contains ! ! Function returning a pointer to the smoother @@ -467,16 +512,15 @@ contains ! The id of the process printing the message; -1 acts as a wildcard. ! Default is psb_root_ ! - subroutine mld_dfile_prec_descr(p,info,iout,root) + subroutine mld_dfile_prec_descr(prec,iout,root) implicit none ! Arguments - type(mld_dprec_type), intent(in) :: p - integer(psb_ipk_), intent(out) :: info + class(mld_dprec_type), intent(in) :: prec integer(psb_ipk_), intent(in), optional :: iout integer(psb_ipk_), intent(in), optional :: root ! Local variables - integer(psb_ipk_) :: ilev, nlev, ilmin + integer(psb_ipk_) :: ilev, nlev, ilmin, info integer(psb_ipk_) :: ictxt, me, np character(len=20), parameter :: name='mld_file_prec_descr' integer(psb_ipk_) :: iout_ @@ -490,9 +534,9 @@ contains end if if (iout_ < 0) iout_ = 6 - ictxt = p%ictxt + ictxt = prec%ictxt - if (allocated(p%precv)) then + if (allocated(prec%precv)) then call psb_info(ictxt,me,np) if (present(root)) then @@ -509,9 +553,9 @@ contains ! ensured by mld_precbld). ! if (me == root_) then - nlev = size(p%precv) + nlev = size(prec%precv) do ilev = 1, nlev - if (.not.allocated(p%precv(ilev)%sm)) then + if (.not.allocated(prec%precv(ilev)%sm)) then info = 3111 write(iout_,*) ' ',name,& & ': error: inconsistent MLPREC part, should call MLD_PRECINIT' @@ -527,26 +571,26 @@ contains ! if (nlev > 1) then write(iout_,*) 'Multilevel Preconditioner' - write(iout_,*) 'Outer sweeps:',p%outer_sweeps + write(iout_,*) 'Outer sweeps:',prec%outer_sweeps write(iout_,*) write(iout_,*) 'Base preconditioner (smoother) details' endif - call p%precv(1)%sm%descr(info,iout=iout_) + call prec%precv(1)%sm%descr(info,iout=iout_) if (nlev == 1) then - if (p%precv(1)%parms%sweeps > 1) then + if (prec%precv(1)%parms%sweeps > 1) then write(iout_,*) ' Number of smoother sweeps : ',& - & p%precv(1)%parms%sweeps + & prec%precv(1)%parms%sweeps end if write(iout_,*) return end if - if (allocated(p%precv(1)%sm2a)) then + if (allocated(prec%precv(1)%sm2a)) then write(iout_,*) 'Post smoother details' - call p%precv(1)%sm2a%descr(info,iout=iout_) + call prec%precv(1)%sm2a%descr(info,iout=iout_) if (nlev == 1) then - if (p%precv(1)%parms%sweeps > 1) then + if (prec%precv(1)%parms%sweeps > 1) then write(iout_,*) ' Number of smoother sweeps : ',& - & p%precv(1)%parms%sweeps + & prec%precv(1)%parms%sweeps end if write(iout_,*) return @@ -560,11 +604,11 @@ contains write(iout_,*) write(iout_,*) 'Multilevel details' write(iout_,*) ' Number of levels : ',nlev - write(iout_,*) ' Operator complexity: ',p%get_complexity() + write(iout_,*) ' Operator complexity: ',prec%get_complexity() ilmin = 2 if (nlev == 2) ilmin=1 do ilev=ilmin,nlev - call p%precv(ilev)%descr(ilev,nlev,ilmin,info,iout=iout_) + call prec%precv(ilev)%descr(ilev,nlev,ilmin,info,iout=iout_) end do write(iout_,*) @@ -673,7 +717,7 @@ contains select type(prec) type is (mld_dprec_type) - call mld_precaply(prec,x,y,desc_data,info,trans,work) + call mld_precapply(prec,x,y,desc_data,info,trans,work) class default info = psb_err_missing_override_method_ call psb_errpush(info,name) @@ -703,7 +747,7 @@ contains select type(prec) type is (mld_dprec_type) - call mld_precaply(prec,x,desc_data,info,trans,work) + call mld_precapply(prec,x,desc_data,info,trans,work) class default info = psb_err_missing_override_method_ call psb_errpush(info,name) @@ -735,7 +779,7 @@ contains select type(prec) type is (mld_dprec_type) - call mld_precaply(prec,x,y,desc_data,info,trans,work) + call mld_precapply(prec,x,y,desc_data,info,trans,work) class default info = psb_err_missing_override_method_ call psb_errpush(info,name) @@ -764,7 +808,7 @@ contains select type(prec) type is (mld_dprec_type) - call mld_precaply(prec,x,desc_data,info,trans) + call mld_precapply(prec,x,desc_data,info,trans) class default info = psb_err_missing_override_method_ call psb_errpush(info,name) diff --git a/mlprec/mld_s_inner_mod.f90 b/mlprec/mld_s_inner_mod.f90 index 9c7efbfc..c474071b 100644 --- a/mlprec/mld_s_inner_mod.f90 +++ b/mlprec/mld_s_inner_mod.f90 @@ -46,13 +46,17 @@ ! The interfaces of the user level routines are defined in mld_prec_mod.f90. ! module mld_s_inner_mod - use mld_s_prec_type +! use mld_s_prec_type, only : mld_s_prec_type + use psb_base_mod, only : psb_sspmat_type, psb_desc_type, psb_i_base_vect_type, & + & psb_spk_, psb_s_base_sparse_mat, psb_s_base_vect_type, psb_ipk_, & + & psb_s_vect_type + use mld_s_prec_type, only : mld_sprec_type, mld_sml_parms, mld_s_onelev_type interface mld_mlprec_bld subroutine mld_smlprec_bld(a,desc_a,prec,info, amold, vmold,imold) - use psb_base_mod, only : psb_sspmat_type, psb_desc_type, psb_i_base_vect_type, & + import :: psb_sspmat_type, psb_desc_type, psb_i_base_vect_type, & & psb_spk_, psb_s_base_sparse_mat, psb_s_base_vect_type, psb_ipk_ - use mld_s_prec_type, only : mld_sprec_type + import :: mld_sprec_type implicit none type(psb_sspmat_type), intent(in), target :: a type(psb_desc_type), intent(inout), target :: desc_a @@ -61,14 +65,13 @@ module mld_s_inner_mod class(psb_s_base_sparse_mat), intent(in), optional :: amold class(psb_s_base_vect_type), intent(in), optional :: vmold class(psb_i_base_vect_type), intent(in), optional :: imold -! !$ character, intent(in),optional :: upd end subroutine mld_smlprec_bld end interface mld_mlprec_bld interface mld_mlprec_aply subroutine mld_smlprec_aply(alpha,p,x,beta,y,desc_data,trans,work,info) - use psb_base_mod, only : psb_sspmat_type, psb_desc_type, psb_spk_, psb_ipk_ - use mld_s_prec_type, only : mld_sprec_type + import :: psb_sspmat_type, psb_desc_type, psb_spk_, psb_ipk_ + import :: mld_sprec_type implicit none type(psb_desc_type),intent(in) :: desc_data type(mld_sprec_type), intent(inout) :: p @@ -80,9 +83,9 @@ module mld_s_inner_mod integer(psb_ipk_), intent(out) :: info end subroutine mld_smlprec_aply subroutine mld_smlprec_aply_vect(alpha,p,x,beta,y,desc_data,trans,work,info) - use psb_base_mod, only : psb_sspmat_type, psb_desc_type, & + import :: psb_sspmat_type, psb_desc_type, & & psb_spk_, psb_s_vect_type, psb_ipk_ - use mld_s_prec_type, only : mld_sprec_type + import :: mld_sprec_type implicit none type(psb_desc_type),intent(in) :: desc_data type(mld_sprec_type), intent(inout) :: p @@ -97,8 +100,8 @@ module mld_s_inner_mod interface mld_aggrmap_bld subroutine mld_s_lev_aggrmap_bld(p,a,desc_a,ilaggr,nlaggr,op_prol,info) - use psb_base_mod, only : psb_sspmat_type, psb_desc_type, psb_spk_, psb_ipk_ - use mld_s_prec_type, only : mld_s_onelev_type + import :: psb_sspmat_type, psb_desc_type, psb_spk_, psb_ipk_ + import :: mld_s_onelev_type implicit none type(mld_s_onelev_type), intent(inout), target :: p type(psb_sspmat_type), intent(in) :: a @@ -108,7 +111,7 @@ module mld_s_inner_mod integer(psb_ipk_), intent(out) :: info end subroutine mld_s_lev_aggrmap_bld subroutine mld_saggrmap_bld(aggr_type,iorder,theta,a,desc_a,ilaggr,nlaggr,op_prol,info) - use psb_base_mod, only : psb_sspmat_type, psb_desc_type, psb_spk_, psb_ipk_ + import :: psb_sspmat_type, psb_desc_type, psb_spk_, psb_ipk_ implicit none integer(psb_ipk_), intent(in) :: iorder integer(psb_ipk_), intent(in) :: aggr_type @@ -124,7 +127,7 @@ module mld_s_inner_mod interface mld_dec_map_bld subroutine mld_s_dec_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info) - use psb_base_mod, only : psb_sspmat_type, psb_desc_type, psb_spk_, psb_ipk_ + import :: psb_sspmat_type, psb_desc_type, psb_spk_, psb_ipk_ implicit none integer(psb_ipk_), intent(in) :: iorder type(psb_sspmat_type), intent(in) :: a @@ -138,8 +141,8 @@ module mld_s_inner_mod interface mld_lev_mat_asb subroutine mld_s_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info) - use psb_base_mod, only : psb_sspmat_type, psb_desc_type, psb_spk_, psb_ipk_ - use mld_s_prec_type, only : mld_s_onelev_type + import :: psb_sspmat_type, psb_desc_type, psb_spk_, psb_ipk_ + import :: mld_s_onelev_type implicit none type(mld_s_onelev_type), intent(inout), target :: p type(psb_sspmat_type), intent(in) :: a @@ -152,8 +155,8 @@ module mld_s_inner_mod interface mld_aggrmat_asb subroutine mld_saggrmat_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info) - use psb_base_mod, only : psb_sspmat_type, psb_desc_type, psb_spk_, psb_ipk_ - use mld_s_prec_type, only : mld_sml_parms + import :: psb_sspmat_type, psb_desc_type, psb_spk_, psb_ipk_ + import :: mld_sml_parms implicit none type(psb_sspmat_type), intent(in) :: a type(psb_desc_type), intent(in) :: desc_a @@ -166,8 +169,8 @@ module mld_s_inner_mod abstract interface subroutine mld_saggrmat_var_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info) - use psb_base_mod, only : psb_sspmat_type, psb_desc_type, psb_spk_, psb_ipk_ - use mld_s_prec_type, only : mld_s_onelev_type, mld_sml_parms + import :: psb_sspmat_type, psb_desc_type, psb_spk_, psb_ipk_ + import :: mld_s_onelev_type, mld_sml_parms implicit none type(psb_sspmat_type), intent(in) :: a type(psb_desc_type), intent(in) :: desc_a diff --git a/mlprec/mld_s_onelev_mod.f90 b/mlprec/mld_s_onelev_mod.f90 index 88bbe655..acecd951 100644 --- a/mlprec/mld_s_onelev_mod.f90 +++ b/mlprec/mld_s_onelev_mod.f90 @@ -435,7 +435,7 @@ contains lv%parms%sweeps = 1 lv%parms%sweeps_pre = 1 lv%parms%sweeps_post = 1 - lv%parms%ml_type = mld_mult_ml_ + lv%parms%ml_type = mld_vcycle_ml_ lv%parms%aggr_alg = mld_dec_aggr_ lv%parms%aggr_ord = mld_aggr_ord_nat_ lv%parms%aggr_kind = mld_smooth_prol_ diff --git a/mlprec/mld_s_prec_mod.f90 b/mlprec/mld_s_prec_mod.f90 index 7dd7ff69..bb1494a8 100644 --- a/mlprec/mld_s_prec_mod.f90 +++ b/mlprec/mld_s_prec_mod.f90 @@ -54,53 +54,12 @@ module mld_s_prec_mod use mld_s_ilu_solver use mld_s_gs_solver - interface mld_precinit - subroutine mld_sprecinit(p,ptype,info,nlev) - import :: psb_sspmat_type, psb_desc_type, psb_spk_, & - & mld_sprec_type, psb_ipk_ - type(mld_sprec_type), intent(inout) :: p - character(len=*), intent(in) :: ptype - integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: nlev - end subroutine mld_sprecinit - end interface mld_precinit - interface mld_precset module procedure mld_s_iprecsetsm, mld_s_iprecsetsv, & & mld_s_iprecseti, mld_s_iprecsetc, mld_s_iprecsetr, & & mld_s_cprecseti, mld_s_cprecsetc, mld_s_cprecsetr end interface mld_precset - interface mld_precbld - subroutine mld_sprecbld(a,desc_a,prec,info,amold,vmold,imold) - import :: psb_sspmat_type, psb_desc_type, psb_spk_, & - & psb_s_base_sparse_mat, psb_s_base_vect_type, & - & psb_i_base_vect_type, mld_sprec_type, psb_ipk_ - implicit none - type(psb_sspmat_type), intent(in), target :: a - type(psb_desc_type), intent(inout), target :: desc_a - type(mld_sprec_type), intent(inout), target :: prec - integer(psb_ipk_), intent(out) :: info - class(psb_s_base_sparse_mat), intent(in), optional :: amold - class(psb_s_base_vect_type), intent(in), optional :: vmold - class(psb_i_base_vect_type), intent(in), optional :: imold - ! character, intent(in),optional :: upd - end subroutine mld_sprecbld - end interface mld_precbld - - interface mld_hierarchy_bld - subroutine mld_s_hierarchy_bld(a,desc_a,prec,info) - import :: psb_sspmat_type, psb_desc_type, psb_spk_, & - & mld_sprec_type, psb_ipk_ - implicit none - type(psb_sspmat_type), intent(in), target :: a - type(psb_desc_type), intent(inout), target :: desc_a - type(mld_sprec_type), intent(inout), target :: prec - integer(psb_ipk_), intent(out) :: info - ! character, intent(in),optional :: upd - end subroutine mld_s_hierarchy_bld - end interface mld_hierarchy_bld - interface mld_extprol_bld subroutine mld_s_extprol_bld(a,desc_a,p,prolv,restrv,info,amold,vmold,imold) import :: psb_sspmat_type, psb_desc_type, psb_spk_, & @@ -121,23 +80,6 @@ module mld_s_prec_mod end subroutine mld_s_extprol_bld end interface mld_extprol_bld - interface mld_smoothers_bld - subroutine mld_s_smoothers_bld(a,desc_a,prec,info,amold,vmold,imold) - import :: psb_sspmat_type, psb_desc_type, psb_spk_, & - & psb_s_base_sparse_mat, psb_s_base_vect_type, & - & psb_i_base_vect_type, mld_sprec_type, psb_ipk_ - implicit none - type(psb_sspmat_type), intent(in), target :: a - type(psb_desc_type), intent(inout), target :: desc_a - type(mld_sprec_type), intent(inout), target :: prec - integer(psb_ipk_), intent(out) :: info - class(psb_s_base_sparse_mat), intent(in), optional :: amold - class(psb_s_base_vect_type), intent(in), optional :: vmold - class(psb_i_base_vect_type), intent(in), optional :: imold - ! character, intent(in),optional :: upd - end subroutine mld_s_smoothers_bld - end interface mld_smoothers_bld - contains subroutine mld_s_iprecsetsm(p,val,info,pos) diff --git a/mlprec/mld_s_prec_type.f90 b/mlprec/mld_s_prec_type.f90 index f6bb18c7..c8aff456 100644 --- a/mlprec/mld_s_prec_type.f90 +++ b/mlprec/mld_s_prec_type.f90 @@ -136,6 +136,11 @@ module mld_s_prec_type procedure, pass(prec) :: get_smoother => mld_s_get_smootherp procedure, pass(prec) :: get_solver => mld_s_get_solverp procedure, pass(prec) :: move_alloc => s_prec_move_alloc + procedure, pass(prec) :: init => mld_sprecinit + procedure, pass(prec) :: build => mld_sprecbld + procedure, pass(prec) :: hierarchy_build => mld_s_hierarchy_bld + procedure, pass(prec) :: smoothers_build => mld_s_smoothers_bld + procedure, pass(prec) :: descr => mld_sfile_prec_descr end type mld_sprec_type private :: mld_s_dump, mld_s_get_compl, mld_s_cmp_compl,& @@ -160,7 +165,7 @@ module mld_s_prec_type module procedure mld_sprec_sizeof end interface - interface mld_precaply + interface mld_precapply subroutine mld_sprecaply2_vect(prec,x,y,desc_data,info,trans,work) import :: psb_sspmat_type, psb_desc_type, & & psb_spk_, psb_s_vect_type, mld_sprec_type, psb_ipk_ @@ -283,6 +288,63 @@ module mld_s_prec_type end subroutine mld_scprecsetc end interface + interface mld_precinit + subroutine mld_sprecinit(prec,ptype,info) + import :: psb_sspmat_type, psb_desc_type, psb_spk_, & + & mld_sprec_type, psb_ipk_ + class(mld_sprec_type), intent(inout) :: prec + character(len=*), intent(in) :: ptype + integer(psb_ipk_), intent(out) :: info + end subroutine mld_sprecinit + end interface mld_precinit + + interface mld_precbld + subroutine mld_sprecbld(a,desc_a,prec,info,amold,vmold,imold) + import :: psb_sspmat_type, psb_desc_type, psb_spk_, & + & psb_s_base_sparse_mat, psb_s_base_vect_type, & + & psb_i_base_vect_type, mld_sprec_type, psb_ipk_ + implicit none + type(psb_sspmat_type), intent(in), target :: a + type(psb_desc_type), intent(inout), target :: desc_a + class(mld_sprec_type), intent(inout), target :: prec + integer(psb_ipk_), intent(out) :: info + class(psb_s_base_sparse_mat), intent(in), optional :: amold + class(psb_s_base_vect_type), intent(in), optional :: vmold + class(psb_i_base_vect_type), intent(in), optional :: imold + ! character, intent(in),optional :: upd + end subroutine mld_sprecbld + end interface mld_precbld + + interface mld_hierarchy_bld + subroutine mld_s_hierarchy_bld(a,desc_a,prec,info) + import :: psb_sspmat_type, psb_desc_type, psb_spk_, & + & mld_sprec_type, psb_ipk_ + implicit none + type(psb_sspmat_type), intent(in), target :: a + type(psb_desc_type), intent(inout), target :: desc_a + class(mld_sprec_type), intent(inout), target :: prec + integer(psb_ipk_), intent(out) :: info + ! character, intent(in),optional :: upd + end subroutine mld_s_hierarchy_bld + end interface mld_hierarchy_bld + + interface mld_smoothers_bld + subroutine mld_s_smoothers_bld(a,desc_a,prec,info,amold,vmold,imold) + import :: psb_sspmat_type, psb_desc_type, psb_spk_, & + & psb_s_base_sparse_mat, psb_s_base_vect_type, & + & psb_i_base_vect_type, mld_sprec_type, psb_ipk_ + implicit none + type(psb_sspmat_type), intent(in), target :: a + type(psb_desc_type), intent(inout), target :: desc_a + class(mld_sprec_type), intent(inout), target :: prec + integer(psb_ipk_), intent(out) :: info + class(psb_s_base_sparse_mat), intent(in), optional :: amold + class(psb_s_base_vect_type), intent(in), optional :: vmold + class(psb_i_base_vect_type), intent(in), optional :: imold + ! character, intent(in),optional :: upd + end subroutine mld_s_smoothers_bld + end interface mld_smoothers_bld + contains ! ! Function returning a pointer to the smoother @@ -450,16 +512,15 @@ contains ! The id of the process printing the message; -1 acts as a wildcard. ! Default is psb_root_ ! - subroutine mld_sfile_prec_descr(p,info,iout,root) + subroutine mld_sfile_prec_descr(prec,iout,root) implicit none ! Arguments - type(mld_sprec_type), intent(in) :: p - integer(psb_ipk_), intent(out) :: info + class(mld_sprec_type), intent(in) :: prec integer(psb_ipk_), intent(in), optional :: iout integer(psb_ipk_), intent(in), optional :: root ! Local variables - integer(psb_ipk_) :: ilev, nlev, ilmin + integer(psb_ipk_) :: ilev, nlev, ilmin, info integer(psb_ipk_) :: ictxt, me, np character(len=20), parameter :: name='mld_file_prec_descr' integer(psb_ipk_) :: iout_ @@ -473,9 +534,9 @@ contains end if if (iout_ < 0) iout_ = 6 - ictxt = p%ictxt + ictxt = prec%ictxt - if (allocated(p%precv)) then + if (allocated(prec%precv)) then call psb_info(ictxt,me,np) if (present(root)) then @@ -492,9 +553,9 @@ contains ! ensured by mld_precbld). ! if (me == root_) then - nlev = size(p%precv) + nlev = size(prec%precv) do ilev = 1, nlev - if (.not.allocated(p%precv(ilev)%sm)) then + if (.not.allocated(prec%precv(ilev)%sm)) then info = 3111 write(iout_,*) ' ',name,& & ': error: inconsistent MLPREC part, should call MLD_PRECINIT' @@ -510,26 +571,26 @@ contains ! if (nlev > 1) then write(iout_,*) 'Multilevel Preconditioner' - write(iout_,*) 'Outer sweeps:',p%outer_sweeps + write(iout_,*) 'Outer sweeps:',prec%outer_sweeps write(iout_,*) write(iout_,*) 'Base preconditioner (smoother) details' endif - call p%precv(1)%sm%descr(info,iout=iout_) + call prec%precv(1)%sm%descr(info,iout=iout_) if (nlev == 1) then - if (p%precv(1)%parms%sweeps > 1) then + if (prec%precv(1)%parms%sweeps > 1) then write(iout_,*) ' Number of smoother sweeps : ',& - & p%precv(1)%parms%sweeps + & prec%precv(1)%parms%sweeps end if write(iout_,*) return end if - if (allocated(p%precv(1)%sm2a)) then + if (allocated(prec%precv(1)%sm2a)) then write(iout_,*) 'Post smoother details' - call p%precv(1)%sm2a%descr(info,iout=iout_) + call prec%precv(1)%sm2a%descr(info,iout=iout_) if (nlev == 1) then - if (p%precv(1)%parms%sweeps > 1) then + if (prec%precv(1)%parms%sweeps > 1) then write(iout_,*) ' Number of smoother sweeps : ',& - & p%precv(1)%parms%sweeps + & prec%precv(1)%parms%sweeps end if write(iout_,*) return @@ -543,11 +604,11 @@ contains write(iout_,*) write(iout_,*) 'Multilevel details' write(iout_,*) ' Number of levels : ',nlev - write(iout_,*) ' Operator complexity: ',p%get_complexity() + write(iout_,*) ' Operator complexity: ',prec%get_complexity() ilmin = 2 if (nlev == 2) ilmin=1 do ilev=ilmin,nlev - call p%precv(ilev)%descr(ilev,nlev,ilmin,info,iout=iout_) + call prec%precv(ilev)%descr(ilev,nlev,ilmin,info,iout=iout_) end do write(iout_,*) @@ -656,7 +717,7 @@ contains select type(prec) type is (mld_sprec_type) - call mld_precaply(prec,x,y,desc_data,info,trans,work) + call mld_precapply(prec,x,y,desc_data,info,trans,work) class default info = psb_err_missing_override_method_ call psb_errpush(info,name) @@ -686,7 +747,7 @@ contains select type(prec) type is (mld_sprec_type) - call mld_precaply(prec,x,desc_data,info,trans,work) + call mld_precapply(prec,x,desc_data,info,trans,work) class default info = psb_err_missing_override_method_ call psb_errpush(info,name) @@ -718,7 +779,7 @@ contains select type(prec) type is (mld_sprec_type) - call mld_precaply(prec,x,y,desc_data,info,trans,work) + call mld_precapply(prec,x,y,desc_data,info,trans,work) class default info = psb_err_missing_override_method_ call psb_errpush(info,name) @@ -747,7 +808,7 @@ contains select type(prec) type is (mld_sprec_type) - call mld_precaply(prec,x,desc_data,info,trans) + call mld_precapply(prec,x,desc_data,info,trans) class default info = psb_err_missing_override_method_ call psb_errpush(info,name) diff --git a/mlprec/mld_z_inner_mod.f90 b/mlprec/mld_z_inner_mod.f90 index 948a442d..88dfd655 100644 --- a/mlprec/mld_z_inner_mod.f90 +++ b/mlprec/mld_z_inner_mod.f90 @@ -46,13 +46,17 @@ ! The interfaces of the user level routines are defined in mld_prec_mod.f90. ! module mld_z_inner_mod - use mld_z_prec_type +! use mld_z_prec_type, only : mld_z_prec_type + use psb_base_mod, only : psb_zspmat_type, psb_desc_type, psb_i_base_vect_type, & + & psb_dpk_, psb_z_base_sparse_mat, psb_z_base_vect_type, psb_ipk_, & + & psb_z_vect_type + use mld_z_prec_type, only : mld_zprec_type, mld_dml_parms, mld_z_onelev_type interface mld_mlprec_bld subroutine mld_zmlprec_bld(a,desc_a,prec,info, amold, vmold,imold) - use psb_base_mod, only : psb_zspmat_type, psb_desc_type, psb_i_base_vect_type, & + import :: psb_zspmat_type, psb_desc_type, psb_i_base_vect_type, & & psb_dpk_, psb_z_base_sparse_mat, psb_z_base_vect_type, psb_ipk_ - use mld_z_prec_type, only : mld_zprec_type + import :: mld_zprec_type implicit none type(psb_zspmat_type), intent(in), target :: a type(psb_desc_type), intent(inout), target :: desc_a @@ -61,14 +65,13 @@ module mld_z_inner_mod class(psb_z_base_sparse_mat), intent(in), optional :: amold class(psb_z_base_vect_type), intent(in), optional :: vmold class(psb_i_base_vect_type), intent(in), optional :: imold -! !$ character, intent(in),optional :: upd end subroutine mld_zmlprec_bld end interface mld_mlprec_bld interface mld_mlprec_aply subroutine mld_zmlprec_aply(alpha,p,x,beta,y,desc_data,trans,work,info) - use psb_base_mod, only : psb_zspmat_type, psb_desc_type, psb_dpk_, psb_ipk_ - use mld_z_prec_type, only : mld_zprec_type + import :: psb_zspmat_type, psb_desc_type, psb_dpk_, psb_ipk_ + import :: mld_zprec_type implicit none type(psb_desc_type),intent(in) :: desc_data type(mld_zprec_type), intent(inout) :: p @@ -80,9 +83,9 @@ module mld_z_inner_mod integer(psb_ipk_), intent(out) :: info end subroutine mld_zmlprec_aply subroutine mld_zmlprec_aply_vect(alpha,p,x,beta,y,desc_data,trans,work,info) - use psb_base_mod, only : psb_zspmat_type, psb_desc_type, & + import :: psb_zspmat_type, psb_desc_type, & & psb_dpk_, psb_z_vect_type, psb_ipk_ - use mld_z_prec_type, only : mld_zprec_type + import :: mld_zprec_type implicit none type(psb_desc_type),intent(in) :: desc_data type(mld_zprec_type), intent(inout) :: p @@ -97,8 +100,8 @@ module mld_z_inner_mod interface mld_aggrmap_bld subroutine mld_z_lev_aggrmap_bld(p,a,desc_a,ilaggr,nlaggr,op_prol,info) - use psb_base_mod, only : psb_zspmat_type, psb_desc_type, psb_dpk_, psb_ipk_ - use mld_z_prec_type, only : mld_z_onelev_type + import :: psb_zspmat_type, psb_desc_type, psb_dpk_, psb_ipk_ + import :: mld_z_onelev_type implicit none type(mld_z_onelev_type), intent(inout), target :: p type(psb_zspmat_type), intent(in) :: a @@ -108,7 +111,7 @@ module mld_z_inner_mod integer(psb_ipk_), intent(out) :: info end subroutine mld_z_lev_aggrmap_bld subroutine mld_zaggrmap_bld(aggr_type,iorder,theta,a,desc_a,ilaggr,nlaggr,op_prol,info) - use psb_base_mod, only : psb_zspmat_type, psb_desc_type, psb_dpk_, psb_ipk_ + import :: psb_zspmat_type, psb_desc_type, psb_dpk_, psb_ipk_ implicit none integer(psb_ipk_), intent(in) :: iorder integer(psb_ipk_), intent(in) :: aggr_type @@ -124,7 +127,7 @@ module mld_z_inner_mod interface mld_dec_map_bld subroutine mld_z_dec_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info) - use psb_base_mod, only : psb_zspmat_type, psb_desc_type, psb_dpk_, psb_ipk_ + import :: psb_zspmat_type, psb_desc_type, psb_dpk_, psb_ipk_ implicit none integer(psb_ipk_), intent(in) :: iorder type(psb_zspmat_type), intent(in) :: a @@ -138,8 +141,8 @@ module mld_z_inner_mod interface mld_lev_mat_asb subroutine mld_z_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info) - use psb_base_mod, only : psb_zspmat_type, psb_desc_type, psb_dpk_, psb_ipk_ - use mld_z_prec_type, only : mld_z_onelev_type + import :: psb_zspmat_type, psb_desc_type, psb_dpk_, psb_ipk_ + import :: mld_z_onelev_type implicit none type(mld_z_onelev_type), intent(inout), target :: p type(psb_zspmat_type), intent(in) :: a @@ -152,8 +155,8 @@ module mld_z_inner_mod interface mld_aggrmat_asb subroutine mld_zaggrmat_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info) - use psb_base_mod, only : psb_zspmat_type, psb_desc_type, psb_dpk_, psb_ipk_ - use mld_z_prec_type, only : mld_dml_parms + import :: psb_zspmat_type, psb_desc_type, psb_dpk_, psb_ipk_ + import :: mld_dml_parms implicit none type(psb_zspmat_type), intent(in) :: a type(psb_desc_type), intent(in) :: desc_a @@ -166,8 +169,8 @@ module mld_z_inner_mod abstract interface subroutine mld_zaggrmat_var_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info) - use psb_base_mod, only : psb_zspmat_type, psb_desc_type, psb_dpk_, psb_ipk_ - use mld_z_prec_type, only : mld_z_onelev_type, mld_dml_parms + import :: psb_zspmat_type, psb_desc_type, psb_dpk_, psb_ipk_ + import :: mld_z_onelev_type, mld_dml_parms implicit none type(psb_zspmat_type), intent(in) :: a type(psb_desc_type), intent(in) :: desc_a diff --git a/mlprec/mld_z_onelev_mod.f90 b/mlprec/mld_z_onelev_mod.f90 index b52dbee5..8a71887e 100644 --- a/mlprec/mld_z_onelev_mod.f90 +++ b/mlprec/mld_z_onelev_mod.f90 @@ -435,7 +435,7 @@ contains lv%parms%sweeps = 1 lv%parms%sweeps_pre = 1 lv%parms%sweeps_post = 1 - lv%parms%ml_type = mld_mult_ml_ + lv%parms%ml_type = mld_vcycle_ml_ lv%parms%aggr_alg = mld_dec_aggr_ lv%parms%aggr_ord = mld_aggr_ord_nat_ lv%parms%aggr_kind = mld_smooth_prol_ diff --git a/mlprec/mld_z_prec_mod.f90 b/mlprec/mld_z_prec_mod.f90 index af3f2411..ac10dd89 100644 --- a/mlprec/mld_z_prec_mod.f90 +++ b/mlprec/mld_z_prec_mod.f90 @@ -54,53 +54,12 @@ module mld_z_prec_mod use mld_z_ilu_solver use mld_z_gs_solver - interface mld_precinit - subroutine mld_zprecinit(p,ptype,info,nlev) - import :: psb_zspmat_type, psb_desc_type, psb_dpk_, & - & mld_zprec_type, psb_ipk_ - type(mld_zprec_type), intent(inout) :: p - character(len=*), intent(in) :: ptype - integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: nlev - end subroutine mld_zprecinit - end interface mld_precinit - interface mld_precset module procedure mld_z_iprecsetsm, mld_z_iprecsetsv, & & mld_z_iprecseti, mld_z_iprecsetc, mld_z_iprecsetr, & & mld_z_cprecseti, mld_z_cprecsetc, mld_z_cprecsetr end interface mld_precset - interface mld_precbld - subroutine mld_zprecbld(a,desc_a,prec,info,amold,vmold,imold) - import :: psb_zspmat_type, psb_desc_type, psb_dpk_, & - & psb_z_base_sparse_mat, psb_z_base_vect_type, & - & psb_i_base_vect_type, mld_zprec_type, psb_ipk_ - implicit none - type(psb_zspmat_type), intent(in), target :: a - type(psb_desc_type), intent(inout), target :: desc_a - type(mld_zprec_type), intent(inout), target :: prec - integer(psb_ipk_), intent(out) :: info - class(psb_z_base_sparse_mat), intent(in), optional :: amold - class(psb_z_base_vect_type), intent(in), optional :: vmold - class(psb_i_base_vect_type), intent(in), optional :: imold - ! character, intent(in),optional :: upd - end subroutine mld_zprecbld - end interface mld_precbld - - interface mld_hierarchy_bld - subroutine mld_z_hierarchy_bld(a,desc_a,prec,info) - import :: psb_zspmat_type, psb_desc_type, psb_dpk_, & - & mld_zprec_type, psb_ipk_ - implicit none - type(psb_zspmat_type), intent(in), target :: a - type(psb_desc_type), intent(inout), target :: desc_a - type(mld_zprec_type), intent(inout), target :: prec - integer(psb_ipk_), intent(out) :: info - ! character, intent(in),optional :: upd - end subroutine mld_z_hierarchy_bld - end interface mld_hierarchy_bld - interface mld_extprol_bld subroutine mld_z_extprol_bld(a,desc_a,p,prolv,restrv,info,amold,vmold,imold) import :: psb_zspmat_type, psb_desc_type, psb_dpk_, & @@ -121,23 +80,6 @@ module mld_z_prec_mod end subroutine mld_z_extprol_bld end interface mld_extprol_bld - interface mld_smoothers_bld - subroutine mld_z_smoothers_bld(a,desc_a,prec,info,amold,vmold,imold) - import :: psb_zspmat_type, psb_desc_type, psb_dpk_, & - & psb_z_base_sparse_mat, psb_z_base_vect_type, & - & psb_i_base_vect_type, mld_zprec_type, psb_ipk_ - implicit none - type(psb_zspmat_type), intent(in), target :: a - type(psb_desc_type), intent(inout), target :: desc_a - type(mld_zprec_type), intent(inout), target :: prec - integer(psb_ipk_), intent(out) :: info - class(psb_z_base_sparse_mat), intent(in), optional :: amold - class(psb_z_base_vect_type), intent(in), optional :: vmold - class(psb_i_base_vect_type), intent(in), optional :: imold - ! character, intent(in),optional :: upd - end subroutine mld_z_smoothers_bld - end interface mld_smoothers_bld - contains subroutine mld_z_iprecsetsm(p,val,info,pos) diff --git a/mlprec/mld_z_prec_type.f90 b/mlprec/mld_z_prec_type.f90 index ef7053c2..25a9a2a6 100644 --- a/mlprec/mld_z_prec_type.f90 +++ b/mlprec/mld_z_prec_type.f90 @@ -136,6 +136,11 @@ module mld_z_prec_type procedure, pass(prec) :: get_smoother => mld_z_get_smootherp procedure, pass(prec) :: get_solver => mld_z_get_solverp procedure, pass(prec) :: move_alloc => z_prec_move_alloc + procedure, pass(prec) :: init => mld_zprecinit + procedure, pass(prec) :: build => mld_zprecbld + procedure, pass(prec) :: hierarchy_build => mld_z_hierarchy_bld + procedure, pass(prec) :: smoothers_build => mld_z_smoothers_bld + procedure, pass(prec) :: descr => mld_zfile_prec_descr end type mld_zprec_type private :: mld_z_dump, mld_z_get_compl, mld_z_cmp_compl,& @@ -160,7 +165,7 @@ module mld_z_prec_type module procedure mld_zprec_sizeof end interface - interface mld_precaply + interface mld_precapply subroutine mld_zprecaply2_vect(prec,x,y,desc_data,info,trans,work) import :: psb_zspmat_type, psb_desc_type, & & psb_dpk_, psb_z_vect_type, mld_zprec_type, psb_ipk_ @@ -283,6 +288,63 @@ module mld_z_prec_type end subroutine mld_zcprecsetc end interface + interface mld_precinit + subroutine mld_zprecinit(prec,ptype,info) + import :: psb_zspmat_type, psb_desc_type, psb_dpk_, & + & mld_zprec_type, psb_ipk_ + class(mld_zprec_type), intent(inout) :: prec + character(len=*), intent(in) :: ptype + integer(psb_ipk_), intent(out) :: info + end subroutine mld_zprecinit + end interface mld_precinit + + interface mld_precbld + subroutine mld_zprecbld(a,desc_a,prec,info,amold,vmold,imold) + import :: psb_zspmat_type, psb_desc_type, psb_dpk_, & + & psb_z_base_sparse_mat, psb_z_base_vect_type, & + & psb_i_base_vect_type, mld_zprec_type, psb_ipk_ + implicit none + type(psb_zspmat_type), intent(in), target :: a + type(psb_desc_type), intent(inout), target :: desc_a + class(mld_zprec_type), intent(inout), target :: prec + integer(psb_ipk_), intent(out) :: info + class(psb_z_base_sparse_mat), intent(in), optional :: amold + class(psb_z_base_vect_type), intent(in), optional :: vmold + class(psb_i_base_vect_type), intent(in), optional :: imold + ! character, intent(in),optional :: upd + end subroutine mld_zprecbld + end interface mld_precbld + + interface mld_hierarchy_bld + subroutine mld_z_hierarchy_bld(a,desc_a,prec,info) + import :: psb_zspmat_type, psb_desc_type, psb_dpk_, & + & mld_zprec_type, psb_ipk_ + implicit none + type(psb_zspmat_type), intent(in), target :: a + type(psb_desc_type), intent(inout), target :: desc_a + class(mld_zprec_type), intent(inout), target :: prec + integer(psb_ipk_), intent(out) :: info + ! character, intent(in),optional :: upd + end subroutine mld_z_hierarchy_bld + end interface mld_hierarchy_bld + + interface mld_smoothers_bld + subroutine mld_z_smoothers_bld(a,desc_a,prec,info,amold,vmold,imold) + import :: psb_zspmat_type, psb_desc_type, psb_dpk_, & + & psb_z_base_sparse_mat, psb_z_base_vect_type, & + & psb_i_base_vect_type, mld_zprec_type, psb_ipk_ + implicit none + type(psb_zspmat_type), intent(in), target :: a + type(psb_desc_type), intent(inout), target :: desc_a + class(mld_zprec_type), intent(inout), target :: prec + integer(psb_ipk_), intent(out) :: info + class(psb_z_base_sparse_mat), intent(in), optional :: amold + class(psb_z_base_vect_type), intent(in), optional :: vmold + class(psb_i_base_vect_type), intent(in), optional :: imold + ! character, intent(in),optional :: upd + end subroutine mld_z_smoothers_bld + end interface mld_smoothers_bld + contains ! ! Function returning a pointer to the smoother @@ -450,16 +512,15 @@ contains ! The id of the process printing the message; -1 acts as a wildcard. ! Default is psb_root_ ! - subroutine mld_zfile_prec_descr(p,info,iout,root) + subroutine mld_zfile_prec_descr(prec,iout,root) implicit none ! Arguments - type(mld_zprec_type), intent(in) :: p - integer(psb_ipk_), intent(out) :: info + class(mld_zprec_type), intent(in) :: prec integer(psb_ipk_), intent(in), optional :: iout integer(psb_ipk_), intent(in), optional :: root ! Local variables - integer(psb_ipk_) :: ilev, nlev, ilmin + integer(psb_ipk_) :: ilev, nlev, ilmin, info integer(psb_ipk_) :: ictxt, me, np character(len=20), parameter :: name='mld_file_prec_descr' integer(psb_ipk_) :: iout_ @@ -473,9 +534,9 @@ contains end if if (iout_ < 0) iout_ = 6 - ictxt = p%ictxt + ictxt = prec%ictxt - if (allocated(p%precv)) then + if (allocated(prec%precv)) then call psb_info(ictxt,me,np) if (present(root)) then @@ -492,9 +553,9 @@ contains ! ensured by mld_precbld). ! if (me == root_) then - nlev = size(p%precv) + nlev = size(prec%precv) do ilev = 1, nlev - if (.not.allocated(p%precv(ilev)%sm)) then + if (.not.allocated(prec%precv(ilev)%sm)) then info = 3111 write(iout_,*) ' ',name,& & ': error: inconsistent MLPREC part, should call MLD_PRECINIT' @@ -510,26 +571,26 @@ contains ! if (nlev > 1) then write(iout_,*) 'Multilevel Preconditioner' - write(iout_,*) 'Outer sweeps:',p%outer_sweeps + write(iout_,*) 'Outer sweeps:',prec%outer_sweeps write(iout_,*) write(iout_,*) 'Base preconditioner (smoother) details' endif - call p%precv(1)%sm%descr(info,iout=iout_) + call prec%precv(1)%sm%descr(info,iout=iout_) if (nlev == 1) then - if (p%precv(1)%parms%sweeps > 1) then + if (prec%precv(1)%parms%sweeps > 1) then write(iout_,*) ' Number of smoother sweeps : ',& - & p%precv(1)%parms%sweeps + & prec%precv(1)%parms%sweeps end if write(iout_,*) return end if - if (allocated(p%precv(1)%sm2a)) then + if (allocated(prec%precv(1)%sm2a)) then write(iout_,*) 'Post smoother details' - call p%precv(1)%sm2a%descr(info,iout=iout_) + call prec%precv(1)%sm2a%descr(info,iout=iout_) if (nlev == 1) then - if (p%precv(1)%parms%sweeps > 1) then + if (prec%precv(1)%parms%sweeps > 1) then write(iout_,*) ' Number of smoother sweeps : ',& - & p%precv(1)%parms%sweeps + & prec%precv(1)%parms%sweeps end if write(iout_,*) return @@ -543,11 +604,11 @@ contains write(iout_,*) write(iout_,*) 'Multilevel details' write(iout_,*) ' Number of levels : ',nlev - write(iout_,*) ' Operator complexity: ',p%get_complexity() + write(iout_,*) ' Operator complexity: ',prec%get_complexity() ilmin = 2 if (nlev == 2) ilmin=1 do ilev=ilmin,nlev - call p%precv(ilev)%descr(ilev,nlev,ilmin,info,iout=iout_) + call prec%precv(ilev)%descr(ilev,nlev,ilmin,info,iout=iout_) end do write(iout_,*) @@ -656,7 +717,7 @@ contains select type(prec) type is (mld_zprec_type) - call mld_precaply(prec,x,y,desc_data,info,trans,work) + call mld_precapply(prec,x,y,desc_data,info,trans,work) class default info = psb_err_missing_override_method_ call psb_errpush(info,name) @@ -686,7 +747,7 @@ contains select type(prec) type is (mld_zprec_type) - call mld_precaply(prec,x,desc_data,info,trans,work) + call mld_precapply(prec,x,desc_data,info,trans,work) class default info = psb_err_missing_override_method_ call psb_errpush(info,name) @@ -718,7 +779,7 @@ contains select type(prec) type is (mld_zprec_type) - call mld_precaply(prec,x,y,desc_data,info,trans,work) + call mld_precapply(prec,x,y,desc_data,info,trans,work) class default info = psb_err_missing_override_method_ call psb_errpush(info,name) @@ -747,7 +808,7 @@ contains select type(prec) type is (mld_zprec_type) - call mld_precaply(prec,x,desc_data,info,trans) + call mld_precapply(prec,x,desc_data,info,trans) class default info = psb_err_missing_override_method_ call psb_errpush(info,name) diff --git a/tests/fileread/Makefile b/tests/fileread/Makefile index d7160d92..2c0b14e7 100644 --- a/tests/fileread/Makefile +++ b/tests/fileread/Makefile @@ -15,23 +15,23 @@ EXEDIR=./runs all: mld_sf_sample mld_df_sample mld_cf_sample mld_zf_sample mld_df_sample: $(DFSOBJS) - $(F90LINK) $(LINKOPT) $(DFSOBJS) -o mld_df_sample \ + $(FLINK) $(LINKOPT) $(DFSOBJS) -o mld_df_sample \ $(MLD_LIBS) $(PSBLAS_LIBS) $(LDLIBS) /bin/mv mld_df_sample $(EXEDIR) mld_sf_sample: $(SFSOBJS) - $(F90LINK) $(LINKOPT) $(SFSOBJS) -o mld_sf_sample \ + $(FLINK) $(LINKOPT) $(SFSOBJS) -o mld_sf_sample \ $(MLD_LIBS) $(PSBLAS_LIBS) $(LDLIBS) /bin/mv mld_sf_sample $(EXEDIR) mld_cf_sample: $(CFSOBJS) - $(F90LINK) $(LINKOPT) $(CFSOBJS) -o mld_cf_sample \ + $(FLINK) $(LINKOPT) $(CFSOBJS) -o mld_cf_sample \ $(MLD_LIBS) $(PSBLAS_LIBS) $(LDLIBS) /bin/mv mld_cf_sample $(EXEDIR) mld_zf_sample: $(ZFSOBJS) - $(F90LINK) $(LINKOPT) $(ZFSOBJS) -o mld_zf_sample \ + $(FLINK) $(LINKOPT) $(ZFSOBJS) -o mld_zf_sample \ $(MLD_LIBS) $(PSBLAS_LIBS) $(LDLIBS) /bin/mv mld_zf_sample $(EXEDIR) diff --git a/tests/newslv/Makefile b/tests/newslv/Makefile index 5ae882fa..42ac5369 100644 --- a/tests/newslv/Makefile +++ b/tests/newslv/Makefile @@ -13,7 +13,7 @@ all: ppde3d ppde3d: $(PD3DOBJS) - $(F90LINK) $(PD3DOBJS) -o ppde3d $(MLD_LIBS) $(PSBLAS_LIBS) $(LDLIBS) + $(FLINK) $(PD3DOBJS) -o ppde3d $(MLD_LIBS) $(PSBLAS_LIBS) $(LDLIBS) /bin/mv ppde3d $(EXEDIR) diff --git a/tests/pdegen/Makefile b/tests/pdegen/Makefile index 51f83c69..e39a0a7c 100644 --- a/tests/pdegen/Makefile +++ b/tests/pdegen/Makefile @@ -11,19 +11,19 @@ EXEDIR=./runs all: mld_s_pde3d mld_d_pde3d mld_s_pde2d mld_d_pde2d mld_d_pde3d: mld_d_pde3d.o data_input.o - $(F90LINK) mld_d_pde3d.o data_input.o -o mld_d_pde3d $(MLD_LIBS) $(PSBLAS_LIBS) $(LDLIBS) + $(FLINK) mld_d_pde3d.o data_input.o -o mld_d_pde3d $(MLD_LIBS) $(PSBLAS_LIBS) $(LDLIBS) /bin/mv mld_d_pde3d $(EXEDIR) mld_s_pde3d: mld_s_pde3d.o data_input.o - $(F90LINK) mld_s_pde3d.o data_input.o -o mld_s_pde3d $(MLD_LIBS) $(PSBLAS_LIBS) $(LDLIBS) + $(FLINK) mld_s_pde3d.o data_input.o -o mld_s_pde3d $(MLD_LIBS) $(PSBLAS_LIBS) $(LDLIBS) /bin/mv mld_s_pde3d $(EXEDIR) mld_d_pde2d: mld_d_pde2d.o data_input.o - $(F90LINK) mld_d_pde2d.o data_input.o -o mld_d_pde2d $(MLD_LIBS) $(PSBLAS_LIBS) $(LDLIBS) + $(FLINK) mld_d_pde2d.o data_input.o -o mld_d_pde2d $(MLD_LIBS) $(PSBLAS_LIBS) $(LDLIBS) /bin/mv mld_d_pde2d $(EXEDIR) mld_s_pde2d: mld_s_pde2d.o data_input.o - $(F90LINK) mld_s_pde2d.o data_input.o -o mld_s_pde2d $(MLD_LIBS) $(PSBLAS_LIBS) $(LDLIBS) + $(FLINK) mld_s_pde2d.o data_input.o -o mld_s_pde2d $(MLD_LIBS) $(PSBLAS_LIBS) $(LDLIBS) /bin/mv mld_s_pde2d $(EXEDIR) mld_d_pde3d.o mld_s_pde3d.o mld_d_pde2d.o mld_s_pde2d.o: data_input.o diff --git a/tests/pdegen/mld_d_pde2d.f90 b/tests/pdegen/mld_d_pde2d.f90 index df70ed44..db417021 100644 --- a/tests/pdegen/mld_d_pde2d.f90 +++ b/tests/pdegen/mld_d_pde2d.f90 @@ -233,23 +233,23 @@ program mld_d_pde2d ! prepare the preconditioner. ! if (psb_toupper(prectype%prec) == 'ML') then - call mld_precinit(prec,prectype%prec, info) + call prec%init(prectype%prec, info) if (prectype%csize>0)& - & call mld_precset(prec,'coarse_aggr_size', prectype%csize, info) + & call prec%set('coarse_aggr_size', prectype%csize, info) if (prectype%maxlevs>0)& - & call mld_precset(prec,'max_prec_levs', prectype%maxlevs, info) + & call prec%set('max_prec_levs', prectype%maxlevs, info) if (prectype%mnaggratio>0)& - & call mld_precset(prec,'min_aggr_ratio', prectype%mnaggratio, info) + & call prec%set('min_aggr_ratio', prectype%mnaggratio, info) if (prectype%athres >= dzero) & - & call mld_precset(prec,'aggr_thresh', prectype%athres, info) - call mld_precset(prec,'aggr_kind', prectype%aggrkind,info) - call mld_precset(prec,'aggr_alg', prectype%aggr_alg,info) - call mld_precset(prec,'aggr_ord', prectype%aggr_ord,info) - call mld_precset(prec,'aggr_filter', prectype%aggr_filter, info) + & call prec%set('aggr_thresh', prectype%athres, info) + call prec%set('aggr_kind', prectype%aggrkind,info) + call prec%set('aggr_alg', prectype%aggr_alg,info) + call prec%set('aggr_ord', prectype%aggr_ord,info) + call prec%set('aggr_filter', prectype%aggr_filter, info) call psb_barrier(ictxt) t1 = psb_wtime() - call mld_hierarchy_bld(a,desc_a,prec,info) + call prec%hierarchy_build(a,desc_a,info) if(info /= psb_success_) then info=psb_err_from_subroutine_ ch_err='psb_precbld' @@ -259,27 +259,27 @@ program mld_d_pde2d thier = psb_wtime()-t1 - call mld_precset(prec,'smoother_type', prectype%smther, info) - call mld_precset(prec,'smoother_sweeps', prectype%jsweeps, info) - call mld_precset(prec,'sub_ovr', prectype%novr, info) - call mld_precset(prec,'sub_restr', prectype%restr, info) - call mld_precset(prec,'sub_prol', prectype%prol, info) - call mld_precset(prec,'sub_solve', prectype%solve, info) - call mld_precset(prec,'sub_fillin', prectype%fill1, info) - call mld_precset(prec,'solver_sweeps', prectype%svsweeps, info) - call mld_precset(prec,'sub_iluthrs', prectype%thr1, info) - call mld_precset(prec,'ml_type', prectype%mltype, info) - call mld_precset(prec,'smoother_pos', prectype%smthpos, info) - call mld_precset(prec,'coarse_solve', prectype%csolve, info) - call mld_precset(prec,'coarse_subsolve', prectype%csbsolve,info) - call mld_precset(prec,'coarse_mat', prectype%cmat, info) - call mld_precset(prec,'coarse_fillin', prectype%cfill, info) - call mld_precset(prec,'coarse_iluthrs', prectype%cthres, info) - call mld_precset(prec,'coarse_sweeps', prectype%cjswp, info) + call prec%set('smoother_type', prectype%smther, info) + call prec%set('smoother_sweeps', prectype%jsweeps, info) + call prec%set('sub_ovr', prectype%novr, info) + call prec%set('sub_restr', prectype%restr, info) + call prec%set('sub_prol', prectype%prol, info) + call prec%set('sub_solve', prectype%solve, info) + call prec%set('sub_fillin', prectype%fill1, info) + call prec%set('solver_sweeps', prectype%svsweeps, info) + call prec%set('sub_iluthrs', prectype%thr1, info) + call prec%set('ml_type', prectype%mltype, info) + call prec%set('smoother_pos', prectype%smthpos, info) + call prec%set('coarse_solve', prectype%csolve, info) + call prec%set('coarse_subsolve', prectype%csbsolve,info) + call prec%set('coarse_mat', prectype%cmat, info) + call prec%set('coarse_fillin', prectype%cfill, info) + call prec%set('coarse_iluthrs', prectype%cthres, info) + call prec%set('coarse_sweeps', prectype%cjswp, info) call psb_barrier(ictxt) t1 = psb_wtime() - call mld_smoothers_bld(a,desc_a,prec,info) + call prec%smoothers_build(a,desc_a,info) if(info /= psb_success_) then info=psb_err_from_subroutine_ ch_err='psb_precbld' @@ -290,19 +290,19 @@ program mld_d_pde2d else nlv = 1 - call mld_precinit(prec,prectype%prec, info) - call mld_precset(prec,'smoother_sweeps', prectype%jsweeps, info) - call mld_precset(prec,'sub_ovr', prectype%novr, info) - call mld_precset(prec,'sub_restr', prectype%restr, info) - call mld_precset(prec,'sub_prol', prectype%prol, info) - call mld_precset(prec,'sub_solve', prectype%solve, info) - call mld_precset(prec,'sub_fillin', prectype%fill1, info) - call mld_precset(prec,'solver_sweeps', prectype%svsweeps, info) - call mld_precset(prec,'sub_iluthrs', prectype%thr1, info) + call prec%init(prectype%prec, info) + call prec%set('smoother_sweeps', prectype%jsweeps, info) + call prec%set('sub_ovr', prectype%novr, info) + call prec%set('sub_restr', prectype%restr, info) + call prec%set('sub_prol', prectype%prol, info) + call prec%set('sub_solve', prectype%solve, info) + call prec%set('sub_fillin', prectype%fill1, info) + call prec%set('solver_sweeps', prectype%svsweeps, info) + call prec%set('sub_iluthrs', prectype%thr1, info) call psb_barrier(ictxt) thier = dzero t1 = psb_wtime() - call mld_precbld(a,desc_a,prec,info) + call prec%build(a,desc_a,info) if(info /= psb_success_) then info=psb_err_from_subroutine_ ch_err='psb_precbld' @@ -319,7 +319,7 @@ program mld_d_pde2d if (iam == psb_root_) & & write(psb_out_unit,'("Preconditioner time : ",es12.5)') tprec+thier - if (iam == psb_root_) call mld_precdescr(prec,info) + if (iam == psb_root_) call prec%descr(info) if (iam == psb_root_) & & write(psb_out_unit,'(" ")') @@ -378,7 +378,7 @@ program mld_d_pde2d call psb_gefree(b,desc_a,info) call psb_gefree(x,desc_a,info) call psb_spfree(a,desc_a,info) - call mld_precfree(prec,info) + call prec%free(info) call psb_cdfree(desc_a,info) if(info /= psb_success_) then info=psb_err_from_subroutine_ diff --git a/tests/pdegen/mld_d_pde3d.f90 b/tests/pdegen/mld_d_pde3d.f90 index 742b521a..2f2f2621 100644 --- a/tests/pdegen/mld_d_pde3d.f90 +++ b/tests/pdegen/mld_d_pde3d.f90 @@ -245,24 +245,23 @@ program mld_d_pde3d ! prepare the preconditioner. ! if (psb_toupper(prectype%prec) == 'ML') then - call mld_precinit(prec,prectype%prec, info) - + call prec%init(prectype%prec, info) if (prectype%csize>0)& - & call mld_precset(prec,'coarse_aggr_size', prectype%csize, info) + & call prec%set('coarse_aggr_size', prectype%csize, info) if (prectype%maxlevs>0)& - & call mld_precset(prec,'max_prec_levs', prectype%maxlevs, info) + & call prec%set('max_prec_levs', prectype%maxlevs, info) if (prectype%mnaggratio>0)& - & call mld_precset(prec,'min_aggr_ratio', prectype%mnaggratio, info) + & call prec%set('min_aggr_ratio', prectype%mnaggratio, info) if (prectype%athres >= dzero) & - & call mld_precset(prec,'aggr_thresh', prectype%athres, info) - call mld_precset(prec,'aggr_kind', prectype%aggrkind,info) - call mld_precset(prec,'aggr_alg', prectype%aggr_alg,info) - call mld_precset(prec,'aggr_ord', prectype%aggr_ord,info) - call mld_precset(prec,'aggr_filter', prectype%aggr_filter, info) + & call prec%set('aggr_thresh', prectype%athres, info) + call prec%set('aggr_kind', prectype%aggrkind,info) + call prec%set('aggr_alg', prectype%aggr_alg,info) + call prec%set('aggr_ord', prectype%aggr_ord,info) + call prec%set('aggr_filter', prectype%aggr_filter, info) call psb_barrier(ictxt) t1 = psb_wtime() - call mld_hierarchy_bld(a,desc_a,prec,info) + call prec%hierarchy_build(a,desc_a,info) if(info /= psb_success_) then info=psb_err_from_subroutine_ ch_err='psb_precbld' @@ -272,27 +271,27 @@ program mld_d_pde3d thier = psb_wtime()-t1 - call mld_precset(prec,'smoother_type', prectype%smther, info) - call mld_precset(prec,'smoother_sweeps', prectype%jsweeps, info) - call mld_precset(prec,'sub_ovr', prectype%novr, info) - call mld_precset(prec,'sub_restr', prectype%restr, info) - call mld_precset(prec,'sub_prol', prectype%prol, info) - call mld_precset(prec,'sub_solve', prectype%solve, info) - call mld_precset(prec,'sub_fillin', prectype%fill1, info) - call mld_precset(prec,'solver_sweeps', prectype%svsweeps, info) - call mld_precset(prec,'sub_iluthrs', prectype%thr1, info) - call mld_precset(prec,'ml_type', prectype%mltype, info) - call mld_precset(prec,'smoother_pos', prectype%smthpos, info) - call mld_precset(prec,'coarse_solve', prectype%csolve, info) - call mld_precset(prec,'coarse_subsolve', prectype%csbsolve,info) - call mld_precset(prec,'coarse_mat', prectype%cmat, info) - call mld_precset(prec,'coarse_fillin', prectype%cfill, info) - call mld_precset(prec,'coarse_iluthrs', prectype%cthres, info) - call mld_precset(prec,'coarse_sweeps', prectype%cjswp, info) + call prec%set('smoother_type', prectype%smther, info) + call prec%set('smoother_sweeps', prectype%jsweeps, info) + call prec%set('sub_ovr', prectype%novr, info) + call prec%set('sub_restr', prectype%restr, info) + call prec%set('sub_prol', prectype%prol, info) + call prec%set('sub_solve', prectype%solve, info) + call prec%set('sub_fillin', prectype%fill1, info) + call prec%set('solver_sweeps', prectype%svsweeps, info) + call prec%set('sub_iluthrs', prectype%thr1, info) + call prec%set('ml_type', prectype%mltype, info) + call prec%set('smoother_pos', prectype%smthpos, info) + call prec%set('coarse_solve', prectype%csolve, info) + call prec%set('coarse_subsolve', prectype%csbsolve,info) + call prec%set('coarse_mat', prectype%cmat, info) + call prec%set('coarse_fillin', prectype%cfill, info) + call prec%set('coarse_iluthrs', prectype%cthres, info) + call prec%set('coarse_sweeps', prectype%cjswp, info) call psb_barrier(ictxt) t1 = psb_wtime() - call mld_smoothers_bld(a,desc_a,prec,info) + call prec%smoothers_build(a,desc_a,info) if(info /= psb_success_) then info=psb_err_from_subroutine_ ch_err='psb_precbld' @@ -303,19 +302,19 @@ program mld_d_pde3d else nlv = 1 - call mld_precinit(prec,prectype%prec, info) - call mld_precset(prec,'smoother_sweeps', prectype%jsweeps, info) - call mld_precset(prec,'sub_ovr', prectype%novr, info) - call mld_precset(prec,'sub_restr', prectype%restr, info) - call mld_precset(prec,'sub_prol', prectype%prol, info) - call mld_precset(prec,'sub_solve', prectype%solve, info) - call mld_precset(prec,'sub_fillin', prectype%fill1, info) - call mld_precset(prec,'solver_sweeps', prectype%svsweeps, info) - call mld_precset(prec,'sub_iluthrs', prectype%thr1, info) + call prec%init(prectype%prec, info) + call prec%set('smoother_sweeps', prectype%jsweeps, info) + call prec%set('sub_ovr', prectype%novr, info) + call prec%set('sub_restr', prectype%restr, info) + call prec%set('sub_prol', prectype%prol, info) + call prec%set('sub_solve', prectype%solve, info) + call prec%set('sub_fillin', prectype%fill1, info) + call prec%set('solver_sweeps', prectype%svsweeps, info) + call prec%set('sub_iluthrs', prectype%thr1, info) call psb_barrier(ictxt) thier = dzero t1 = psb_wtime() - call mld_precbld(a,desc_a,prec,info) + call prec%build(a,desc_a,info) if(info /= psb_success_) then info=psb_err_from_subroutine_ ch_err='psb_precbld' @@ -332,7 +331,7 @@ program mld_d_pde3d if (iam == psb_root_) & & write(psb_out_unit,'("Preconditioner time : ",es12.5)') tprec+thier - if (iam == psb_root_) call mld_precdescr(prec,info) + if (iam == psb_root_) call prec%descr(info) if (iam == psb_root_) & & write(psb_out_unit,'(" ")') @@ -391,7 +390,7 @@ program mld_d_pde3d call psb_gefree(b,desc_a,info) call psb_gefree(x,desc_a,info) call psb_spfree(a,desc_a,info) - call mld_precfree(prec,info) + call prec%free(info) call psb_cdfree(desc_a,info) if(info /= psb_success_) then info=psb_err_from_subroutine_ diff --git a/tests/pdegen/runs/mld_pde3d.inp b/tests/pdegen/runs/mld_pde3d.inp index 9f55ce7e..89867afb 100644 --- a/tests/pdegen/runs/mld_pde3d.inp +++ b/tests/pdegen/runs/mld_pde3d.inp @@ -18,7 +18,7 @@ SMOOTHED ! Type of aggregation: SMOOTHED, UNSMOOTHED, MINENER DEC ! Type of aggregation: DEC SYMDEC NATURAL ! Ordering of aggregation: NATURAL DEGREE FILTER ! Filtering aggregation: FILTER NOFILTER -MULT ! Type of multilevel correction: ADD MULT KCYCLE VCYCLE WCYCLE KCYCLESYM +VCYCLE ! Type of multilevel correction: ADD MULT KCYCLE VCYCLE WCYCLE KCYCLESYM TWOSIDE ! Side of correction: PRE POST TWOSIDE (ignored for ADD) 4 ! Smoother sweeps BJAC ! Smoother type JACOBI BJAC AS; ignored for non-ML @@ -30,8 +30,8 @@ ILU ! Subdomain solver DSCALE ILU MILU ILUT FWGS BWGS 0 ! Level-set N for ILU(N), and P for ILUT 1.d-4 ! Threshold T for ILU(T,P) DIST ! Coarse level: matrix distribution DIST REPL -SLUDIST ! Coarse level: solver JACOBI BJAC UMF SLU SLUDIST MUMPS -SLUDIST ! Coarse level: subsolver DSCALE GS BWGS ILU UMF SLU SLUDIST MUMPS +BJAC ! Coarse level: solver JACOBI BJAC UMF SLU SLUDIST MUMPS +UMFPACK ! Coarse level: subsolver DSCALE GS BWGS ILU UMF SLU SLUDIST MUMPS 1 ! Coarse level: Level-set N for ILU(N) 1.d-4 ! Coarse level: Threshold T for ILU(T,P) 2 ! Coarse level: Number of Jacobi sweeps