Using Intel® MPI Library 5.1 on Microsoft* Windows* with Microsoft* MPI based applications

ID 672973
Updated 2/25/2016
Version Latest
Public

author-image

By

Why it is needed?

In the past, different MPI implementations were binary incompatible with one another. This meant that you had to recompile your MPI application to use it with a different MPI implementation.

Fortunately, the situation has changed since then. At Supercomputing 2013, Argonne National Laboratory, Intel, Cray and IBM announced a common initiative for binary compatibility of MPI implementations. With this initiative, MPICH-based MPI implementations become binary compatible with one another, and no recompilation is needed to use a different MPI implementation with your compiled MPI application. This creates the possibility to compare performance of a particular HPC application when using different MPI implementations.

Intel® MPI Library on Windows* has the following benefits:

  • Support of the wide range of cluster hardware and software
    • Full support and tuned performance of all modern Intel® processors;
    • Full support and tuned performance of wide variety of modern interconnects, full support of Intel® interconnects;
  • Integration with Intel® Trace Analyzer and Collector
    • Tracing all MPI events in parallel application;
    • Disbalance detection;
    • MPI correctness checks;
    • API for user code instrumentation;
  • Extended debug and statistics
    • Intel MPI Library can collect key statistics about parallel run to identify issues and tune performance;
  • Full control of parallel application execution
    • Rich set of controls via environment variables, control flags or configuration files;
  • Support

Requirements

Install the Intel MPI Library for Windows OS on system based on the Intel® 64 architecture.

Step-by-step how to

To use Intel MPI Library 5.1 on Windows with MS-MPI* based applications you can recompile the sources of your application with Intel MPI Library, or use binary compatibility without recompilation.

In this article, the latter option will be covered.

Intel® C++/Fortran Compiler for Windows is used for building applications.

Let’s consider the following simple MPI application:


#include "mpi.h"
#include <stdio.h>

int
main (int argc, char *argv[])
{
    int i, size, rank, namelen;
    char mpiname[MPI_MAX_LIBRARY_VERSION_STRING];
    MPI_Status stat;

    MPI_Init (&argc, &argv);
    MPI_Get_library_version (mpiname, &namelen);
    MPI_Comm_size (MPI_COMM_WORLD, &size);
    MPI_Comm_rank (MPI_COMM_WORLD, &rank);

    if (rank == 0) {
        printf ("MPI implementation:\n %s\n", mpiname); 
        for (i = 1; i < size; i++) {
            MPI_Recv (&namelen, 1, MPI_INT, i, 1, MPI_COMM_WORLD, &stat);
            MPI_Recv (mpiname, namelen + 1, MPI_CHAR, i, 1, MPI_COMM_WORLD, &stat);

        }
    } else {
        MPI_Send (&namelen, 1, MPI_INT, 0, 1, MPI_COMM_WORLD);
        MPI_Send (mpiname, namelen + 1, MPI_CHAR, 0, 1, MPI_COMM_WORLD);
    }

    MPI_Finalize ();

    return (0);
}

  1. For testing purposes compile the application with MS-MPI:

    > cd <testapp directory>

    > icl <testapp>.c -o <testapp>.exe -I"<path to MS-MPI Include directory>" /link /LIBPATH:"<path to MS-MPI lib directory>\x64" msmpi.lib

  2. Check the MS-MPI library dependency:
     

    > dumpbin /dependents <testapp>.exe
     

    Dump of file testapp.exe

    File Type: EXECUTABLE IMAGE

      Image has the following dependencies:

        msmpi.dll

        KERNEL32.dll

  3. Launch the application with MS-MPI and check the output:
     

    > mpiexec –n 2 testapp.exe

    MPI implementation:

    Microsoft MPI 7.0.12437.6

  4. Prepare Intel MPI Library environment for MS-MPI application launches, invoke the application, and check the output:
     

    > cd <IMPI installation directory>\intel64\bin

    > copy impi.dll msmpi.dll

    > call mpivars.bat

    > cd <testapp directory>

    > mpiexec –n 2 testapp.exe

    MPI implementation:

     Intel(R) MPI Library 5.1.2 for Windows* OS

  5. 5. A simple MS-MPI Fortran application code and the steps to launch it with Intel MPI Library are as follows:
    
            program main
            use mpi
            implicit none
    
            integer i, size, rank, namelen, ierr
            character (len=MPI_MAX_LIBRARY_VERSION_STRING) :: mpiname
            integer stat(MPI_STATUS_SIZE)
    
            call MPI_INIT (ierr)
            call MPI_GET_LIBRARY_VERSION (mpiname, namelen, ierr)
            call MPI_COMM_SIZE (MPI_COMM_WORLD, size, ierr)
            call MPI_COMM_RANK (MPI_COMM_WORLD, rank, ierr)
    
            if (rank.eq.0) then
                print *, 'MPI implementation:'
                print *, mpiname
                do i = 1, size - 1
                    call MPI_RECV (namelen, 1, MPI_INTEGER, i, 1, MPI_COMM_WORLD, stat, ierr)
                    mpiname = ''
                    call MPI_RECV (mpiname, namelen, MPI_CHARACTER, i, 1, MPI_COMM_WORLD, stat, ierr)
                enddo
            else
                call MPI_SEND (namelen, 1, MPI_INTEGER, 0, 1, MPI_COMM_WORLD, ierr)
                call MPI_SEND (mpiname, namelen, MPI_CHARACTER, 0, 1, MPI_COMM_WORLD, ierr)
            endif
    
            call MPI_FINALIZE (ierr)
    
            end
    

    > cd <testapp directory>

    > ifort <path to MS-MPI Include directory>/mpi.f90 testapp.f90 -o testapp.exe -I"<path to MS-MPI Include directory>" -I""<path to MS-MPI Include directory>\x64" /link /LIBPATH:" <path to MS-MPI lib directory>\x64" msmpifec.lib msmpi.lib

    > mpiexec –n 2 testapp.exe

    MPI implementation:

    Microsoft MPI 7.0.12437.6

     

    > cd <IMPI installation directory>\intel64\bin

    > copy impi.dll msmpi.dll

    > call mpivars.bat

    > cd <testapp directory>

    > mpiexec –n 2 testapp.exe

    MPI implementation:

    Intel(R) MPI Library 5.1.2 for Windows* OS

Conclusion

This article demonstrates how to run an application linked with a non-Intel MPI implementation using Intel MPI Library on Windows* OS. To evaluate Intel MPI Library you can download the Intel MPI Library Runtime Environment free of charge (with limited support options). For more details, please refer to the Intel MPI Library Licensing FAQ.

*Other names, brands , and images may be claimed as the property of others.