Skip to content

Instantly share code, notes, and snippets.

@ac101m
Created November 29, 2018 18:40
Show Gist options
  • Save ac101m/99fad5776872e83a4c1c60aa282772b1 to your computer and use it in GitHub Desktop.
Save ac101m/99fad5776872e83a4c1c60aa282772b1 to your computer and use it in GitHub Desktop.
#include "mpi.h"
#include "stdio.h"
int main(int argc, char **argv) {
MPI_Init(&argc, &argv);
int totalRanks, myRank, nameLen;
char myName[MPI_MAX_PROCESSOR_NAME];
MPI_Comm_rank(MPI_COMM_WORLD, &myRank);
MPI_Comm_size(MPI_COMM_WORLD, &totalRanks);
MPI_Get_processor_name(myName, &nameLen);
printf("Hello world from process %d of %d, on %s\n", myRank, totalRanks, myName);
MPI_Finalize();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment