Parallelization boilerplate code for C++, Python & Fortran 🏎️💨
Boilerplate code for creating parallel programs in a few different languages using MPI. The commands listed below are from the MPICH implementation of MPI, but Open MPI should also work fine. If using Open MPI, one should replace mpicxx
with mpic++
.
Compilation:
mpicxx MPI_boilerplate.cpp -o MPI_program
Execution (on 4 processors):
mpiexec -n 4 MPI_program
Execution (on 4 processors):
mpiexec -n 4 python MPI_boilerplate.py
Compilation:
mpifort MPI_boilerplate.f90 -o MPI_program
Execution (on 4 processors):
mpiexec -n 4 MPI_program