cs140-mpi

cs140-mpi - Hello, world in MPI Hello, #include ...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Hello, world in MPI Hello, world in MPI #include <stdio.h> #include "mpi.h" int main( int argc, char *argv[]) { int rank, size; MPI_Init( &argc, &argv ); MPI_Comm_size( MPI_COMM_WORLD, &size ); MPI_Comm_rank( MPI_COMM_WORLD, &rank ); printf( "Hello world from process %d of %d\n", rank, size ); MPI_Finalize(); return 0; }
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
MPI in nine routines (all you MPI in nine routines (all you really really need) need) MPI_Init Initialize MPI_Finalize Finalize MPI_Comm_size How many processes? MPI_Comm_rank Which process am I? MPI_Wtime Timer MPI_Send Send data to one proc MPI_Recv Receive data from one proc MPI_Bcast Broadcast data to all procs MPI_Reduce Combine data from all
Background image of page 2
Ten more MPI routines (sometimes useful) Ten more MPI routines (sometimes useful) More group routines (like Bcast and Reduce): MPI_Alltoall, MPI_Alltoallv MPI_Scatter, MPI_Gather Non-blocking send and receive: MPI_Isend, MPI_Irecv MPI_Wait, MPI_Test, MPI_Probe, MPI_Iprobe Synchronization: MPI_Barrier
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Example: Example: Send an integer x from proc 0 to proc 1
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/27/2011 for the course CMPSC 140 taught by Professor Gilbert during the Fall '11 term at UCSB.

Page1 / 10

cs140-mpi - Hello, world in MPI Hello, #include ...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online