MSMPI is Microsoft’s implementation of MPI (Message passing interface) library.  I’ve explained it a few times before.  MSMPI Explained, MSMPI SDK patch.

Many people have asked me for examples that they can understand and relate to how MPI is used on Unix.  Here’s the information you’ve been looking for!

Compilers supported:  MingW’s GCC, microsoft CL, PGI, Intel…. but not GCC under cygwin or SUA.

Caution:  For 32 bit, Microsoft MPI library uses __STDCALL, which means one must use MPIAPI macro in function declaration.  Here’s an example:

PetscMPIInt PETSC_DLLEXPORT MPIAPI Petsc_DelTag

(MPI_Comm comm,PetscMPIInt keyval,void* attr_val,void* extra_state);

You really just need to make sure mpi.h can be found in the include path, and msmpi.lib can be found in the Library path.  Here are a few examples:

Visual Studio:

Include dir in “Additional Include directories” in your project property.

image

If you are building a 32 bit application, make sure i386 path is used.

image

64 bit library path.

image

Finally, make sure msmpi.lib is part of the linker input.

image

MINGW native windows GCC compiler:

g++ -O3 -g -c Main.cpp -I/c/Program\ Files/Microsoft\ HPC\ Pack\ 2008\ SDK/Include/

g++ -O3 -g Main.o /c/Program\ Files/Microsoft\ HPC\ Pack\ 2008\ SDK/Lib/i386/msmpi.lib -o mympi.exe

Intel compiler under cygwin Unix environment:

Using include path example:

-I/cygdrive/c/Users/wenmingy/petsc-intel/petsc-2.3.3-p15 -I/cygdrive/c/Users/wenmingy/petsc-intel/petsc-2.3.3-p15/bmake/win32_intel -I/cygdrive/c/Users/wenmingy/petsc-intel/petsc-2.3.3-p15/include  -I /cygdrive/c/Program\ Files/Microsoft\ HPC\ Pack\ 2008\ SDK/Include

Library path example:

art7EAF-L/cygdrive/c/Users/wenmingy/petsc-intel/petsc-2.3.3-p15/lib/win32_intel -L/cygdrive/c/Users/wenmingy/petsc-intel/petsc-2.3.3-p15/lib/win32_intel -lpetscts -lpetscsnes -lpetscksp -lpetscdm -lpetscmat -lpetscvec -lpetsc /cygdrive/c/Program\ Files/Microsoft\ HPC\ Pack\ 2008\ SDK/Lib/amd64/msmpi.lib -L/cygdrive/c/Users/wenmingy/petsc-intel/petsc-2.3.3-p15/externalpackages/f2cblaslapack/win32_intel -L/cygdrive/c/Users/wenmingy/petsc-intel/petsc-2.3.3-p15/externalpackages/f2cblaslapack/win32_intel -lf2clapack -L/cygdrive/c/Users/wenmingy/petsc-intel/petsc-2.3.3-p15/externalpackages/f2cblaslapack/win32_intel -L/cygdrive/c/Users/wenmingy/petsc-intel/petsc-2.3.3-p15/externalpackages/f2cblaslapack/win32_intel -lf2cblas Gdi32.lib User32.lib Advapi32.lib Kernel32.lib Ws2_32.lib