From 00cdc61fac649b2f9e83e302dca287a2b7bf36ea Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Fri, 22 Jan 2010 14:49:17 +0000 Subject: [PATCH] psblas3: Fixed epstol into d_epstol. Added tests for same_type_as and extends_type_of --- base/modules/psb_const_mod.f90 | 2 +- config/pac.m4 | 110 +++++++++++++++++++++++++++++++++ configure | 88 ++++++++++++++++++++++++++ configure.ac | 8 +++ prec/psb_dilu_fct.f90 | 4 +- prec/psb_zilu_fct.f90 | 4 +- 6 files changed, 211 insertions(+), 5 deletions(-) diff --git a/base/modules/psb_const_mod.f90 b/base/modules/psb_const_mod.f90 index 1864fa04..712e4612 100644 --- a/base/modules/psb_const_mod.f90 +++ b/base/modules/psb_const_mod.f90 @@ -54,7 +54,7 @@ module psb_const_mod complex(psb_spk_), parameter :: cone=(1.e0,0.0e0) complex(psb_dpk_), parameter :: zzero=(0.d0,0.0d0) complex(psb_dpk_), parameter :: zone=(1.d0,0.0d0) - real(psb_dpk_), parameter :: epstol=1.d-32, psb_percent_=0.7 + real(psb_dpk_), parameter :: d_epstol=1.d-32 real(psb_spk_), parameter :: s_epstol=1.e-16 ! How to choose this? character, parameter :: psb_all_='A', psb_topdef_=' ' diff --git a/config/pac.m4 b/config/pac.m4 index 424b06ce..206e75a7 100644 --- a/config/pac.m4 +++ b/config/pac.m4 @@ -672,6 +672,116 @@ fi cd .. rm -fr tmpdir_$i]) +dnl @synopsis PAC_FORTRAN_TEST_SAME_TYPE( [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +dnl +dnl Will try to compile and link a program checking the SAME_TYPE_AS Fortran support. +dnl +dnl Will use MPIFC, otherwise '$FC'. +dnl +dnl If the test passes, will execute ACTION-IF-FOUND. Otherwise, ACTION-IF-NOT-FOUND. +dnl Note : This file will be likely to induce the compiler to create a module file +dnl (for a module called conftest). +dnl Depending on the compiler flags, this could cause a conftest.mod file to appear +dnl in the present directory, or in another, or with another name. So be warned! +dnl +dnl @author Salvatore Filippone +AC_DEFUN(PAC_FORTRAN_TEST_SAME_TYPE, +ac_exeext='' +ac_ext='f90' +ac_link='${MPIFC-$FC} -o conftest${ac_exeext} $FCFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +dnl Warning : square brackets are EVIL! +[AC_MSG_CHECKING([support for Fortran SAME_TYPE_AS]) +i=0 +while test \( -f tmpdir_$i \) -o \( -d tmpdir_$i \) ; do + i=`expr $i + 1` +done +mkdir tmpdir_$i +cd tmpdir_$i +cat > conftest.$ac_ext <&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC +ifelse([$2], , , [ + $2 +])dnl +fi +cd .. +rm -fr tmpdir_$i]) + +dnl @synopsis PAC_FORTRAN_TEST_EXTENDS_TYPE( [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +dnl +dnl Will try to compile and link a program checking the EXTENDS_TYPE_OF Fortran support. +dnl +dnl Will use MPIFC, otherwise '$FC'. +dnl +dnl If the test passes, will execute ACTION-IF-FOUND. Otherwise, ACTION-IF-NOT-FOUND. +dnl Note : This file will be likely to induce the compiler to create a module file +dnl (for a module called conftest). +dnl Depending on the compiler flags, this could cause a conftest.mod file to appear +dnl in the present directory, or in another, or with another name. So be warned! +dnl +dnl @author Salvatore Filippone +AC_DEFUN(PAC_FORTRAN_TEST_EXTENDS_TYPE, +ac_exeext='' +ac_ext='f90' +ac_link='${MPIFC-$FC} -o conftest${ac_exeext} $FCFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +dnl Warning : square brackets are EVIL! +[AC_MSG_CHECKING([support for Fortran EXTENDS_TYPE_OF]) +i=0 +while test \( -f tmpdir_$i \) -o \( -d tmpdir_$i \) ; do + i=`expr $i + 1` +done +mkdir tmpdir_$i +cd tmpdir_$i +cat > conftest.$ac_ext <&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC +ifelse([$2], , , [ + $2 +])dnl +fi +cd .. +rm -fr tmpdir_$i]) + dnl @synopsis PAC_CHECK_BLACS dnl diff --git a/configure b/configure index fdbb3727..4f01c123 100755 --- a/configure +++ b/configure @@ -7704,6 +7704,94 @@ fi cd .. rm -fr tmpdir_$i +ac_exeext='' +ac_ext='f90' +ac_link='${MPIFC-$FC} -o conftest${ac_exeext} $FCFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +{ $as_echo "$as_me:$LINENO: checking support for Fortran SAME_TYPE_AS" >&5 +$as_echo_n "checking support for Fortran SAME_TYPE_AS... " >&6; } +i=0 +while test \( -f tmpdir_$i \) -o \( -d tmpdir_$i \) ; do + i=`expr $i + 1` +done +mkdir tmpdir_$i +cd tmpdir_$i +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 + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + + FDEFINES="$psblas_cv_define_prepend-DHAVE_SAME_TYPE_AS $FDEFINES" +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +cd .. +rm -fr tmpdir_$i + +ac_exeext='' +ac_ext='f90' +ac_link='${MPIFC-$FC} -o conftest${ac_exeext} $FCFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +{ $as_echo "$as_me:$LINENO: checking support for Fortran EXTENDS_TYPE_OF" >&5 +$as_echo_n "checking support for Fortran EXTENDS_TYPE_OF... " >&6; } +i=0 +while test \( -f tmpdir_$i \) -o \( -d tmpdir_$i \) ; do + i=`expr $i + 1` +done +mkdir tmpdir_$i +cd tmpdir_$i +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 + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + + FDEFINES="$psblas_cv_define_prepend-DHAVE_EXTENDS_TYPE_OF $FDEFINES" +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +cd .. +rm -fr tmpdir_$i + ############################################################################### # Additional pathname stuff (yes, it is redundant and confusing...) ############################################################################### diff --git a/configure.ac b/configure.ac index 7ed3ebf4..bae3c88b 100755 --- a/configure.ac +++ b/configure.ac @@ -569,6 +569,14 @@ PAC_FORTRAN_TEST_FINAL( [FDEFINES="$psblas_cv_define_prepend-DHAVE_FINAL $FDEFINES"], ) +PAC_FORTRAN_TEST_SAME_TYPE( + [FDEFINES="$psblas_cv_define_prepend-DHAVE_SAME_TYPE_AS $FDEFINES"], +) + +PAC_FORTRAN_TEST_EXTENDS_TYPE( + [FDEFINES="$psblas_cv_define_prepend-DHAVE_EXTENDS_TYPE_OF $FDEFINES"], +) + ############################################################################### # Additional pathname stuff (yes, it is redundant and confusing...) ############################################################################### diff --git a/prec/psb_dilu_fct.f90 b/prec/psb_dilu_fct.f90 index d50a4a4f..e1228077 100644 --- a/prec/psb_dilu_fct.f90 +++ b/prec/psb_dilu_fct.f90 @@ -249,7 +249,7 @@ contains ! ! Non singularity ! - if (dabs(dia) < epstol) then + if (dabs(dia) < d_epstol) then ! ! Pivot too small: unstable factorization ! @@ -364,7 +364,7 @@ contains ! ! Non singularity ! - if (dabs(dia) < epstol) then + if (dabs(dia) < d_epstol) then ! ! Pivot too small: unstable factorization ! diff --git a/prec/psb_zilu_fct.f90 b/prec/psb_zilu_fct.f90 index bce66275..6355c10b 100644 --- a/prec/psb_zilu_fct.f90 +++ b/prec/psb_zilu_fct.f90 @@ -246,7 +246,7 @@ contains ! ! Non singularity ! - if (abs(dia) < epstol) then + if (abs(dia) < d_epstol) then ! ! Pivot too small: unstable factorization ! @@ -361,7 +361,7 @@ contains ! ! Non singularity ! - if (abs(dia) < epstol) then + if (abs(dia) < d_epstol) then ! ! Pivot too small: unstable factorization !