MPI hello.f90
Obligatory Hello, World! program built with MPI in Fortran.
This example requires fortran, so if you don't have it installed already, install gfortran from the ubuntu repositories.
Every MPI program should call a minimum of two functions: MPI_INIT() and MPI_FINALIZE(). The example below is a very simple Hello, World! Fortran program:
MPI programs can be compiled with the appropriate calls to MPI wrapper scripts, if they exist. For OpenMPI, this is called 'mpif90'. The resulting executable can then be run using the 'mpiexec' or 'mpirun' commands. Take care to use the 'mpiexec' command from the same implementation as the build.
Each process in an MPI application is able to identify itself by a unique rank, and can query for both rank and total number of processes:
Last updated