From ffb96464ee3c8ff7759cfbd794267f20b7ea226e Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Fri, 29 Feb 2008 15:06:27 +0000 Subject: [PATCH] psblas2-dev base/internals/psi_dswapdata.F90 base/internals/psi_dswaptran.F90 base/internals/psi_iswapdata.F90 base/internals/psi_iswaptran.F90 base/internals/psi_zswapdata.F90 base/internals/psi_zswaptran.F90 config/pac.m4 configure.ac configure Added detection and use of VOLATILE. --- base/internals/psi_dswapdata.F90 | 6 ++++ base/internals/psi_dswaptran.F90 | 3 ++ base/internals/psi_iswapdata.F90 | 6 ++++ base/internals/psi_iswaptran.F90 | 6 ++++ base/internals/psi_zswapdata.F90 | 6 ++++ base/internals/psi_zswaptran.F90 | 6 ++++ config/pac.m4 | 52 +++++++++++++++++++++++++++++-- configure | 53 ++++++++++++++++++++++++++------ configure.ac | 10 ++++-- 9 files changed, 134 insertions(+), 14 deletions(-) diff --git a/base/internals/psi_dswapdata.F90 b/base/internals/psi_dswapdata.F90 index 1ff27853..51b5610b 100644 --- a/base/internals/psi_dswapdata.F90 +++ b/base/internals/psi_dswapdata.F90 @@ -188,6 +188,9 @@ subroutine psi_dswapidxm(ictxt,icomm,flag,n,beta,y,idx,totxch,totsnd,totrcv,work logical, parameter :: usersend=.false. real(kind(1.d0)), pointer, dimension(:) :: sndbuf, rcvbuf +#ifdef HAVE_VOLATILE + volatile :: sndbuf, rcvbuf +#endif character(len=20) :: name info = 0 @@ -676,6 +679,9 @@ subroutine psi_dswapidxv(ictxt,icomm,flag,beta,y,idx,totxch,totsnd,totrcv,work,i logical, parameter :: usersend=.false. real(kind(1.d0)), pointer, dimension(:) :: sndbuf, rcvbuf +#ifdef HAVE_VOLATILE + volatile :: sndbuf, rcvbuf +#endif character(len=20) :: name info = 0 diff --git a/base/internals/psi_dswaptran.F90 b/base/internals/psi_dswaptran.F90 index ae4c7154..656b3593 100644 --- a/base/internals/psi_dswaptran.F90 +++ b/base/internals/psi_dswaptran.F90 @@ -192,6 +192,9 @@ subroutine psi_dtranidxm(ictxt,icomm,flag,n,beta,y,idx,totxch,totsnd,totrcv,work logical, parameter :: usersend=.false. real(kind(1.d0)), pointer, dimension(:) :: sndbuf, rcvbuf +#ifdef HAVE_VOLATILE + volatile :: sndbuf, rcvbuf +#endif character(len=20) :: name info = 0 diff --git a/base/internals/psi_iswapdata.F90 b/base/internals/psi_iswapdata.F90 index 247839e9..ec1c02c5 100644 --- a/base/internals/psi_iswapdata.F90 +++ b/base/internals/psi_iswapdata.F90 @@ -187,6 +187,9 @@ subroutine psi_iswapidxm(ictxt,icomm,flag,n,beta,y,idx,totxch,totsnd,totrcv,work logical, parameter :: usersend=.false. integer, pointer, dimension(:) :: sndbuf, rcvbuf +#ifdef HAVE_VOLATILE + volatile :: sndbuf, rcvbuf +#endif character(len=20) :: name info = 0 @@ -676,6 +679,9 @@ subroutine psi_iswapidxv(ictxt,icomm,flag,beta,y,idx,totxch,totsnd,totrcv,work,i logical, parameter :: usersend=.false. integer, pointer, dimension(:) :: sndbuf, rcvbuf +#ifdef HAVE_VOLATILE + volatile :: sndbuf, rcvbuf +#endif character(len=20) :: name info = 0 diff --git a/base/internals/psi_iswaptran.F90 b/base/internals/psi_iswaptran.F90 index 12d5b2f7..40427f5e 100644 --- a/base/internals/psi_iswaptran.F90 +++ b/base/internals/psi_iswaptran.F90 @@ -192,6 +192,9 @@ subroutine psi_itranidxm(ictxt,icomm,flag,n,beta,y,idx,totxch,totsnd,totrcv,work logical, parameter :: usersend=.false. integer, pointer, dimension(:) :: sndbuf, rcvbuf +#ifdef HAVE_VOLATILE + volatile :: sndbuf, rcvbuf +#endif character(len=20) :: name info = 0 @@ -679,6 +682,9 @@ subroutine psi_itranidxv(ictxt,icomm,flag,beta,y,idx,totxch,totsnd,totrcv,work,i logical, parameter :: usersend=.false. integer, pointer, dimension(:) :: sndbuf, rcvbuf +#ifdef HAVE_VOLATILE + volatile :: sndbuf, rcvbuf +#endif character(len=20) :: name info = 0 diff --git a/base/internals/psi_zswapdata.F90 b/base/internals/psi_zswapdata.F90 index 3bba5e51..5dee7cda 100644 --- a/base/internals/psi_zswapdata.F90 +++ b/base/internals/psi_zswapdata.F90 @@ -187,6 +187,9 @@ subroutine psi_zswapidxm(ictxt,icomm,flag,n,beta,y,idx,totxch,totsnd,totrcv,work logical, parameter :: usersend=.false. complex(kind(1.d0)), pointer, dimension(:) :: sndbuf, rcvbuf +#ifdef HAVE_VOLATILE + volatile :: sndbuf, rcvbuf +#endif character(len=20) :: name info = 0 @@ -676,6 +679,9 @@ subroutine psi_zswapidxv(ictxt,icomm,flag,beta,y,idx,totxch,totsnd,totrcv,work,i logical, parameter :: usersend=.false. complex(kind(1.d0)), pointer, dimension(:) :: sndbuf, rcvbuf +#ifdef HAVE_VOLATILE + volatile :: sndbuf, rcvbuf +#endif character(len=20) :: name info = 0 diff --git a/base/internals/psi_zswaptran.F90 b/base/internals/psi_zswaptran.F90 index 20083566..48f7d0e8 100644 --- a/base/internals/psi_zswaptran.F90 +++ b/base/internals/psi_zswaptran.F90 @@ -192,6 +192,9 @@ subroutine psi_ztranidxm(ictxt,icomm,flag,n,beta,y,idx,totxch,totsnd,totrcv,work logical, parameter :: usersend=.false. complex(kind(1.d0)), pointer, dimension(:) :: sndbuf, rcvbuf +#ifdef HAVE_VOLATILE + volatile :: sndbuf, rcvbuf +#endif character(len=20) :: name info = 0 @@ -679,6 +682,9 @@ subroutine psi_ztranidxv(ictxt,icomm,flag,beta,y,idx,totxch,totsnd,totrcv,work,i logical, parameter :: usersend=.false. complex(kind(1.d0)), pointer, dimension(:) :: sndbuf, rcvbuf +#ifdef HAVE_VOLATILE + volatile :: sndbuf, rcvbuf +#endif character(len=20) :: name info = 0 diff --git a/config/pac.m4 b/config/pac.m4 index 84729a15..26480f12 100644 --- a/config/pac.m4 +++ b/config/pac.m4 @@ -69,7 +69,7 @@ ac_exeext='' ac_ext='f' ac_link='${MPIFC-$FC} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' dnl Warning : square brackets are EVIL! -[AC_MSG_CHECKING([for MOVE_ALLOC intrinsic]) +[AC_MSG_CHECKING([for Fortran MOVE_ALLOC intrinsic]) cat > conftest.$ac_ext < -dnl +dnl @author Salvatore Filippone AC_DEFUN(PAC_FORTRAN_TEST_TR15581, ac_exeext='' ac_ext='f90' @@ -393,9 +393,56 @@ program testtr15581 end program testtr15581 EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + AC_MSG_RESULT([yes]) + ifelse([$1], , :, [ + $1]) +else + AC_MSG_RESULT([no]) + echo "configure: failed program was:" >&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_VOLATILE( [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +dnl +dnl Will try to compile and link a program checking the VOLATILE 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 Michele Martone +dnl @author Salvatore Filippone +AC_DEFUN(PAC_FORTRAN_TEST_VOLATILE, +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 VOLATILE]) +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], , , [ @@ -418,6 +465,7 @@ dnl Depending on the compiler flags, this could cause a conftest.mod file to app dnl in the present directory, or in another, or with another name. So be warned! dnl dnl @author Michele Martone +dnl @author Salvatore Filippone dnl AC_DEFUN(PAC_CHECK_BLACS, [AC_ARG_WITH(blacs, AC_HELP_STRING([--with-blacs=LIB], [Specify BLACSLIBNAME or -lBLACSLIBNAME or the absolute library filename.]), diff --git a/configure b/configure index 9a1684d0..75622aa2 100755 --- a/configure +++ b/configure @@ -5369,18 +5369,18 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext}; then - - { echo "$as_me:$LINENO: result: yes." >&5 -echo "${ECHO_T}yes." >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + : else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 - { { echo "$as_me:$LINENO: error: no. - Sorry, cannot build PSBLAS without support for TR15581. + { { echo "$as_me:$LINENO: error: Sorry, cannot build PSBLAS without support for TR15581. Please get a Fortran compiler that supports it, e.g. GNU Fortran 4.2." >&5 -echo "$as_me: error: no. - Sorry, cannot build PSBLAS without support for TR15581. +echo "$as_me: error: Sorry, cannot build PSBLAS without support for TR15581. Please get a Fortran compiler that supports it, e.g. GNU Fortran 4.2." >&2;} { (exit 1); exit 1; }; } @@ -5388,6 +5388,7 @@ fi cd .. rm -fr tmpdir_$i + if test x"$psblas_cv_fc" == "x" ; then if eval "$MPIFC -qversion | grep XL 2>/dev/null" ; then psblas_cv_fc="xlf" @@ -7132,8 +7133,8 @@ rm -f conftest* ac_exeext='' ac_ext='f' ac_link='${MPIFC-$FC} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -{ echo "$as_me:$LINENO: checking for MOVE_ALLOC intrinsic" >&5 -echo $ECHO_N "checking for MOVE_ALLOC intrinsic... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: checking for Fortran MOVE_ALLOC intrinsic" >&5 +echo $ECHO_N "checking for Fortran MOVE_ALLOC intrinsic... $ECHO_C" >&6; } cat > conftest.$ac_ext <&6; } fi rm -f conftest* +ac_exeext='' +ac_ext='f90' +ac_link='${MPIFC-$FC} -o conftest${ac_exeext} $FCFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +{ echo "$as_me:$LINENO: checking support for Fortran VOLATILE" >&5 +echo $ECHO_N "checking support for Fortran VOLATILE... $ECHO_C" >&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=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext}; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + + FDEFINES="$psblas_cv_define_prepend-DHAVE_VOLATILE $FDEFINES" +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}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 67a5bf22..1483d13b 100755 --- a/configure.ac +++ b/configure.ac @@ -189,12 +189,12 @@ PAC_CHECK_HAVE_GFORTRAN( # Test for TR 15581, aka allocatables extensions. # PAC_FORTRAN_TEST_TR15581( - [AC_MSG_RESULT([yes.])], - [AC_MSG_ERROR([no. - Sorry, cannot build PSBLAS without support for TR15581. + [], + [AC_MSG_ERROR([Sorry, cannot build PSBLAS without support for TR15581. Please get a Fortran compiler that supports it, e.g. GNU Fortran 4.2.])] ) + if test x"$psblas_cv_fc" == "x" ; then if eval "$MPIFC -qversion | grep XL 2>/dev/null" ; then psblas_cv_fc="xlf" @@ -473,6 +473,10 @@ PAC_FORTRAN_HAVE_MOVE_ALLOC( ) +PAC_FORTRAN_TEST_VOLATILE( + [FDEFINES="$psblas_cv_define_prepend-DHAVE_VOLATILE $FDEFINES"], +) + ############################################################################### # Additional pathname stuff (yes, it is redundant and confusing...) ###############################################################################