Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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.

Step by Step Solution

3.47 Rating (160 Votes )

There are 3 Steps involved in it

Step: 1

include include include include define LENGTH 500 define K 10000 void printfirsttendouble A int i fo... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Document Format ( 2 attachments)

PDF file Icon
6095afb4c1198_26136.pdf

180 KBs PDF File

Word file Icon
6095afb4c1198_26136.docx

120 KBs Word File

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamental Accounting Principles

Authors: John J. Wild, Ken W. Shaw, Barbara Chiappetta

20th Edition

1259157148, 78110874, 9780077616212, 978-1259157141, 77616219, 978-0078110870

More Books

Students also viewed these Programming questions

Question

compute the summation and producta 25. k=22(1k1)

Answered: 1 week ago