Skip to content

Instantly share code, notes, and snippets.

@bholt
Created March 13, 2013 07:20
Show Gist options
  • Select an option

  • Save bholt/5149946 to your computer and use it in GitHub Desktop.

Select an option

Save bholt/5149946 to your computer and use it in GitHub Desktop.
#include <mpi.h>
#include <stdio.h>
#include <unistd.h>
int main(int argc, char* argv[]) {
MPI_Init(&argc, &argv);
int rank, size;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
printf("Hello from %d of %d.\n", rank, size);
for (int i=0; i<10; i++) {
sleep(1);
fprintf(stderr, "%d...\n", i);
}
fprintf(stderr, "done\n");
MPI_Finalize();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment