HPC Project 9:
A CUDA Project
In this week's lab, we saw that the benefit of using CUDA
depends on the amount of computation performed on the GPU
compared to the time spent transferring the data.
We varied the amount of data transferred
and the expense of the operations being performed by the GPU.
In Part I, we transferred 3 vectors
and used an inexpensive computation (addition).
In Part II, we transferred 3 vectors
and used a slightly more expensive computation (multiplication).
In Part III, we transferred 2 vectors
and used a much more expensive computation (square root).
In Part IV, we transferred 2 vectors
and used the same computation as in Part II (multiplication).
The final part of this week's exercise is to
transfer 3 vectors (as in Parts I and II)
but use a more expensive computation
(the hypotenuse calculation).
Part V: Homework
Your task is to write vectorHypot.cu that
computes C[i] = sqrt( A[i]*A[i] + B[i]*B[i] )
for all the elements in arrays A, B, and C.
Your program should compute this sequentially
and using CUDA, time both computations,
and verify the correctness of the computations,
as we did in this week's lab.
As before, create a line chart that compares your
sequential and CUDA computations for arrays of size
50,000; 500,000; 5,000,000; and 50,000,000;
and a stacked bar chart showing the times spent in
the different portions of the CUDA computation.
This is a one week project.
Please staple or paperclip your pages together.
Your source code for vectorHypot.cu.
Your spreadsheets and charts from Parts I-V.
A 1 page writeup of your results in which you
analyze the results
and answer our questions from parts I-V.
When is it worthwhile to use CUDA for a computation?
Justify your answer using your charts and data.
This page maintained by