To gain insight into how the software design can

To gain insight into how the software design can significantly impact execution time because of the superscalar design of the hardware functional units and extra time needed to access memory contents.

We have considered several implementations of functions in which the elements of an array are combined using either addition or multiplication, with both integer and floating point numbers. The specific functions which you will implement are combine3( ), combine5( ), and combine7( ) using double precision floating point numbers and the operation will be multiplication. The routines are shown in figures 5.9, 5.16, and 5.26 respectively. To eliminate the need for additional functions, tailor the routines to accept as parameters: the array address, the address of the destination, and the array length. Your implementation should correspond to the following prototypes:

/* ---- prototype definitions ------ */

void combine3(double * A, double * dest, int length);

void combine5(double * A, double * dest, int length);

void combine7(double * A, double * dest, int length);

As you will be multiplying a large number of values together, you may encounter problems with either overflow or underflow. To address that issue, you will want to keep your numbers in a range that is close to 1.0. You can use the following examples to define your array length and parameters for initializing the array elements.

#define LENGTH 5000

#define K 10000

double A[LENGTH]; // input matrix

for (i=0; i< LENGTH; i++) // initialize the array elements

A[i] = 0.90 + (double )(rand() % K) / 50000.;

With the three functions, vary the size of the arrays, execute each function, and measure the execution times of each. As you are executing in a multiprocessing environment, you will observe variations in the execution times, so you should conduct the experiment a few times with each array size to get average results. Generate a summary of the results and explain how the different implementations lead to different execution times.


Expert Answer



Get this answer with Solutioninn Study

Members

  • Access to 2 Million+ Textbook solutions
  • Ask any question from 24/7 available
    Tutors
$9.99
VIEW SOLUTION
OR

Non-Members

Get help from Programming Tutors
Ask questions directly from Qualified Online Programming Tutors .
Best for online homework instance.