// MPI code in C++. // See [Gropp/Lusk/Skjellum, "Using MPI", p.33/41 etc.] // and /opt/mpich/include/mpi2c++/comm.h for details #include "greetings.h" #include // MPI #include using namespace std; int main(int argc, char *argv[]) { MPI_Comm icomm = MPI_COMM_WORLD; MPI_Init(&argc, &argv); // E2 int myrank, numprocs; MPI_Comm_rank(icomm, &myrank); // my MPI-rank, process-ID MPI_Comm_size(icomm, &numprocs); // number of all processes // cout << "\n Process nr. " << myrank << " says, there are " << numprocs << " processes running.\n \n"; // // E3 if (0==myrank) { cout << "\n Process nr. " << myrank << " says, there are " << numprocs << " processes running.\n \n"; } //greetings(icomm); greetings_cpp(icomm); // E4 MPI_Finalize(); // E2 return 0; }