#include #include #include int main(int argc, char** argv) { MPI_Init(NULL, NULL); int world_size; MPI_Comm_size(MPI_COMM_WORLD, &world_size); int world_rank; MPI_Comm_rank(MPI_COMM_WORLD, &world_rank); printf("Hello world from rank %d out of %d processors\n", world_rank, world_size); fflush(stdout); sleep(2); for (int i = 0; i < 10; ++i) { printf("Rank %d is working...\n", world_rank); fflush(stdout); sleep(2); } printf("Goodbye from rank %d out of %d processors\n", world_rank, world_size); MPI_Finalize(); }