CIS5930-02 High performance computing for scientific applications

Homeworks

Homework 1

The program: You should write a program to multiply two matrices (C = A*B), and output the sum of all the elements of C. Your code will take four command line arguments, M, N, P, and T, which are the number of rows of A, the number of columns of A = number of rows of B, the number of columns of B, and the number of threads respectively. You should use OpenMP to parallelize the program.

In order to help me check your program, please create a header file called AB.h which defines the following two macros, and use them to define the matrices A and B:

When you run your program, let A be defined by A(i,j) = a(i+1,j+1) and B by B(j,k) = b(j+1,k+1), 0 < i < M-1, 0 < j < N-1, 0 < k < P-1 . When I check your program, I may change the macros and check if your code performs correctly, for other matrices that I define.

Due date: Monday, 17 Feb 2003.

How and what to turn in: Email me a tar file containing your code and Makefile, at ashoks@modi4.ncsa.uiuc.edu, by 10 am on the due date. You should also plot two speed-up curves, (i) with automatic parallelization, applied to the program without OpenMP directives (here, you will need to use an environment variable to specify the number of threads) and (ii) with OpenMP parallelization. Please turn in hardcopies of these figures at the beginning of class 17 Feb 2003.

Note: (i) Your code should run on the Origin 2000 at NCSA, and you must have a Makefile. (ii) The tar file should not contain any executable or object files. (iii) The tar file should be called hw1.tar. On untarring (tar xvf hw1.tar), a directory called hw1 should be created, with the required files in it. (iv) Typing make in the hw1 directory should create the executable hw1. (v) You should actually implement the matrix multiplication algorithm yourself, rather a using a library created by someone else! (vi) Please do not use more than 2 hours of cpu time, when running programs for this homework.

Grading criteria: Correctness of your program and its parallelization, performance of your program, speed-up curves, and following the given instructions.


Homework 2

The program: You should write a program to multiply two square matrices (C = A*B), where A is lower triangular, and output the sum of all the elements of C. Your code will take one command line argument, N, which is the number of rows (and columns) of A and B. You should use MPI to parallelize the program.

In order to help me check your program, please create a header file called AB.h which defines the following two macros, and use them to define the matrices A and B:

When you run your program, let A be defined by A(i,j) = a(i+1,j+1) and B by B(j,k) = b(j+1,k+1), 0 < i,j < N-1. When I check your program, I may change the macros and check if your code performs correctly, for other matrices that I define.

Due date: Monday, 31 Mar 2003.

How and what to turn in: Email me a tar file containing your code and Makefile, at ashoks@modi4.ncsa.uiuc.edu, by 10 am on the due date. You should also plot a speed-up curve. Please turn in hardcopies of these figures at the beginning of class, 31 Mar 2003.

Note: (i) Your code should run on the Origin 2000 at NCSA, and you must have a Makefile. (ii) The tar file should not contain any executable or object files. (iii) The tar file should be called hw2.tar. On untarring (tar xvf hw2.tar), a directory called hw2 should be created, with the required files in it. (iv) Typing make in the hw2 directory should create the executable hw2. (v) You should actually implement the matrix multiplication algorithm yourself, rather a using a library created by someone else! (vi) Please do not use more than 2 hours of cpu time, when running programs for this homework.

Grading criteria: Correctness of your program and its parallelization, efficiency of the algorithm and its implementation, speed-up curves, and following the given instructions.


Last modified: 12 Mar 2003