[mpich-discuss] gfortran and mpich2 interaction

Anthony Chan chan at mcs.anl.gov
Fri May 9 11:29:04 CDT 2008


Did you try putting a flush() statement before the read() ?
BTW, I would think that it is more portable to read data
from a file than from stdin.

A.Chan

----- jdelia at intec.unl.edu.ar wrote:

> Dear developers,
> 
>  From the first distributions of the GFORTRAN compiler (experimental 
> 
> or not), I had noticed a little execution problem (of low impact) when
>  
> the attached test program runs in parallel using MPICH2. I ignore if 
> 
> it is a problem of GFORTRAN or MPICH2 but it does not happen neither  
> 
> with G95 nor with IFORT.
> 
> As a  simple test (please, see at the end of this message), the  
> processor 0 must read a variable "n" that is entered by console.  
> During the execution (including the case with a single  process), it 
> 
> does not print any message until a value is entered for the required 
> 
> variable.
> 
> In the present test I used the current 1.0.7 stable version of MPICH2 
> 
> (http://www.mcs.anl.gov/research/projects/mpich2/downloads/index.php?s=downloads)
> 
> $ which mpif90
> /usr/local/mpich2-exp/1.0.7/bin/mpif90
> 
> $ mpif90 --version
> GNU Fortran (GCC) 4.4.0 20080302 (experimental) [trunk revision
> 132813]
> Copyright (C) 2007 Free Software Foundation, Inc.
> 
> GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
> You may redistribute copies of GNU Fortran
> under the terms of the GNU General Public License.
> For more information about these matters, see the file named COPYING
> 
> $ mpif90 -Wall -std=f2003 -fPIC -o testinputmpi.exe testinputmpi.f90
> 
> $ mpiexec -machinefile ~/machi.dat -np 1 testinputmpi.exe
> 100
> 100
> 100
>     matrix rank ; n : ?
>     matrix rank ; n =          100
>     matrix rank ; n : ?
>     matrix rank ; n =          100
>     matrix rank ; n : ?
>     matrix rank ; n =          100
> 
> $ cat /proc/version
> Linux version 2.6.9-22.0.1.ELsmp (root at yort.fnal.gov) (gcc version  
> 3.4.3 20050227 (Red Hat 3.4.3-22.1)) #1 SMP Thu Oct 27 10:53:36 CDT
> 2005
> 
> The nodes of our Beowulf cluster are 32-bit processors (i386, Intel  
> Pentium 4).
> 
> Perhaps, if this problem is in the way that the program is compiled or
>  
> the MPICH2 was built (please, see config.log.gz attached file), is  
> there some compilation or building flag for fix this little trouble ?
> 
> Thanks in advance,
> 
> Regards,
> Jorge.
> 
> ! -----------------------------------------------------------------
> ! MPICH2
> !  which mpif90
> !  mpif90 --version
> !  mpif90 -Wall -std=f2003 -fPIC -o testinputmpi.exe testinputmpi.f90
> !  mpdboot -n 5 -f ~/mpd.hosts
> !  mpdtrace
> !  mpdringtest
> !  mpiexec -machinefile ~/machi.dat -np 2 testinputmpi.exe
> !  mpdallexit
> !
> ! -----------------------------------------------------------------
> program testinputmpi
>     use mpi
>     implicit none
>     integer :: myid, siza, ierr, master=0, n
>     !
>     call MPI_Init (ierr)
>     call MPI_Comm_size (MPI_COMM_WORLD, siza, ierr) ! number of
> processes
>     call MPI_Comm_rank (MPI_COMM_WORLD, myid, ierr) ! my rank
>     !
>     if (myid == master) then
>       ! alternative 1
>       write (*,*)
>       write (*,*) " matrix rank ; n : ? "
>       read  (*,*) n
>       write (*,*) " matrix rank ; n = ", n
>       ! alternative 2
>       write (6,*)
>       write (6,*) " matrix rank ; n : ? "
>       read  (5,*) n
>       write (6,*) " matrix rank ; n = ", n
>       ! alternative 3
>       print  *
>       print  *,   " matrix rank ; n : ? "
>       read  (*,*) n
>       print  *,   " matrix rank ; n = ", n
>     else
>       write (*,*) "hellow from ", myid, " of ", siza, "processes"
>     end if
>     !
>     call MPI_Finalize (ierr)
>     !
> end program
> ! -------------------------------------------------------------------
> 
> CIMEC, http://www.cimec.org.ar/
> INTEC, Guemes 3450, 3000-Santa Fe, ARGENTINA
> tel: +54-342-451.15.94, extension 1018;
>        +54-342-455.91.75, fax: +54-342-455.09.44
> Universidad Nacional del Litoral (UNL)
> Consejo Nacional de Investigaciones Cientificas y Tecnicas (CONICET)
> 
> 
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.




More information about the mpich-discuss mailing list