On Wed, 2004-06-23 at 07:28, thiranji perera wrote:
> To whom it may concern,
>
> I'm tryinng to display results of my parallel application on all
> the machines. I'm using LAM version 6.5.8 on Linux platform. Normally
> the results are displayed only at the server console( the machine your
> are running your program).
>
> // my LAM program
>
> int main (int argc, char * argv[]){
> int myId,p;
>
> MPI_Comm_size(MPI_COMM_WORLD, &p);
> MPI_Comm_rank(MPI_COMM_WORLD, &myId);
>
> printf("Hello World.... from processes %d \n", myId);
>
> MPI_Finalize();
> return 0;
> }
>
> This is the main of the program I need to run by creating 2 processes
> on two different machines. Both machines should print Hello World ...
> from processes Id on console in own machine. If U have any idea of how
> to do this please mail me.
You need to call MPI_Init before calling any other MPI-functions.
Add that line and you should be up and running :-)
-----------------------------------------
#include <stdio.h>
#include "mpi.h"
int main (int argc, char **argv) {
int myId,p;
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &p);
MPI_Comm_rank(MPI_COMM_WORLD, &myId);
printf("Hello World.... from processes %d \n", myId);
MPI_Finalize();
return 0;
}
----------------------------
--
Henning Martinussen | MESH-Technologies A/S
Systems Developer | Lille Gråbrødrestræde 1
www.meshtechnologies.com | DK-5000 Odense C, Denmark
hma_at_[hidden] | mobile: +45 6169 0742
|