// // "hello world" program // #include #include // has exit(), etc. #include // MPI header file int main(int argc, char *argv[]) { // initialize for MPI (should come before any other calls to // MPI routines) MPI::Init(argc, argv); // get number of processes int nprocs = MPI::COMM_WORLD.Get_size(); // get this process's number (ranges from 0 to nprocs - 1) int myid = MPI::COMM_WORLD.Get_rank(); // print a greeting cout << "hello from process " << myid << " of " << nprocs << endl; // clean up for MPI MPI::Finalize(); return EXIT_SUCCESS; }