On Dec 10, 2004, at 2:19 PM, Aditya Datey wrote:
> =========
> 1. The program seems to be running twice, i.e each line of output is
> seen twice. why is this so?
Because of your mpirun line:
> mpirun -v -s n0 N C hello
See the mpirun(1) man page and/or the output of "mpirun -h". The "N"
means "run one copy of hello on each node." The "C" mean "run one copy
of hello on each CPU." So by specifying them both, you've told mpirun
to launch 9 copies of "hello" (put differently: an MPI_COMM_WORLD size
of 9). I think what you intended was N (MCW size of 4) *or* C (MCW
size of 5), but not both.
> 2. The node ranks are confusing me..!!
I'm not sure what your question is...?
I do note what looks like a program error, however:
> int rank = MPI_Comm_rank(MPI_COMM_WORLD,&rank); //rank of process
You're assigning rank twice; the winning value will be 0 (a.k.a.
MPI_SUCCESS). So every MPI process will have 0 assigned to the rank
variable. You seem to be mixing the C and C++ paradigms in the MPI
language bindings. I think you want:
/* Using the MPI C bindings */
int rank;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
or
/* Using the MPI C++ bindings */
int rank = MPI_COMM_WORLD.Get_rank();
Also, note that your stdout can appear in any order. See previous
threads on this for explanations of why this is so.
Hope this helps!
--
{+} Jeff Squyres
{+} jsquyres_at_[hidden]
{+} http://www.lam-mpi.org/
|