Building and Running a Distributed Coarray Application on Windows

Published:09/13/2011   Last Updated:09/13/2011

This is a brief how-to guide for using Distributed Coarray Fortran on a Windows cluster.


To build an application that uses the distributed memory feature of Coarray Fortran on Windows, you must have:

  • Intel® Visual Fortran Composer XE 2011 Update 6 or newer
  • A license for Intel® Cluster Studio XE

To run a distributed coarray application on a Windows cluster, you must have:

  • A Windows-based cluster running Microsoft Windows HPC Server 2008* or Microsoft Windows Compute Cluster Server 2003*

Configuration Setup:

To run distributed applications you must have an established cluster, and the Intel® Fortran redistributable package must be installed on all target nodes in that cluster. Target nodes are cluster nodes that will be participating when your application is run.

You must create a file containing the names of all target nodes in the cluster; this is often called machines.Windows, but you can use any name.

Before running your application, you must register your Windows password with the Intel® MPI Library (part of Intel Cluster Toolkit). This needs to be done from an Intel Cluster Toolkit command window. It only needs to be done on the originating node, and only needs to be done once, until your password changes. The command will prompt you for your password:

mpiexec -register

Validating your configuration:

You must be able to successfully run an MPI job under Intel® MPI in order for a distributed coarray application to run. At the end of this document is an example "hello world" program. It is highly recommended that you successfully run this simple program on your cluster, across multiple nodes before attempting to run a distributed coarray application.

Build the hello_mpi.f90 program in an Intel Cluster Toolkit command window.

Run it with the command:

mpiexec –machinefile machines.Windows –n 4 hello_mpi.exe

Confirm that it ran as expected. The command line switch "-n 4" sets the number of images that are to be executed; you can use any number you want.

Build your application:

You are now ready to build your coarray Fortran application. The command is straightforward:

ifort /Qcoarray=distributed /Qcoarray-num-images=N myprogram.f90


To run your program:

You need to pay attention to some details, or your program will only run on a single node.

The environment variable FOR_COARRAY_MACHINEFILE must be set to the full file path of your machines.Windows file. This only needs to be done on the node where you initially run your program.

The executable image of your program MUST be in a directory that is shared between all nodes in the Windows cluster, or the other nodes will not be able to run it. The full path of the executable, including the drive letter, must be valid on all cluster nodes.

Once these are set up, you simply have to run your program:


If there are command line inputs to your program, you can add them to the command line, such as:

myprogram.exe arg1 arg2

More things to think about:

Any input files to your program must be in a shared location so that all images on all nodes can access them.

It is recommended that all output files be generated into a shared location, but that may not be relevant to all programs.

Example Hello World program to test MPI

Program hello_mpi
   implicit none
   include "mpif.h"
   integer :: size, rank, ierr, len
   integer :: status
   call mpi_init(ierr)
   call mpi_comm_size(MPI_COMM_WORLD,size,ierr)
   call mpi_comm_rank(MPI_COMM_WORLD,rank,ierr)
   call MPI_GET_PROCESSOR_NAME(name, len,  ierr)
   write(6, "(*a,i3))") "MPI: size=", size,  "rank =", rank
   write(6,*) "host is", trim(name)
   call mpi_finalize(ierr)
   end program hello_mpi

Product and Performance Information


Performance varies by use, configuration and other factors. Learn more at