Fortran MPI on Windows

There are several methods available to get MPI on Windows, including MS-MPI, Intel oneAPI or Windows Subsystem for Linux libopenmpi-dev. We often use MPI via MSYS2 with GCC / Gfortran compilers on Windows:

  1. Download and install Microsoft MS-MPI

  2. Make mpiexec.exe available by adding to user PATH: C:\Program Files\Microsoft MPI\Bin – this is needed even when using MSYS2.

  3. Install MSYS2 MS-MPI library from the MSYS2 Terminal

    pacman -S mingw-w64-x86_64-msmpi
    

We didn’t use OpenMPI because it is not currently available for native Windows.

Upon installing or updating Intel oneAPI compilers and libraries on Windows, you may experience CMake failing to find MPI for MinGW. This happens because Intel compilers put Intel MPI on the system PATH. Fix this by removing Intel MPI from the system PATH and use the Intel Compiler shell instead, which provides all the needed directories.