source /etc/profile.d/modules.sh
module load mpi/mpich-x86_64
printenv | grep MPI
after you run this.
#include <mpi.h>
MPI_Init(&argc, & argv);
int size; MPI_Comm_size(MPI_COMM_WORLD, &size);
int rank; MPI_Comm_rank(MPI_COMM_WORLD, &rank);
cout << "Hello world from " << rank << " of " << size << "!" << endl;
MPI_Finalize();
#include#include using namespace std; int main(int argc, char * argv[]) { MPI_Init(&argc, &argv); int size; MPI_Comm_size(MPI_COMM_WORLD, &size); int rank; MPI_Comm_rank(MPI_COMM_WORLD, &rank); cout << "Hello world from " << rank << " of " << size << "!" << endl; MPI_Finalize(); return 0; }
CXX = mpic++
mpiexec -n 5 hello