Fortran MPI on Windows

MPI on Windows with C and Fortran is best accomplished with WSL using OpenMPI or MPICH, which gives essentially full performance MPI. We use WSL on Windows for MPI because the “mpi_f08” interface is not yet natively available on Windows via MS-MPI whether with or without MSYS2. Neither OpenMPI or MPICH is buildable or available with native Windows.

Nonetheless, if one wishes to install Microsoft MPI:

winget install Microsoft.msmpi

The MSYS2 MS-MPI library can be installed from the MSYS2 Terminal:

pacman -S mingw-w64-ucrt-x86_64-msmpi

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.