Question: Q3) You are given a data structure to store vectors as follows typedef int data t; typedef struct { long len; data t *data; vec_rec,

 Q3) You are given a data structure to store vectors as

Q3) You are given a data structure to store vectors as follows typedef int data t; typedef struct { long len; data t *data; vec_rec, *vec ptr; /*Return length of vector/ long vec_length(vec_ptr v) f return v->len; /*Return pointer to start of vector data*/ data t *get_vec_ start(vec_ptr v) return v->data; Following is a version of function that computes inner product of two vectors with equal length This function uses some techniques for optimization of code like eliminating loop inefficiencies (code motion), reducing procedure calls and eliminating unneeded memory references You are required to optimize it further using 6 x 6 loop unrolling technique. Our measurements for this function with x86-64 give a CPE (cycles per element) of 1.06 for integer data. Why is CPE fixed at 1.06? (30 points) /Inner Product. Unoptimized version*/ void inner_product(vec_ptr u, vec_ptr v, datat *dest) long i; long length - vec_length(u); data t *udata get_vec_start(u); data t *vdata-get vec start(v) data_t sum(data_t) 0 for(i-0;i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!