In this example, we show how to implement the standard Hello world
program using mpi.
#include <iostream>
int main(int argc, char *argv[]) {
std::cout << "Hello from processor " << rank << "\n";
}
C++ wrapper around MPI_Comm providing various convenience functions.
int rank() const
Get the rank of the calling process in the communicator.
Includes all relevant mpi headers.
RAII class to initialize and finalize MPI.
Output (depends on the number of processes and the order is arbitrary):
Hello from processor 2
Hello from processor 3
Hello from processor 0
Hello from processor 1