HW6: GPU Programming In Practice

CS 641 Homework, Dr. Lawlor

Here's a sequential CPU program.  Make the main loop run on the graphics card.  This loop treats a and b as an array of polar coordinates 2D locations, where a stores the angle, and b stores the length, of a vector.  In the loop, we reconstruct cartesian x,y coordinates, then evaluate the function f(x,y)=x2+y at those coordinates:
	for (int i=0;i<n;i++) {
float x=cos(a[i])*b[i];
float y=sin(a[i])*b[i];
c[i]=x*x+y;
}
Use "n=4" to make sure you're getting the right answer on the GPU, and then switch to "n=4096" and benchmark and tune your code for high performance.

Turn in your new GPU code and a short README file describing your benchmark results on Blackboard by midnight Tuesday, April 21.