See this related post
http://lists.mpich.org/pipermail/discuss/2013-September/001452.html.

The only text in the MPI standard I could find related to stdin is
"assuming the MPI implementation supports stdin such that this works",
which is not what I'd call a ringing endorsement of the practice of using
it.

Tell the AbInit people that they're wrong for using stdin.  There are lots
of cases where it won't work.

Jeff


On Thu, Sep 19, 2013 at 6:42 AM, Fabrice Boyrie <fboy...@univ-montp2.fr>
wrote:
>
> Hello
>
> I have to compile a program (abinit) reading data from stdin and it
> doesn't works.
>
>
>   I made a simplified version of the program
>
>
>
> PROGRAM TESTSTDIN
>
>   use mpi
>   integer ( kind = 4 ) error
>   integer ( kind = 4 ) id
>   integer ( kind = 4 ) p
>   real ( kind = 8 ) wtime
>   CHARACTER(LEN=255) a
>   call MPI_Init ( error )
>   call MPI_Comm_size ( MPI_COMM_WORLD, p, error )
>   call MPI_Comm_rank ( MPI_COMM_WORLD, id, error )
>
>   if ( id == 0 ) then
>     PRINT*, "id0"
>     READ(5,'(A)') a
>   end if
>
>   write ( *, '(a)' ) ' '
>   write ( *, '(a,i8,a)' ) '  Process ', id, ' says "Hello, world!"'
>
>   if ( id == 0 ) then
>     write ( *, '(a)' ) 'READ from stdin'
>     write ( *, '(a)' ) a
>   end if
>   call MPI_Finalize ( error )
>
>   stop
> end
>
>
> I've tried openmpi 1.6.5 and 1.7.2
> The fortran compiler is ifort (tried Version 14.0.0.080 Build 20130728
> and Version 11.1    Build 20100806)
> (c compiler is gcc, centos 6.x, infiniband stack from qlogic
> infinipath-libs-3.1-3420.1122_rhel6_qlc.x86_64)
>
> Trying with and without infiniband (qlogic card)
>
> mpirun -np 8 ./teststdin < /tmp/a
> forrtl: Bad file descriptor
> forrtl: severe (108): cannot stat file, unit 5, file /proc/43811/fd/0
> Image              PC                Routine            Line
> Source
> teststdin          000000000040BF48  Unknown               Unknown
 Unknown
>
>
>
>  mpirun -mca mtl ^psm -mca btl self,sm -np 8 ./teststdin < /tmp/a
>
>  id0
>   Process        0 says "Hello, world!"
> READ from stdin
> zer
>
>   Process        1 says "Hello, world!"
> ...
>
>
>
> Is it a known problem ?
>
>  Fabrice BOYRIE
>
>
> _______________________________________________
> users mailing list
> us...@open-mpi.org
> http://www.open-mpi.org/mailman/listinfo.cgi/users




--
Jeff Hammond
jeff.scie...@gmail.com

Reply via email to