In the previous labs, you have been working with a serial application, compiling and running
it in batch. In this section, you will start transforming this into a parallel application
by setting up Visual Studio to be able to compile with MPIPro.
Prerequisites:
- Read
Compiling Parallel Applications
- H:\users\your_userid\lab\karp\ with a working solution file
(karp.sln, created in the Compile lab segment, with updated code
from the Add MPI lab segment).
If this is not the case, rename the folder karpFparSolution or
karpCparSolution to H:\users\your_userid\lab\karp\.
Refer to
the Logon and Copy Files lab for instructions for copying files.
Instructions using VS 2005:
- Open the karp.sln solution file, which was created earlier.
Open the file by navigating to H:\users\your_userid\lab\karp\,
then double-click on the karp.sln file. Or open Visual Studio and
then click on File | Recent Projects.
- Assuming you want to add the MPIPro include and library paths and files to this
project only, open the properties page for your parallel project. Make sure
All Configurations is chosen in the Configuration box.
C/C++:
- To add the include path for MPIPro go to
C\C++ | General | Additional Include Directories and type C:\Program
Files\MPIPro\include - To add the library path for MPIPro go to
Linker | General | Additional Libraries Directories and type
C:\Program Files\MPIPro\lib
- To add mpipro.lib as an additional dependency go to
Linker | Input | Additional Dependencies and type mpipro.lib.
- Change All Configurations to Debug
Go to C/C++ | Code Generation | Runtime Library and select
Multi-threaded Debug (/Mtd)
- Change All Configurations to Release
Go to C/C++ | Code Generation | Runtime Library and select
Multi-threaded(/MT)
Intel Fortran:
- No include path for MPIPro is needed
- To add the library path for MPIPro go to Linker | General | Additional Libraries
Directories and type C:\Program Files\MPIPro\lib
- To add mpipro.lib and mpipro_cdec.lib as additional dependencies go to
Linker | Input | Additional Dependencies and type in mpipro.lib
and mpipro_cdec.lib. A space is needed between the two library file names
- To avoid some annoying warning messages, go to Linker | Input | Ignore Specific
Library and type libc.lib
- Go to Fortran | External Procedures | Name Case Interpretation
and select Lower Case
- Change All Configurations to Debug
Go to Fortran | Libraries | Runtime Library and select
Debug Multithreaded -
Change All Configurations to Release
Go to Fortran | Libraries | Runtime Library and select Multithreaded
- Compile it on one of the login nodes.
There are multiple ways to build an executable:
- from the main menu choose Build | Build Project Name
- add the Build Toolbar from View | Toolbars | Build
and click on the Build icon
- right-click on the name of the project in the Solution Explorer
panel and choose the Build Solution option
All the above actions will create a debug version of the same code by default. If
you want the release version, you need to toggle the Debug/Release pane.
Instructions Using the Command Line:
- Edit the code with your favorite editor
- Compile the code
Intel C/C++ 9.1:
- setup_intelc32
- setup_mpi
- icl karp.c mpipro.lib
Intel Fortran 9.1:
- setup_intelf32
- setup_mpi
- ifort /Qlowercase karp.f mpipro.lib mpipro_cdec.lib
Results:
When you are done with this section, you should have a parallel executable ready to run.