#include #include #include #include "mpi.h" main(int argc, char *argv[]) { int num_procs, myrank; double a, b; int tag = 0; MPI_Status status; MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &num_procs); MPI_Comm_rank(MPI_COMM_WORLD, &myrank); a = 0; b = 0; if(myrank == 0) a = 1.0; MPI_Bcast((void *)&a, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD); printf("Process %d: a = %e, b = %e\n", myrank, a, b); MPI_Finalize(); return EXIT_SUCCESS; }