Skip to content

Instantly share code, notes, and snippets.

@rehrumesh
Created May 31, 2015 13:06
Show Gist options
  • Save rehrumesh/41a4e94f56be84ffdeeb to your computer and use it in GitHub Desktop.
Save rehrumesh/41a4e94f56be84ffdeeb to your computer and use it in GitHub Desktop.
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_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
printf("Hello world! I am %d of %d\n", rank, size);
MPI_Finalize();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment