0%
1 2
| brew install openmpi export OMPI_CXX=g++-7
|
1 2
| mpic++ helloworld.cpp -o helloworld.out mpirun -n 2 ./helloworld.out
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| #include <cstdio> #include <mpi.h>
int main (int argc, char **argv) { int rank, size;
MPI_Init (&argc, &argv);
MPI_Comm_rank (MPI_COMM_WORLD, &rank); MPI_Comm_size (MPI_COMM_WORLD, &size);
printf( "Hello world from process %d of %d\n", rank, size );
MPI_Finalize();
return 0; }
|