Assignment 2 - MPI Warmup

Using Stampede/Longhorn

A sample job_script would look like this

#$ -V
#$ -cwd
#$ -N jobname #Replace with your job name
#$ -j y
#$ -o $JOB_NAME.o$JOB_ID
#$ -pe 2way 16 #read explanation below
#$ -q development #queue name - do not change this
#$ -l h_rt=00:03:00 #specifies resource limits - in this case, the maximum amount of time for which your job can run
#$ -M emailid #Replace with your email id
#$ -A A-cs41 #Project Name - Do not change this
#$ -P data
ibrun ./exec < args >

The -pe option specifies the number of cores on which your job runs and the distribution of these cores. Consider Longhorn where each node has 8 cores, the -pe should be used as follows
-pe < TpN > way < NoN x 8 >

where < TpN > is the number of cores to use per node
and < NoN x 8 > is the total number of cores, which is 8 x number of nodes
For MPI codes, you should try to experiment with 1 core per node to get an estimate of how expensive communication can be.

More details about submitting jobs on Longhorn can be found at the following links.

MPI Resources

The tutorials here should get you started with MPI programming.

Compiling your MPI program

mpicc -o exec_name program_name.c -lmpich

Debugging and Profiling

Debugging and optimizing parallel programs is much harder as compared to sequential programs, and that is something you will realize fairly soon into assignment 1. This tutorial should help you get started.


While performance is not a concern for this assignment, it'll be a crucial component from assignment 3 onwards. Therefore, it is probably a good idea to play around with performance measurements while doing this warm-up assignment. You should use the optimizations discussed in class to improve the performance of your parallel program.

We will be using PAPI to measure the performance of all parallel programs. PAPI is a performance measurement tool that uses hardware counters to keep track of various performance based pararemeters. PAPI can be used as mentioned in Assignment 1.

Submission Instructions

The assignment is due on Feb 8 by 11:59pm.

Prepare a tar file for your submission. That tar file should have your report, your source code and a readme file. The readme file should have your names, instructions for compiling your code and the number of slip hours used. The total number of slip hours should be mentioned as "slip_hours_used:< number >" in the readme file. (I will use a script to read this, so ensure you stick to this format.)

I will run the parallel prefix computation as : ibrun ./exec num_procs input_file
You can use MPI_Comm_size() to initialize the number of processes you use or you can use the -n option. Just make sure you specify this in the README file.
The input file will contain the size of the array followed by a space separated string of numbers. A sample input file is here.

To submit your assignment, use the following command
turnin --submit akanksha hw2 < your_tar >