This section takes you through the steps of compiling and linking
for C++. You can use WMPI II with any C++ compiler compatible with
Microsoft C++ Compiler generated .lib files. Currently Microsoft Visual C++
and Intel C++ Compiler are supported.
In order to do cross compilation, e.g. compiling in Windows 32-bit
for a 64-bit platform, all WMPI II distributions for Windows contain lib
files for all 3 windows platforms. In the base [install dir] directory,
one can find the distribution platform lib files in [install dir]\lib
directory.
WMPI II lib files for each platform can be found in the following subdirs:
· [install
dir]\libi32 - for 32-bit systems
· [install
dir]\libx86_64 - for 64-bit Extended Systems
· [install
dir]\libia64 - for Itanium2 systems
Include files are common for all platforms and can be found in
[install dir]\include.
To do cross-compilation, start the development environment for the target
platform and use the platform specific lib directory instead of the default
one.
This section shows you the basic options that you have to set in
order to use WMPI II in a C++ project. The way to set these options is
dependent on your compiler and you must look how to set them in the
Compiler's Documentation.
- Set
include path: [install dir]\include
- Link
with the library: wmpi2.lib and wmpi2cppbindings.lib
Step 1: Include Path
In order to use WMPI II you will need to include the file mpi.h. This include file is found in the directory [install dir]\include and can be referenced in a
portable manner by using the environment variable MPI2_ROOT. To use environment variables, please make
sure that your compiler expands them when setting the Include Path.
Example 1:
Using a compiler that expands environment variables in options, you would
specify it as:
$(MPI2_ROOT)\include
Example 2:
Using a compiler that does not expand environment variables in options and
having WMPI II installed in the default directory, you would specify it as:
C:\Program Files\WMPI II\include
Step 2: Link Settings
In order to use WMPI II you will need to link with wmpi2.lib and wmpi2cppbindings.lib.
These files can be found in the directory [install
dir]\lib and can be referenced in a portable manner by
using the environment variable MPI2_ROOT.
To use environment variables, please make sure that your compiler expands
them when setting the Lib Path options.
Example 1:
Using a compiler that expands environment variables in options, you would
specify them as:
$(MPI2_ROOT)\lib\wmpi2.lib
$(MPI2_ROOT)\lib\wmpi2cppbindings.lib
Example 2:
Using a compiler that does not expand environment variables in options and
having WMPI II installed in the default directory, you would specify them
as:
C:\Program Files\WMPI II\lib\wmpi2.lib
C:\Program Files\WMPI
II\lib\wmpi2cppbindings.lib
This section shows you how to configure your Microsoft Visual C++ 7
projects to use WMPI II in C++:
- Include
the file: mpi.h
- Set
code generation to "Multithreaded DLL"
- Link
with the library: wmpi2.lib and wmpi2cppbindings.lib
SPECIAL NOTE FOR x86_64 SYSTEMS: Make sure that
Visual C++ is configured to use the compiler for 64-bit extended systems
and in case the version installed is for other platform, use the platform
specific lib dir, located in $(MPI2_ROOT)\x86_64\lib.
SPECIAL NOTE FOR ITANIUM2 SYSTEMS: Make sure that
Visual C++ is configured to use the compiler for Itanium2 systems and in
case the version installed is for other platform, use the platform specific
lib dir, located in $(MPI2_ROOT)\ia64\lib.
Step 1: Include File
In order to use WMPI II you will need to include the file mpi.h. This include file is found in the directory [install dir]\include and can be referenced in a
portable manner by using the environment variable MPI2_ROOT.
Example:
Go to "Project | Properties", open the "C/C++" folder
and choose category "General" add $(MPI2_ROOT)\include to
"Additional include directories".

Step 2: Code Generation
To avoid link warnings and errors it is necessary to configure your WMPI II
application to use "Multithreaded DLL" run-time libraries. Go to
"Project | Properties", open the "C/C++" folder and
choose category "Code Generation". Now choose "Multithreaded
DLL" in the "Runtime Library" property.

Step 3: Link Settings
In order to use WMPI II it is necessary that your project link with the
library wmpi2.lib and wmpi2cppbindings.lib. To configure this go to
"Project | Properties", open the "Linker" folder,
choose category "General" and add the path $(MPI2_ROOT)\lib to
the "Additional Library Directories".

From the "Linker" folder, select the "Input"
section and add the wmpi2.lib and wmpi2cppbindings.lib to the Additional
Dependencies.

This section describes how to use WMPI II with the Intel C++
Compiler under the command line.
If you are using the Intel C++ Compiler integrated with Visual Studio,
please refer to the Microsoft Visual C++
section.
After starting the Build Environment for the target platform, to use WMPI
II you need to follow these steps:
- Set
include path: [install dir]\include
- Link
with the library: wmpi2.lib
and wmpi2cppbindings.lib
Step 1: Include Path
In order to use WMPI II you will need to include the file mpi.h. This include file is found in the directory [install dir]\include and can be referenced in a
portable manner by using the environment variable MPI2_ROOT.
For the Intel C++ Compiler you have to specify the option:
/I
"%MPI2_ROOT%\include"
Example for I32 platform:
To compile hello_world.c and produce a
compiled object, hello_world.obj, run the following
command:
D:\hello_world>
icl /I "%MPI2_ROOT%\include" /c hello_world.c
Example for Itanium platform:
To compile hello_world.c and produce a
compiled object, hello_world.obj, run the following
command:
D:\hello_world>
ecl /I "%MPI2_ROOT%\include" /c hello_world.c
Step 2: Link Settings
In order to use WMPI II you will need to link with wmpi2.lib and wmpi2cppbindings.lib.
These files can be found in the directory [install
dir]\lib and can be referenced in a portable manner by
using the environment variable MPI2_ROOT.
For the Intel C++ Compiler you have to include the following options:
/libpath:"%MPI2_ROOT%\lib"
wmpi2.lib wmpi2cppbindings.lib
Example:
To link the previous compiled object, hello_world.obj,
and produce the final executable, one can execute the following command:
D:\hello_world>
xilink /out:hello_world.exe /libpath:"%MPI2_ROOT%\lib" wmpi2.lib
wmpi2cppbindings.lib hello_world.obj
|