Assignment 3 - Tiled Matrix Multiplication

DUE Wednesday, November 13 at 11:59:59 PM

Overview

The objective of this assignment is to implement a tiled matrix multiplication kernel that can support arbitrary sized matrices.

Tiled Matrix Multiplication

  1. For this lab, we will be using Github Classroom.
    Please join the classroom by clicking the following link: https://classroom.github.com/a/FCYumQic Once you join the classroom, a private github repository will automatically be created with the starter code.
    Simply git clone to copy the starter code to Bender.

  2. Edit the source files kernel.cu and main.cu to complete the functionality of the matrix multiplication on the device. The two matrices could be any size, but we will not test your code with an output matrix size exceeding 65,536 elements (for example, 256 x 256 input matrices). This is purely a limitation for testing your code in a timely manner. Your code should still be able to run for significantly larger matrices.

  3. There are three modes of operation for the application. Check main() for a description of the modes (repeated below). You will support each of these modes using a Tiled matrix multiplication implementation.

    • No arguments: The application will create two randomly initialized matrices to multiply size (1000x1000). After the device multiplication is invoked, it will compute the correct solution matrix using the CPU, and compare that solution with the device-computed solution. If it matches (within a certain tolerance), if will print out "Test PASSED" to the screen before exiting.
    • One argument: The application will use the random initialization to create the input matrices (size mxm, where m is the argument. Start your testing with small matrices.
    • Three arguments m, k, and n: The application will initialize the two input matrices with random values. A matrix will be of size m x k while the B matrix will be of size k x n, producing a C matrix of size m x n
    • Note that if you wish, you may add a mode to accept input matrices from files, or to dump input and output matrices to files to facilitate testing. The first three modes must remain untouched.
  4. Commit and push your completed tiled matrix multiplication code to the private repository.

GPGPU-Sim analysis

Please see the GPGPU-Sim setup guide.

We will now analyze memory behavior of tiled matrix multiplication using GPGPU-Sim.
To aid in analyzing the microarchitectural properties of these programs, it may help to save the output of the GPGPU-Sim run into a file. You may save the output by redirecting the printouts to a file using ./sgemm-tiled &> outfile. Do NOT commit any output files to the git repository.

Since the focus of this lab is on memory performance, we will focus mainly on these memory statistics:

gpgpu_n_load_insn   Number of global/local load instructions executed.
gpgpu_n_store_insn  Number of global/local store instructions executed.
gpgpu_n_shmem_insn  Number of shared memory instructions executed. 

Answer the following questions:

For this assignment, questions to be answered will be available in the corresponding Gradescope assignment https://www.gradescope.com/courses/884381/assignments/5263550. To access the Gradescope assignment, click on the Gradescope link on the left-side of the class eLearn page.

## Submission 1. Commit and push your completed tiled matrix multiplication code to the github repository. (You only need to modify `kernel.cu` and `main.cu`.) 2. **For this assignment, the questions will be answered through a Gradescope assignment. To access Gradescope, there is a link on the left-side of the class eLearn page. **