Presentation is loading. Please wait.

Presentation is loading. Please wait.

Running on GCB part1 By: Camilo Silva. Simple steps to run MPI 1.Use putty or the terminal 2.SSH to gcb.fiu.edu 3.Loggin by providing your username and.

Similar presentations


Presentation on theme: "Running on GCB part1 By: Camilo Silva. Simple steps to run MPI 1.Use putty or the terminal 2.SSH to gcb.fiu.edu 3.Loggin by providing your username and."— Presentation transcript:

1 Running on GCB part1 By: Camilo Silva

2 Simple steps to run MPI 1.Use putty or the terminal 2.SSH to gcb.fiu.edu 3.Loggin by providing your username and password

3 You are in! You should have a screen similar to this one:

4 Time to program! Using vi, pico, or nano, or your favorite text editor code the following program: /* "Hello World" example for 2 processors. Initially, both processors have status "I am alone!". Each sends out a "Hello World" to the other. Upon receiving each other's message, the status changes to what is received. */ #include "mpi.h" #include int main(int argc, char** argv) { int MyProc, tag=0; char msg[12]="Hello World"; char msg_recpt[12]="I am alone!"; MPI_Status status; MPI_Init(&argc, &argv); MPI_Comm_rank(MPI_COMM_WORLD, &MyProc); printf("Process# %d started \n", MyProc); MPI_Barrier(MPI_COMM_WORLD); if (MyProc== 0) { printf("Proc#0: %s \n", msg_recpt) ; printf("Sendingmessage to Proc #1: %s \n", msg) ; MPI_Send(&msg, 12, MPI_CHAR, 1, tag, MPI_COMM_WORLD); MPI_Recv(&msg_recpt, 12, MPI_CHAR, 1, tag, MPI_COMM_WORLD, &status); printf("Receivedmessage from Proc #1: %s \n", msg_recpt) ; } else { printf("Proc#1: %s \n", msg_recpt) ; MPI_Recv(&msg_recpt, 12, MPI_CHAR, 0, tag, MPI_COMM_WORLD, &status); printf("Receivedmessage from Proc #0: %s \n", msg_recpt) ; printf("Sendingmessage to Proc #0: %s \n", msg) ; MPI_Send(&msg, 12, MPI_CHAR, 0, tag, MPI_COMM_WORLD); } MPI_Finalize(); }

5 What next? Submit the following command in the terminal: PATH=/opt/mpich/gnu/bin:$PATH That line will add mpich to your path

6 One last step… Before compiling and running you must sent the following command: –[username~]$lamboot –v Then, compile the program: mpicc –o hello hello.c Finally run it: mpirun –v –np 2 hello Check the man for details of the functions and parameters

7 Results:


Download ppt "Running on GCB part1 By: Camilo Silva. Simple steps to run MPI 1.Use putty or the terminal 2.SSH to gcb.fiu.edu 3.Loggin by providing your username and."

Similar presentations


Ads by Google