Link to this document's Jupyter Notebook

In order to successfully complete this assignment you must do the required reading, watch the provided videos and complete all instructions. The embedded survey form must be entirely filled out and submitted on or before 11:59pm on Tuesday March 9. Students must come to class the next day prepared to discuss the material covered in this assignment.


Pre-Class Assignment: CUDA Memory Tiling

Goals for today's pre-class assignment

  1. Tiling
  2. Transpose Example
  3. Assignment wrap up

1. Tiling

A GPU does not do automatic memory caching like a CPU. Instead you need to do all of work for memory management yourself. The following video gives a brief overview of the concept of tiling.

QUESTION: Which of the following two code snippets (foo or bar) would benefit from tiling?

__global__ void foo(flout out[], float A[], float B[], float C[], float D[], float E[])
{
    int i = threadIdx.x;
    out[i] = (A[i] + B[i] + C[i] + D[i] + E[i] / 5.of;
}
__global__ void bar(flout out[], float in[])
{
    int i = threadIdx.x;
    out[i] = (in[i-2] + in[i-1] + in[i] + in[i+1] + in[i+2] / 5.of;
}

QUESTION: Explain your answer to the above question.

Put your answer to the above question here.


2. Transpose Example

Consider the following inefficient CUDA transpose code.

DO THIS: Copy the code to the HPC, debug any errors and get it to run.

QUESTION: What is the "speedup" of running the GPU vs CPU. Calculate the speedup using the following equation:

$$speedup = \frac{time_{host}}{time_{device}}$$

Put your answer to the above question here

The following video describes how you might improve the performace of the matrix transpose using tiling.

QUESTION: How could you modify the transpose code to take advantage of tiling?

Put your answer to the above question here.


3. Assignment wrap up

Please fill out the form that appears when you run the code below. You must completely fill this out in order to receive credits for the assignment!

Direct Link to Google Form

If you have trouble with the embedded form, please make sure you log on with your MSU google account at googleapps.msu.edu and then click on the direct link above.

Assignment-Specific QUESTION: Where you able to get the transpose example working, If not, where did you get stuck?

Put your answer to the above question here

QUESTION: Summarize what you did in this assignment.

Put your answer to the above question here

QUESTION: What questions do you have, if any, about any of the topics discussed in this assignment after working through the jupyter notebook?

Put your answer to the above question here

QUESTION: How well do you feel this assignment helped you to achieve a better understanding of the above mentioned topic(s)?

Put your answer to the above question here

QUESTION: What was the most challenging part of this assignment for you?

Put your answer to the above question here

QUESTION: What was the least challenging part of this assignment for you?

Put your answer to the above question here

QUESTION: What kind of additional questions or support, if any, do you feel you need to have a better understanding of the content in this assignment?

Put your answer to the above question here

QUESTION: Do you have any further questions or comments about this material, or anything else that's going on in class?

Put your answer to the above question here

QUESTION: Approximately how long did this pre-class assignment take?

Put your answer to the above question here


Congratulations, we're done!

To get credit for this assignment you must fill out and submit the above survey from on or before the assignment due date.

Course Resources:

Written by Dr. Dirk Colbry, Michigan State University Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.