Skip to main content

more options


Lab Exercise

Prerequisites

This exercise assumes that you have completed the Lab Exercise in Compiling and Porting Serial Applications.


Overview

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.


Exercise

  1. Copy hello.mpi.c and/or hello.mpi.f from H:\VWLabs\Writing1 into a local folder.
  2. Open Visual Studio .Net and create a new project.
  3. Add your parallel code (hello.mpi.c or hello.mpi.f) to the newly created project.
  4. Make sure the compiler and linker will find the necessary MPI include and library files.
  5. Use the multi-threaded libraries.
  6. Build your executable.
  7. Run it in the collaboratory. (Remember, you can't run a parallel job on a login node).
  8. Run it as a batch job on one of the development nodes. (see Cluster Controller System for Parallel Jobs).

Solution

  1. Your choices are hello.mpi.c and hello.mpi.f from the H:\VWlabs\Writing1. Copy either of them to your project directory.
  2. 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.
  3. 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
  4. 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.
  5. 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.
  6. This is like step 7 of the Lab Exercise in Compiling and Porting Serial Applications.
  7. (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>

Cleanup

Close Visual Studio .NET and delete your local folder created for this exercise H:\Users\YourUserName\MyVWProjects.