[mpich-discuss] WMPIEXEC hangs
Jayesh Krishna
jayesh at mcs.anl.gov
Mon Jul 14 15:08:04 CDT 2008
Hi,
You can find the documentation for MPI_Wait() at
http://www-unix.mcs.anl.gov/mpi/www/www3/MPI_Wait.html . Please refer to
some good books (like "Using MPI - Portable programming with Message
Passing Interface -1/2") or online manuals/presentations for learning MPI.
(From the documentation in your code it looks like each process
sends/receives o(p) messages, however your code sends/receives o(n**2)
messages. Please make sure that the logic of your code is correct.)
It is recommended that you specify the include path and library path (&
name of lib) with the options provided by the compiler/IDE instead of
embedding them in the source code. See the window's developer's guide
(available at
http://www.mcs.anl.gov/research/projects/mpich2/documentation/index.php?s=
docs) for more information (see section "Runtime environment" -->
"Compiling")
Regards,
Jayesh
_____
From: owner-mpich-discuss at mcs.anl.gov
[mailto:owner-mpich-discuss at mcs.anl.gov] On Behalf Of Rebecca
Sent: Monday, July 14, 2008 11:24 AM
To: mpich-discuss at mcs.anl.gov
Subject: [mpich-discuss] WMPIEXEC hangs
Hi All,
I am new to using MPICH. I am trying to get programs to run on wmpiexec,
but they do not seem to complete even with the MPI_Finalize(). I have to
click the break button to terminate. Also, if anyone is aware of a good
reference manual with samples I would appreciate it because I am not able
to get the syntax correct for MPIWait(). The code is pasted below. Thank
you in advance for assisting!
/* greetings.c -- greetings program
*
* Send a message from all processes with rank != 0 to the next lowest
neighbor.
* Process 0 prints the messages received.
*
* Input: none.
* Output: contents of messages received by process 0.
*
*/
#include <stdio.h>
#include <string.h>
#include <D:\\Program Files\\MPICH2\\include\\mpi.h>
#pragma comment( lib, "D:\\Program Files\\MPICH2\\lib\\mpi.lib" )
main(int argc, char* argv[])
{
int my_rank; /* rank of process */
int p; /* number of processes */
int dest; /* rank of receiver */
int tag = 0; /* tag for messages */
int i, j; /* loop counters */
char message[100], send[100]; /* storage for message */
MPI_Request req0;
//MPI_Status status; /* return status for */
/* receive */
/* Start up MPI */
MPI_Init(&argc, &argv);
/* Find out process rank */
MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
/* Find out number of processes */
MPI_Comm_size(MPI_COMM_WORLD, &p);
/* Create message */
sprintf(message, "Greetings from process %d!",my_rank);
// sprintf(send,message);
for (i=0;i<p;i++)
{
for (j=p;j>=0;j--)
{
dest = (my_rank + p)%(p+1);
if(my_rank ==p)
MPI_Isend(message, strlen(send)+1, MPI_CHAR, dest, tag,
MPI_COMM_WORLD, &req0);
if(my_rank ==dest )
MPI_Irecv(message, 100, MPI_CHAR, p, tag, MPI_COMM_WORLD,
&req0);
// MPI_Wait(req1, status);
}
if (my_rank == 0)/* my_rank == 0 */
{
printf("%s\n", message);
}
}
/* Shut down MPI */
MPI_Finalize();
} /* main */
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20080714/ba675cea/attachment.htm>
More information about the mpich-discuss
mailing list