From 5f132cb86302c590c75196bdb549e9f46ab3f0d2 Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Mon, 27 Oct 2014 12:41:03 +0000 Subject: [PATCH] mld2p4-2: config/pac.m4 configure.ac configure mlprec/impl/level/mld_c_base_onelev_descr.f90 mlprec/impl/level/mld_d_base_onelev_descr.f90 mlprec/impl/level/mld_s_base_onelev_descr.f90 mlprec/impl/level/mld_z_base_onelev_descr.f90 mlprec/impl/mld_cmlprec_bld.f90 mlprec/impl/mld_dmlprec_bld.f90 mlprec/impl/mld_smlprec_bld.f90 mlprec/impl/mld_zmlprec_bld.f90 mlprec/mld_c_onelev_mod.f90 mlprec/mld_d_onelev_mod.f90 mlprec/mld_s_onelev_mod.f90 mlprec/mld_z_onelev_mod.f90 Fixed new informational message in onelev_descr. Added check on PSBLAS version in configure machinery. --- config/pac.m4 | 54 ++++++++++++++- configure | 69 ++++++++++++++++++- configure.ac | 13 ++++ mlprec/impl/level/mld_c_base_onelev_descr.f90 | 2 +- mlprec/impl/level/mld_d_base_onelev_descr.f90 | 2 +- mlprec/impl/level/mld_s_base_onelev_descr.f90 | 2 +- mlprec/impl/level/mld_z_base_onelev_descr.f90 | 2 +- mlprec/impl/mld_cmlprec_bld.f90 | 11 ++- mlprec/impl/mld_dmlprec_bld.f90 | 11 ++- mlprec/impl/mld_smlprec_bld.f90 | 11 ++- mlprec/impl/mld_zmlprec_bld.f90 | 11 ++- mlprec/mld_c_onelev_mod.f90 | 1 + mlprec/mld_d_onelev_mod.f90 | 1 + mlprec/mld_s_onelev_mod.f90 | 1 + mlprec/mld_z_onelev_mod.f90 | 1 + 15 files changed, 177 insertions(+), 15 deletions(-) diff --git a/config/pac.m4 b/config/pac.m4 index 28b89343..6e4ad67d 100644 --- a/config/pac.m4 +++ b/config/pac.m4 @@ -358,7 +358,7 @@ ac_objext='.o' ac_ext='f90' ac_compile='${MPIFC-$FC} -c -o conftest${ac_objext} $FMFLAG$PSBLAS_DIR/include $FMFLAG$PSBLAS_DIR/lib conftest.$ac_ext 1>&5' dnl Warning : square brackets are EVIL! -[AC_MSG_CHECKING([for working source dir of PSBLAS]) +[AC_MSG_CHECKING([for working installation of PSBLAS]) cat > conftest.$ac_ext < +dnl @author Salvatore Filippone +dnl +AC_DEFUN(PAC_FORTRAN_PSBLAS_VERSION, +ac_exeext='' +ac_objext='.o' +ac_ext='f90' +ac_compile='${MPIFC-$FC} -c -o conftest${ac_objext} $FMFLAG$PSBLAS_DIR/include $FMFLAG$PSBLAS_DIR/lib conftest.$ac_ext 1>&5' +ac_link='${MPIFC-$FC} -o conftest${ac_exeext} $FCFLAGS $LDFLAGS conftest.$ac_ext $FMFLAG$PSBLAS_DIR/include -L$PSBLAS_DIR/lib -lpsb_base $LIBS 1>&5' +dnl Warning : square brackets are EVIL! +[AC_MSG_CHECKING([for version of PSBLAS]) +cat > conftest.$ac_ext <&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC + pac_cv_psblas_major="unknown"; +fi +cat > conftest.$ac_ext <&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC + pac_cv_psblas_minor="unknown"; +fi +rm -f conftest* +AC_MSG_RESULT([Done]) +] +) + + dnl @synopsis PAC_FORTRAN_TEST_TR15581( [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl dnl Will try to compile and link a program checking the TR15581 Fortran extension support. diff --git a/configure b/configure index efd7404b..a0ef8cf0 100755 --- a/configure +++ b/configure @@ -7284,8 +7284,8 @@ fi ac_objext='.o' ac_ext='f90' ac_compile='${MPIFC-$FC} -c -o conftest${ac_objext} $FMFLAG$PSBLAS_DIR/include $FMFLAG$PSBLAS_DIR/lib conftest.$ac_ext 1>&5' -{ $as_echo "$as_me:$LINENO: checking for working source dir of PSBLAS" >&5 -$as_echo_n "checking for working source dir of PSBLAS... " >&6; } +{ $as_echo "$as_me:$LINENO: checking for working installation of PSBLAS" >&5 +$as_echo_n "checking for working installation of PSBLAS... " >&6; } cat > conftest.$ac_ext <&2;} fi rm -f conftest* +ac_exeext='' +ac_objext='.o' +ac_ext='f90' +ac_compile='${MPIFC-$FC} -c -o conftest${ac_objext} $FMFLAG$PSBLAS_DIR/include $FMFLAG$PSBLAS_DIR/lib conftest.$ac_ext 1>&5' +ac_link='${MPIFC-$FC} -o conftest${ac_exeext} $FCFLAGS $LDFLAGS conftest.$ac_ext $FMFLAG$PSBLAS_DIR/include -L$PSBLAS_DIR/lib -lpsb_base $LIBS 1>&5' +{ $as_echo "$as_me:$LINENO: checking for version of PSBLAS" >&5 +$as_echo_n "checking for version of PSBLAS... " >&6; } +cat > conftest.$ac_ext <&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext}; then + pac_cv_psblas_major=`./conftest${ac_exeext} | sed 's/^ *//'` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + pac_cv_psblas_major="unknown"; +fi +cat > conftest.$ac_ext <&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext}; then + pac_cv_psblas_minor=`./conftest${ac_exeext} | sed 's/^ *//'` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + pac_cv_psblas_minor="unknown"; +fi +rm -f conftest* +{ $as_echo "$as_me:$LINENO: result: Done" >&5 +$as_echo "Done" >&6; } + + +if test "x$pac_cv_psblas_major" == "xunknown"; then + { { $as_echo "$as_me:$LINENO: error: PSBLAS version major \"$pac_cv_psblas_major\"." >&5 +$as_echo "$as_me: error: PSBLAS version major \"$pac_cv_psblas_major\"." >&2;} + { (exit 1); exit 1; }; } +fi +if test "x$pac_cv_psblas_minor" == "xunknown"; then + { { $as_echo "$as_me:$LINENO: error: PSBLAS version minor \"$pac_cv_psblas_minor\"." >&5 +$as_echo "$as_me: error: PSBLAS version minor \"$pac_cv_psblas_minor\"." >&2;} + { (exit 1); exit 1; }; } +fi +if (( $pac_cv_psblas_major < 3 )) || (( $pac_cv_psblas_minor < 1 )) ; then + { { $as_echo "$as_me:$LINENO: error: I need at least PSBLAS version 3.1." >&5 +$as_echo "$as_me: error: I need at least PSBLAS version 3.1." >&2;} + { (exit 1); exit 1; }; } +else + { $as_echo "$as_me:$LINENO: Am configuring with PSBLAS version $pac_cv_psblas_major.$pac_cv_psblas_minor." >&5 +$as_echo "$as_me: Am configuring with PSBLAS version $pac_cv_psblas_major.$pac_cv_psblas_minor." >&6;} +fi + ############################################################################### # Variable substitutions : the Make.inc.in will have these @VARIABLES@ # substituted. diff --git a/configure.ac b/configure.ac index 1bfe61bd..f2b12fe7 100755 --- a/configure.ac +++ b/configure.ac @@ -250,6 +250,19 @@ fi PAC_FORTRAN_HAVE_PSBLAS([AC_MSG_RESULT([yes.])], [AC_MSG_ERROR([no. Could not find working version of PSBLAS.])]) +PAC_FORTRAN_PSBLAS_VERSION() +if test "x$pac_cv_psblas_major" == "xunknown"; then + AC_MSG_ERROR([PSBLAS version major "$pac_cv_psblas_major".]) +fi +if test "x$pac_cv_psblas_minor" == "xunknown"; then + AC_MSG_ERROR([PSBLAS version minor "$pac_cv_psblas_minor".]) +fi +if (( $pac_cv_psblas_major < 3 )) || (( $pac_cv_psblas_minor < 1 )) ; then + AC_MSG_ERROR([I need at least PSBLAS version 3.1.]) +else + AC_MSG_NOTICE([Am configuring with PSBLAS version $pac_cv_psblas_major.$pac_cv_psblas_minor.]) +fi + ############################################################################### # Variable substitutions : the Make.inc.in will have these @VARIABLES@ # substituted. diff --git a/mlprec/impl/level/mld_c_base_onelev_descr.f90 b/mlprec/impl/level/mld_c_base_onelev_descr.f90 index 716ce831..fe68ad45 100644 --- a/mlprec/impl/level/mld_c_base_onelev_descr.f90 +++ b/mlprec/impl/level/mld_c_base_onelev_descr.f90 @@ -82,7 +82,7 @@ subroutine mld_c_base_onelev_descr(lv,il,nl,info,iout) if (nl > 1) then if (allocated(lv%map%naggr)) then write(iout_,*) ' Size of coarse matrix: ', & - & sum(lv%map%naggr(:)) + & sum(lv%map%naggr(:)),lv%ac_nz_tot write(iout_,*) ' Sizes of aggregates: ', & & lv%map%naggr(:) end if diff --git a/mlprec/impl/level/mld_d_base_onelev_descr.f90 b/mlprec/impl/level/mld_d_base_onelev_descr.f90 index 4779c106..cf3d100e 100644 --- a/mlprec/impl/level/mld_d_base_onelev_descr.f90 +++ b/mlprec/impl/level/mld_d_base_onelev_descr.f90 @@ -82,7 +82,7 @@ subroutine mld_d_base_onelev_descr(lv,il,nl,info,iout) if (nl > 1) then if (allocated(lv%map%naggr)) then write(iout_,*) ' Size of coarse matrix: ', & - & sum(lv%map%naggr(:)) + & sum(lv%map%naggr(:)),lv%ac_nz_tot write(iout_,*) ' Sizes of aggregates: ', & & lv%map%naggr(:) end if diff --git a/mlprec/impl/level/mld_s_base_onelev_descr.f90 b/mlprec/impl/level/mld_s_base_onelev_descr.f90 index 79a81407..86ab5f62 100644 --- a/mlprec/impl/level/mld_s_base_onelev_descr.f90 +++ b/mlprec/impl/level/mld_s_base_onelev_descr.f90 @@ -82,7 +82,7 @@ subroutine mld_s_base_onelev_descr(lv,il,nl,info,iout) if (nl > 1) then if (allocated(lv%map%naggr)) then write(iout_,*) ' Size of coarse matrix: ', & - & sum(lv%map%naggr(:)) + & sum(lv%map%naggr(:)),lv%ac_nz_tot write(iout_,*) ' Sizes of aggregates: ', & & lv%map%naggr(:) end if diff --git a/mlprec/impl/level/mld_z_base_onelev_descr.f90 b/mlprec/impl/level/mld_z_base_onelev_descr.f90 index 8386120f..d72eaf68 100644 --- a/mlprec/impl/level/mld_z_base_onelev_descr.f90 +++ b/mlprec/impl/level/mld_z_base_onelev_descr.f90 @@ -82,7 +82,7 @@ subroutine mld_z_base_onelev_descr(lv,il,nl,info,iout) if (nl > 1) then if (allocated(lv%map%naggr)) then write(iout_,*) ' Size of coarse matrix: ', & - & sum(lv%map%naggr(:)) + & sum(lv%map%naggr(:)),lv%ac_nz_tot write(iout_,*) ' Sizes of aggregates: ', & & lv%map%naggr(:) end if diff --git a/mlprec/impl/mld_cmlprec_bld.f90 b/mlprec/impl/mld_cmlprec_bld.f90 index e3eb13bc..3e02d7dc 100644 --- a/mlprec/impl/mld_cmlprec_bld.f90 +++ b/mlprec/impl/mld_cmlprec_bld.f90 @@ -453,8 +453,16 @@ subroutine mld_cmlprec_bld(a,desc_a,p,info,amold,vmold,imold) end if end if + ! Fix nzeros + do i=1,iszv + p%precv(i)%ac_nz_loc = p%precv(i)%ac%get_nzeros() + p%precv(i)%ac_nz_tot = p%precv(i)%ac_nz_loc + call psb_sum(ictxt,p%precv(i)%ac_nz_tot) + end do + + ! - ! The coarse space hierarchy has been build. + ! The coarse space hierarchy has been built. ! ! Now do the preconditioner build. ! @@ -472,7 +480,6 @@ subroutine mld_cmlprec_bld(a,desc_a,p,info,amold,vmold,imold) & 'Jacobi sweeps',ione,is_legal_jac_sweeps) call mld_check_def(p%precv(i)%parms%sweeps_post,& & 'Jacobi sweeps',ione,is_legal_jac_sweeps) - if (.not.allocated(p%precv(i)%sm)) then !! Error: should have called mld_dprecinit info=3111 diff --git a/mlprec/impl/mld_dmlprec_bld.f90 b/mlprec/impl/mld_dmlprec_bld.f90 index 0b176021..aac694a4 100644 --- a/mlprec/impl/mld_dmlprec_bld.f90 +++ b/mlprec/impl/mld_dmlprec_bld.f90 @@ -453,8 +453,16 @@ subroutine mld_dmlprec_bld(a,desc_a,p,info,amold,vmold,imold) end if end if + ! Fix nzeros + do i=1,iszv + p%precv(i)%ac_nz_loc = p%precv(i)%ac%get_nzeros() + p%precv(i)%ac_nz_tot = p%precv(i)%ac_nz_loc + call psb_sum(ictxt,p%precv(i)%ac_nz_tot) + end do + + ! - ! The coarse space hierarchy has been build. + ! The coarse space hierarchy has been built. ! ! Now do the preconditioner build. ! @@ -472,7 +480,6 @@ subroutine mld_dmlprec_bld(a,desc_a,p,info,amold,vmold,imold) & 'Jacobi sweeps',ione,is_legal_jac_sweeps) call mld_check_def(p%precv(i)%parms%sweeps_post,& & 'Jacobi sweeps',ione,is_legal_jac_sweeps) - if (.not.allocated(p%precv(i)%sm)) then !! Error: should have called mld_dprecinit info=3111 diff --git a/mlprec/impl/mld_smlprec_bld.f90 b/mlprec/impl/mld_smlprec_bld.f90 index 9f3b59df..0f399253 100644 --- a/mlprec/impl/mld_smlprec_bld.f90 +++ b/mlprec/impl/mld_smlprec_bld.f90 @@ -453,8 +453,16 @@ subroutine mld_smlprec_bld(a,desc_a,p,info,amold,vmold,imold) end if end if + ! Fix nzeros + do i=1,iszv + p%precv(i)%ac_nz_loc = p%precv(i)%ac%get_nzeros() + p%precv(i)%ac_nz_tot = p%precv(i)%ac_nz_loc + call psb_sum(ictxt,p%precv(i)%ac_nz_tot) + end do + + ! - ! The coarse space hierarchy has been build. + ! The coarse space hierarchy has been built. ! ! Now do the preconditioner build. ! @@ -472,7 +480,6 @@ subroutine mld_smlprec_bld(a,desc_a,p,info,amold,vmold,imold) & 'Jacobi sweeps',ione,is_legal_jac_sweeps) call mld_check_def(p%precv(i)%parms%sweeps_post,& & 'Jacobi sweeps',ione,is_legal_jac_sweeps) - if (.not.allocated(p%precv(i)%sm)) then !! Error: should have called mld_dprecinit info=3111 diff --git a/mlprec/impl/mld_zmlprec_bld.f90 b/mlprec/impl/mld_zmlprec_bld.f90 index e54559fc..df511e9a 100644 --- a/mlprec/impl/mld_zmlprec_bld.f90 +++ b/mlprec/impl/mld_zmlprec_bld.f90 @@ -453,8 +453,16 @@ subroutine mld_zmlprec_bld(a,desc_a,p,info,amold,vmold,imold) end if end if + ! Fix nzeros + do i=1,iszv + p%precv(i)%ac_nz_loc = p%precv(i)%ac%get_nzeros() + p%precv(i)%ac_nz_tot = p%precv(i)%ac_nz_loc + call psb_sum(ictxt,p%precv(i)%ac_nz_tot) + end do + + ! - ! The coarse space hierarchy has been build. + ! The coarse space hierarchy has been built. ! ! Now do the preconditioner build. ! @@ -472,7 +480,6 @@ subroutine mld_zmlprec_bld(a,desc_a,p,info,amold,vmold,imold) & 'Jacobi sweeps',ione,is_legal_jac_sweeps) call mld_check_def(p%precv(i)%parms%sweeps_post,& & 'Jacobi sweeps',ione,is_legal_jac_sweeps) - if (.not.allocated(p%precv(i)%sm)) then !! Error: should have called mld_dprecinit info=3111 diff --git a/mlprec/mld_c_onelev_mod.f90 b/mlprec/mld_c_onelev_mod.f90 index 02f9206e..167495d1 100644 --- a/mlprec/mld_c_onelev_mod.f90 +++ b/mlprec/mld_c_onelev_mod.f90 @@ -123,6 +123,7 @@ module mld_c_onelev_mod class(mld_c_base_smoother_type), allocatable :: sm type(mld_sml_parms) :: parms type(psb_cspmat_type) :: ac + integer(psb_ipk_) :: ac_nz_loc, ac_nz_tot type(psb_desc_type) :: desc_ac type(psb_cspmat_type), pointer :: base_a => null() type(psb_desc_type), pointer :: base_desc => null() diff --git a/mlprec/mld_d_onelev_mod.f90 b/mlprec/mld_d_onelev_mod.f90 index 9e5cc0c1..b1ecae39 100644 --- a/mlprec/mld_d_onelev_mod.f90 +++ b/mlprec/mld_d_onelev_mod.f90 @@ -123,6 +123,7 @@ module mld_d_onelev_mod class(mld_d_base_smoother_type), allocatable :: sm type(mld_dml_parms) :: parms type(psb_dspmat_type) :: ac + integer(psb_ipk_) :: ac_nz_loc, ac_nz_tot type(psb_desc_type) :: desc_ac type(psb_dspmat_type), pointer :: base_a => null() type(psb_desc_type), pointer :: base_desc => null() diff --git a/mlprec/mld_s_onelev_mod.f90 b/mlprec/mld_s_onelev_mod.f90 index 17b835e5..ef2dfa72 100644 --- a/mlprec/mld_s_onelev_mod.f90 +++ b/mlprec/mld_s_onelev_mod.f90 @@ -123,6 +123,7 @@ module mld_s_onelev_mod class(mld_s_base_smoother_type), allocatable :: sm type(mld_sml_parms) :: parms type(psb_sspmat_type) :: ac + integer(psb_ipk_) :: ac_nz_loc, ac_nz_tot type(psb_desc_type) :: desc_ac type(psb_sspmat_type), pointer :: base_a => null() type(psb_desc_type), pointer :: base_desc => null() diff --git a/mlprec/mld_z_onelev_mod.f90 b/mlprec/mld_z_onelev_mod.f90 index 638cbd5e..ca866e2a 100644 --- a/mlprec/mld_z_onelev_mod.f90 +++ b/mlprec/mld_z_onelev_mod.f90 @@ -123,6 +123,7 @@ module mld_z_onelev_mod class(mld_z_base_smoother_type), allocatable :: sm type(mld_dml_parms) :: parms type(psb_zspmat_type) :: ac + integer(psb_ipk_) :: ac_nz_loc, ac_nz_tot type(psb_desc_type) :: desc_ac type(psb_zspmat_type), pointer :: base_a => null() type(psb_desc_type), pointer :: base_desc => null()