Created
April 1, 2014 17:23
-
-
Save bholt/9918803 to your computer and use it in GitHub Desktop.
MPI Hello World
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <mpi.h> | |
#include <stdio.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); | |
char name[256]; | |
// MPI_Get_processor_name(name, sizeof(name)); | |
gethostname(name,255); | |
fprintf(stderr, "Hello from %s (%d/%d)\n", name, rank, size); | |
MPI_Finalize(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment