Hello,
First, your problem is most likely NOT with LAM. Most likely you have
either called scanf improperly, or you have made a mistake in your
program's flow diagram.
There is one thing to keep in mind when calling scanf with LAM:
Only the ranks on node 0 (n0) will accept input. All ranks on the other
nodes simply get NULL input (i.e. they have no stdin). Input is sent to
n0, even if you start the program from another node; however, in this case
an extra carriage return is needed, and it sometimes acts funky. All
ranks on n0 will await input, but not necessarily in the order you might
expect.
Since you are running all programs with the most generic options, then
rank 0 (r0) should be on n0. You might want to check that the machine you
are executing the program from is n0 (with lamnodes), just in case. I'm
guessing that you are checking to see that only r0 accepts input;
int myrank;
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
if (myrank == 0) scanf(...);
You might want to check that the program is getting its proper rank,
and that this conditional is working properly.
If you aren't checking the rank, then you should expect to have every
rank on n0 waiting for input to each scanf().
On Sun, 23 Jan 2005, [ISO-8859-2] Szymon Aukasik wrote:
> Hello everyone!
>
> I've finished writing my C program which is using LAM. For testing purposes I
> just try to run it on single machine using for example.:
>
> mpirun -np 3 my_program_name
>
> The problem I have is not working scanf function /i expect it to read some
> variables on the "master"-ranked 0 process/. I tried -pty option (didn't
> help). Tried also to run MPI_C_SAMPLE program... with the same effect - it
> doesn't let me to enter the number.
> The output is visible in both cases. I'm able also to read some data from a
> file. Just no scanf...
>
> The problem is similiar to "LAM don't wait for scanf to finish" posted by
> Nguyen Hung Vu. The answer of Jeff Squyres didn't help me (i have rank 0 on
> the same node where I invoke mpirun). Anyone has an idea how to fix it?
------------------------------------------------------------
Anthony Ciani (aciani1_at_[hidden])
Computational Condensed Matter Physics
Department of Physics, University of Illinois, Chicago
http://ciani.phy.uic.edu/~tony
------------------------------------------------------------
|