Fortran MPI on Windows
MPI on Windows with C and Fortran is best accomplished with Windows Subsystem for Linux (WSL) using OpenMPI or MPICH, which gives full performance MPI. For x86_64 CPUs, Intel MPI library has full MPI support including the Fortran “mpi_f08” interface.
Using WSL to use MPI on Windows is especially important for ARM64 CPUs, which are not supported by Microsoft MS-MPI at the time of writing. We use WSL on Windows for MPI because the “mpi_f08” interface is not yet natively available on Windows via Microsoft MS-MPI whether with or without MSYS2. Neither OpenMPI or MPICH is buildable or available with native Windows.
To install Microsoft MPI on an x86_64 CPU machine, one can use the Windows Package Manager (winget) to install MS-MPI:
winget search Microsoft.msmpiThe MSYS2 MS-MPI library can be installed from the MSYS2 Terminal:
pacman -S mingw-w64-ucrt-x86_64-msmpiUpon 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.