Hello folks,
I am not quite sure why the program fails. I am sure I
am makign a silly error but can't locate. I would
appreciate some help on this.
thank you,
regards
satya.
code:
-------
#include <mpi.h>
#include <stdio.h>
int main (int argc, char *argv[])
{
int nprocs, myrank, i=0, data = 0;
MPI_Status status;
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
if(myrank == 0) {
printf("\n main thread no of procs %d \n",
nprocs);
for(i = 1; i < nprocs; i++) {
MPI_Recv ( &data, sizeof(data), MPI_INT, i, 1,
MPI_COMM_WORLD, &status);
printf("\n %d thread %d \n", data, i );
}
} else {
data = 2 * myrank;
printf ("\n In thread %d , the value of data is %d
\n", myrank, data );
MPI_Send (&data, sizeof(data), MPI_INT, 0, 1,
MPI_COMM_WORLD);
}
MPI_Finalize();
return 0;
}
error:
mpirun c7-13 mul
In thread 5 , the value of data is 10
In thread 6 , the value of data is 12
main thread no of procs 7
In thread 1 , the value of data is 2
In thread 3 , the value of data is 6
In thread 2 , the value of data is 4
2 thread 0
MPI_Recv: process in local group is dead (rank 0,
MPI_COMM_WORLD)
Rank (0, MPI_COMM_WORLD): Call stack within LAM:
Rank (0, MPI_COMM_WORLD): - MPI_Recv()
Rank (0, MPI_COMM_WORLD): - main()
In thread 4 , the value of data is 8
-----------------------------------------------------------------------------
One of the processes started by mpirun has exited with
a nonzero exit code. This typically indicates that
the process finished in error. If your process did not
finish in error, be sure to include a "return
0" or "exit(0)" in your C code before exiting the
application.
PID 4834 failed on node n5 (10.0.0.7) with exit status
1.
-----------------------------------------------------------------------------
laminfo:
LAM/MPI: 7.0.6
Prefix: /usr/local/software/lam
Architecture: i686-pc-linux-gnu
Configured by: root
Configured on: Thu Jul 8 00:04:07 EDT 2004
Configure host: cluster.local
C bindings: yes
C++ bindings: yes
Fortran bindings: yes
C profiling: yes
C++ profiling: yes
Fortran profiling: yes
ROMIO support: yes
IMPI support: no
Debug support: no
Purify clean: yes
SSI boot: globus (Module v0.5)
SSI boot: rsh (Module v1.0)
SSI coll: lam_basic (Module v7.0)
SSI coll: smp (Module v1.0)
SSI rpi: crtcp (Module v1.0.1)
SSI rpi: lamd (Module v7.0)
SSI rpi: sysv (Module v7.0)
SSI rpi: tcp (Module v7.0)
SSI rpi: usysv (Module v7.0)
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail
|