CS/EE 147 – Assignment 1 : Matrix Addition
Assignment 1 - CUDA and Bender Setup
DUE Friday, April 10 @ 11:59:59PM Pacific Time
Overview
The objective of this assignment is to get setup with using CUDA on the Bender ENGR server. The following tutorial provides detail steps and directions: BenderTutorial.pdf
Note: For the above tutorial, you do not need MobaXterm, but any other terminal (PuTTY, Linux, VSCode, etc.) should be fine.
If you are unfamiliar with using the Linux commandline, there’s a great tutorial here: https://www.codecademy.com/learn/learn-the-command-line
For this lab, we will be using Github Classroom. Please join the classroom by clicking the following link: Github Classroom Assignment 1 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.
Matrix Addition
Once you have access to Bender and confirmed it can compile and run CUDA code, we will implement a simple Matrix Addition.
- Clone the git repository. There should be 5 files:
kernel.cu,main.cu,Makefile,support.cu,support.h - By default, Matrix Addition operates on 1000x1000 matrices, which are randomly generated. To ensure consistency when grading, do not add any srand seed value in
main.cu. - Complete the Matrix Addition application by adding your code to
main.cuandkernel.cu. Use a thread block dimension of 16x16. You may consult the class slides on vector add.
You must use 2D grids and blocks for your computation. Using 1D grids and blocks will pass the checks. But that misses the objective of this assignment.
Answer the following questions:
- How many total thread blocks do we use?
- Are all thread blocks full? That is, do all threads in the thread block have data to operate on?
- How can this basic Matrix Addition program be improved, i.e. what changes do you think can be made to speed up the code? Try out some of your ideas and note down your observations.
Submission
Answer the previous questions by including a report document in the repository in either PDF, Plain text, or Markdown format only. Please name your report FirstName-LastName.pdf or FirstName-LastName.txt or FirstName-LastName.md, etc. Commit and push your completed Matrix Addition to the Github repository. (You only need to modify kernel.cu and main.cu.)
Please also include your name in the report.
