- Ubuntu 20.04 LTS
-
sudo aptitude install mpich
-
mpiexec --version
-
new code
#include "mpi.h" #include <stdio.h> int main(void) { int rankID; int sizeNum; MPI_Init(0, 0); MPI_Comm_size(MPI_COMM_WORLD, &sizeNum); MPI_Comm_rank(MPI_COMM_WORLD, &rankID); printf("Hello world! %d of total = %d\n", rankID, sizeNum); MPI_Finalize(); return 0; }
-
mpicc demo_1.c -o demo_1
-
mpirun -np 8 ./demo_1