OpenMPI is not currently available for native Windows. While Cygwin and WSL do have working OpenMPI, it is also possible to use MPICH via Microsoft MS-MPI as described in this article.
setup MPI on Windows MSYS2
This procedure gives MPI via MSYS2 GCC / Gfortran compilers on Windows.
Download and install Microsoft MS-MPI
mpiexec.exeavailable, add to user PATH:
C:\Program Files\Microsoft MPI\Bin– this is needed even when using MSYS2.
Install MSYS2 MS-MPI library, from the MSYS2 Terminal
pacman -S mingw-w64-x86_64-msmpi
compile, creating “mpi.mod” for Fortran use. Do NOT link with
aror MPI may only run with a single image.
cd C:/msys64/mingw64/ gfortran include/mpi.f90 -c -fno-range-check -fallow-invalid-boz
If you don’t compile the mpi.f90 as above, errors may result like:
use mpi Fatal Error: Cannot open module file 'mpi.mod' for reading at (1): No such file or directory
MS-MPI without MSYS2
If not using MSYS2, it’s still possible use MS-MPI. We will put the resulting artifacts under c:/lib/mpi
mkdir c:/lib/mpi/ Copy-Item -Path "C:/Program Files (x86)/Microsoft SDKs/MPI/Include" -Destination "c:/lib/mpi/" -Recurse cd c:/lib/mpi
you may need to edit “include/mpi.f90” to have
gfortran include/mpi.f90 -c -fno-range-check -fallow-invalid-boz
Do NOT link with
ar or MPI may only run with a single image.