This exercise assumes that you have completed the
Lab Exercise in Compiling and Porting Serial Applications.
The goal of this lab exercise is to successfully compile and link a parallel code
and to optionally run it on the velocity cluster. Please refer to
Section 3.2 in this module for useful
information to complete this lab. If you want to try to run your executable,
please read
Cluster Controller System for Parallel Jobs
for the necessary details.
- Copy hello.mpi.c and/or hello.mpi.f from H:\VWLabs\Writing1
into a local folder.
- Open Visual Studio .Net and create a new project.
- Add your parallel code (hello.mpi.c or hello.mpi.f)
to the newly created project.
- Make sure the compiler and linker will find the necessary MPI include and library
files.
- Use the multi-threaded libraries.
- Build your executable.
- Run it in the collaboratory. (Remember, you can't run a parallel job on a login
node).
- Run it as a batch job on one of the development nodes.
(see
Cluster Controller System for Parallel Jobs).
- Your choices are hello.mpi.c and hello.mpi.f from
the
H:\VWlabs\Writing1. Copy either of them to your project directory.
- This is like
step 5 of the Lab Exercise in Compiling
and Porting Serial Applications. You could choose the name Hello_MPI_C
(C++) or Hello_MPI_F(Fortran) for the project.
- This is like
step 6 of the Lab Exercise in Compiling
and Porting Serial Applications. Add the source file hello.mpi.c or hello.mpi.f
to this project.
Intel Fortran: add C:\Program Files\MPIPro\include\mpif.f90
to your fortran project
- Assuming you want to add the MPI/Pro 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.
Visual 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 Library 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.
Intel Fortran:
- No include path for MPIPro is needed.
- To add the library path for MPIProgo 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 mpipro.lib mpipro_cdec.lib. There is a space between
the names of the two library files.
- To avoid some annoying warning messages, go to Linker | Input | Ignore Specific
Library and type libc.lib
- To insure compatibility between the MPIPro and Fortran libraries, go to Fortran
| External Procedures. The Calling Convention
should be left as Default, but Name Case Interpretation should
be changed to lowercase.
- The way you designate the multi-threaded libraries depends on both the configuration
and language. Refer to Multi-threaded Libraries in
3.2 .NET Projects for specific directions.
- This is like
step 7 of the Lab Exercise in Compiling
and Porting Serial Applications.
- (and 8.) Open a command prompt window: (Start | Run | cmd) and
navigate to the directory where the executable resides.
Create a machines file: localhost
> machines
Run the executable:mpirun
-np 2 <program.exe>
Close Visual Studio .NET and delete your local folder created for this exercise
H:\Users\YourUserName\MyVWProjects.