Compiling a Parallel MPI Code

This guide will be using the Intel compilers and the MPICH MPI 2 library (MVAPICH2) to compile a small parallel MPI-based Fortran 90 program. We will be using a simple 1D Heat Transfer program.

Step 1 – Download and transfer the program to the Cluster

The program is available here. Download it and transfer it to the cluster using WinSCP or any other file transfer program.

Step 2 – Load the Intel compilers and Intel MPI module

Enter the following commands:

module load intel
module load mvapich2

Step 2 – Compile the program

Enter the following command:

mpifort -o heat_transfer heat_transfer.f90

Step 3 – Run the program

Unlike sequential programs, as described in the previous guide, parallel programs cannot be executed directly on the login node. Instead, the must be submitted to the compute nodes as a job. This is described in this guide.