Please refer to
Compiling and Porting Serial Applications
for a detailed description of creating
VS 2005 projects using C/C++ or Fortran.
Following is a detailed discussion of the additional steps needed
to compile a parallel application in Microsoft Visual Studio 2005.
MPI Libraries
To make your application communicate using MPI/Pro, MPI/Pro must be installed on
the machine where you are compiling the parallel executable (MPI/Pro is available
on the winlogin nodes and in the Collaboratory). The MPIPro library must be added
to the Linker as an additional dependency. To
add MPIPro.lib go to
project properties; make sure that All Configurations
is selected in the Configuration: window, then go to Linker
| Input |
Additional Dependencies and add MPIPro.lib here.
If you are using Intel Fortran, there are a few more steps. MPIPro_cdec.lib must also be added to
the Additonal Dependencies list with a space between it and MPIPro.lib.
To avoid some annoying warning messages when compiling, add
libc.lib to Ignore Specific Library. You must also specify
that lower case names will be used.
Go to Fortran | External Procedures | Name Case Interpretation and add
Lower Case.
Note: the MPI libraries are an example of limitations on your compiler options.
The MPI/Pro library does not support the combinations [mixed case names and stdcall]
or [uppercase names and cdecl].
Multi-threaded Libraries
Another important consideration when you build parallel programs is to use the correct
runtime libraries. The MPI/Pro libraries have been built using the multi-threaded libraries, so
it is best that you do so also.
If your project is written in C/C++, you should designate the multi-threaded libraries
for the debug and release versions separately, because there are both debug
and plain versions of the multi-threaded libraries for C/C++.
VS 2005 uses the correct Multi-threaded libraries for Intel Fortran
by default, so you don't need to change the settings when you are writing Fortran code.
Go to the
project properties dialog box for a project or source file.
- Go to C/C++ | Code Generation | Runtime
Library
- choose the libraries corresponding to what is in the Configuration:
window (Debug Configuration = Multi-threaded Debug (/MTd); Release
Configuration = Multi-threaded(/MT).
Note: you should change the properties of an individual source file only if they need
to be different from the ones that have been set for the project.
Default paths
If you are going to be writing many programs using MPI, consider customizing your
VS 2005 environment so that the include files and libraries will be found automatically.
Even on the winlogin nodes, VS 2005 can be personalized to suit your needs. But
be aware that the login nodes are separate machines, so any customization to VS
2005 you do on one login node will not automatically be applied to the others.
Microsoft C/C++:
- Go to Tools | Options | Projects and Solutions
|
VC++ Directories
- add C:\Program Files\MPIPro\Include
to the Include files section
- add C:\Program Files\MPIPro\Lib to
the Library files section
Intel C:
- Go to Tools | Options | Intel(R) C++
| Directories
- add C:\Program Files\MPIPro\Include
to the Includes: section. Each entry is separated by a semi-colon.
- add C:\Program Files\MPIPro\Lib to
the Libraries section. Each entry is separated by a semi-colon.
Intel Fortran:
- Go to Tools | Options | Intel(R) Fortran
| General
- add C:\Program Files\MPIPro\Lib
to the Libraries:
section. Each entry is separated by a semi-colon.
Note: These paths can either be typed in or found by browsing.
Project Specific Paths
If you don't set up default paths, each project will need to be customized by putting
in the include and library paths on its
project properties. This would make sense for a project
that needs specific libraries that none of your other projects need. Go to
the project's properties page and make sure that All Configurations
shows in the Configuration: window,
All:
-
add C:\Program Files\MPIPro\Lib to Linker | General | Additional
Library Directories
C/C++:
-
add C:\Program Files\MPIPro\Include
to C/C++ | General | Additional Include Directories
Additional Fortran Steps
Include paths are not needed for Fortran projects because no include files are needed
by MPI/Pro. Instead, a module definition file MPIf.f90 is
needed. This file must be added as an additional source file and will be compiled
with your other source files. It is located in C:\Program Files\MPIPro\Include.