Prerequisites
This lab should be done after the talk MPI Point to Point Communication I. You should complete the MPI Basics exercise before starting this lab. This means you should already be familiar with the contents of Compiling and Porting Applications
and Tutorial on Cluster CoNTroller System: Running a Parallel Job.
To learn or reference the syntax of MPI calls, access the Message Passing Interface Standard at http://www-unix.mcs.anl.gov/mpi/ or see the MPI/Pro routines.
Overview
The first lab exercise will familiarize you with the use of blocking and non-blocking calls. In the second lab exercise, you will work on a simple code to improve data decomposition and communication patterns.
Exercise
-
Using either the Windows GUI or the command line, copy all lab files found in
- H:\VWlabs\MPI\Pt2pt\Lab\
to a location in your home directory on H:, e.g.,
- mkdir H:\users\your_userid\Pt2pt
- copy H:\VWlabs\MPI\Pt2pt\Lab\* H:\Users\your_userid\Pt2pt
- Edit and compile your programs on one of the login nodes using either Microsoft Visual Studio or a simple text editor (like Notepad) plus compiler commands.
- Create or modify a batch file using your favorite editor. Use the CCS requirements keyword to request development nodes for faster turn around.
- Submit this .bat file with ccsubmit. Remember NOT to run your executables on the login nodes!
Instructions
C lab file: deadlock.c
C solution file: fixed.c
Fortran lab file: deadlock.f
Fortran solution file: fixed.f
This exercise demonstrates that non-blocking routines are safer than blocking routines.
- Compile the deadlock program, specify that two nodes will be used, and run the program. The program will print a few lines of output and then stall. You will have to terminate it by entering <ctrl>c.
- Read through the deadlock program. Do you understand why it deadlocks?
- Correct the deadlock program, so that it can run to completion, by replacing a blocking call with a non-blocking call.
Solution
See the source files named in the Instructions.
Cleanup
When you are done running programs, delete your subfolder on the T: drives. End your batch job with ccrm or ccrelease. You may also wish to delete any files you copied from the VWlabs folder into your space on H:.