Created
April 24, 2016 09:22
-
-
Save salamza/81637009b7690851e547b6ab8e6a9f46 to your computer and use it in GitHub Desktop.
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> | |
#include <string.h> | |
int main (int argc, char **argv) { | |
int rank, size, partner; | |
int namelen; | |
char name[MPI_MAX_PROCESSOR_NAME]; | |
/* initialize MPI */ | |
MPI_Init(&argc, &argv); | |
/* how many processes */ | |
MPI_Comm_size(MPI_COMM_WORLD, &size); | |
/* my rank */ | |
MPI_Comm_rank(MPI_COMM_WORLD, &rank); | |
/* my name is */ | |
MPI_Get_processor_name(name, &namelen); | |
printf("Hello world: rank %d of %d running on %s \n", rank, size, name); | |
/* finalize MPI */ | |
MPI_Finalize(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment