Upload a pdf file containing your solutions to the problems below to Learning Suite before 11:00pm on the assigned date.
void dotproduct1(vec_ptr u, vec_ptr v, data_t *dest)
{
long int i;
*dest = 1.0;
for (i = 0; i < vec_length(u); i++)
{
data_t val1;
data_t val2;
get_vec_element(u, i, &val1);
get_vec_element(v, i, &val2);
*dest = *dest + val1 * val2;
}
}
Start with with this tar file
that includes dotproduct1() and a version of the getcpe timing code
used in the previous homework set. Compiling and running the initial
getcpe program should give you the CPE for the original code.
Consistent with the treatment in the text, you should create a
different version of the function for each of the six required
optimizations listed below. Follow the naming conventions of the
test -- dotproduct5() should be the version with 2x loop
unrolling. For this assignment, you need only consider the cose
where data_t is a double.
Problem 424-4: You may or may not see performance boosts at every step. Make a few runs for each data-point and discuss your results in your submission. Once you have the file dotprod.tar, place it in your directory of choice. From within that directory, typing "tar xvf *" will create a new "dotprod" subdirectory with all the files required to build the getcpe executable. Typing "make" within that subdirectory should produce an executable named getcpe. It should compile correctly under Linux or Mac OS X. The initial version will measure the performance of the dotproduct1(). As you add each new version of the function to getcpe.c, you'll need to change the measurement code (in measure() in getcpe.c) so that the new version of your function is called.
Problem 424-5: Copy the tar file to your working directory, and type "tar xvf *" to create a "brnchpen" subdirectory, and type "make" to produce a "brnchpen" executable. It should compile correctly under Linux or on a Mac. You are strongly encouraged to try this measurement on systems with different processors -- you might be surprised how different the results can be.