Created
June 11, 2019 12:32
-
-
Save Macorreag/a258a25c4b934d0ef5a52464563ab1f4 to your computer and use it in GitHub Desktop.
Hello World with MPI
This file contains hidden or 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
/* | |
* compile with : mpicc -o helloworld mpi_HelloWorld.c | |
* run with mpirun -np [#Number of Cores] helloworld | |
*/ | |
#include <stdio.h> | |
#include "mpi.h" | |
int main(int argc,char **argv){ | |
int rank,size; | |
MPI_Init(&argc,&argv); | |
MPI_Comm_size(MPI_COMM_WORLD,&size); | |
MPI_Comm_rank(MPI_COMM_WORLD,&rank); | |
printf("Hello world from process %d od %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