LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2003-11-23 08:31:53


On Sat, 22 Nov 2003, Nguyen Hung Vu wrote:

> I wonder why when I run MPI_C_SAMPLE.c, it does not stop
> and wait for me to enter "num"
>
> /////////////////////////////////
> if (rank == 0) {
> printf("Enter the number of times around the ring: ");
> scanf("%d", &num);
> --num;
>
> printf("Process %d sending %d to %d\n", rank, num,
> next);
> MPI_Send(&num, 1, MPI_INT, next, tag, MPI_COMM_WORLD);
>
> }
> /////////////////////////////////

It depends on where MPI_COMM_WORLD rank 0 is running. mpirun, by default,
will connect stdin to the lowest ranking MPI_COMM_WORLD rank on the same
node where you invoke mpirun. If MCW rank 0 is not on that node, then MCW
rank 0 will have /dev/null tied to its stdin.

-- 
{+} Jeff Squyres
{+} jsquyres_at_[hidden]
{+} http://www.lam-mpi.org/