IntelMPI on Windows

Compiling with Intel compilers on Windows is a distinctive task from MacOS or Linux. The Intel C, C++ and Fortran compilers masquerade as Visual Studio compilers, especially in their command line options. The correct version of Visual Studio must be installed on Windows for Intel compilers to work. For the Intel Fortran compiler on Windows, the build options one normally uses for Intel Fortran on MacOS and Linux do not work, and even error out the compiler. For C and C++, one must use the icl compiler (there is no icc or icpc on Windows) as if it were MSVC. That can be perplexing at first for those not coming from the MSVC world. The scientific computing world and most software engineering tasks not originating in the Microsoft domain use GCC-like compilers, which have completely different sets of compiler options.

Prereqs

You must have the Intel Parallel Studio with Cluster options installed for C/C++ and Fortran. Additionally, you must have the Intel MPI library installed to get the compiler wrappers necessary for most uses. CMake and Meson may not recognize Intel MPI without the Intel MPI compiler wrapppers. Then you will have the Intel MPI compiler wrappers.

Loading Intel compiler environment

It’s important that you load the compilervars.bat script to enable the Intel compilers for each session and NOT the psxevars.bat. For convenience, make a batch script like %userprofile%\intel.bat containing:

C:\"Program Files (x86)"\IntelSWTools\parallel_studio_xe_2019\compilers_and_libraries_2019\windows\bin\compilervars.bat intel64`

set FC=ifort
set CC=icl
set CXX=icl

MPI

Another distinctive feature of using MPI on Windows is that a username and password are required, even on a simple standalone laptop. Good security practices may include creating a separate unprivileged user account that is only used for MPI jobs. If this is suitable for your security environment, run MPI jobs in that other user account by from Command Prompt:

runas /user:mympiusername cmd

This opens a new Command Prompt window. The environment variables are not passed to this new window, so you may need to run Intel compilervars.bat again.

You can register the user credential into the Windows registry, if appropriate for your environment. If doing so, we would again urge to consider using a separate user account that’s only used for MPI runs.

If you don’t sign in, errors will be like:

Unable to manage jobs using credentials with a blank password. Please enter another account.

Intel MPI on Windows is only for Intel compiler

Unlike for Linux Intel MPI that may be used with:

  • GNU gcc and gfortran out of the box
  • PGI via $MKLROOT/../mpi/binding/intel-mpi-binding-kit.tar.gz

Windows Intel MPI is only for the Intel Fortran compiler and no other Fortran compiler at this time. For C/C++, WIndows Intel MPI supports Visual Studio and the Intel compilers only.

MPI 2008

Intel 19.1 compiler MPI does not support use mpi_f08 the Fortran 2008 bindings. To keep compatibility with IntelMPI on Windows, at this time one would consider the legacy Fortran MPI interface:

use mpi

call mpi_init(ierr)

call mpi_finalize(ierr)

end program

The Fortran 77 include mpif.h should be avoided in current Fortran programs as it breaks the fundamental Fortran 90 paradigm of modularity.