Rewrite the code for psum1 (Figure 5.1) so that it does not need to repeatedly retrieve the
Question:
Rewrite the code for psum1 (Figure 5.1) so that it does not need to repeatedly retrieve the value of p[i] from memory. You do not need to use loop unrolling. We measured the resulting code to have a CPE of 3.00, limited by the latency of floating-point addition.
Figure 5.1
Transcribed Image Text:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* Compute prefix sum of vector a */
void psum1 (float all, float p[], long n)
{
}
long i;
p[0] = a[0];
for (i=1;i
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* Compute prefix sum of vector a */
void psum1 (float all, float p[], long n)
{
}
long i;
p[0] = a[0];
for (i=1;i
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 66% (9 reviews)
Here is a revised version of the function We introduce ...View the full answer
Answered By
Susan Juma
I'm available and reachable 24/7. I have high experience in helping students with their assignments, proposals, and dissertations. Most importantly, I'm a professional accountant and I can handle all kinds of accounting and finance problems.
4.40+
15+ Reviews
45+ Question Solved
Related Book For
Computer Systems A Programmers Perspective
ISBN: 9781292101767
3rd Global Edition
Authors: Randal E. Bryant, David R. O'Hallaron
Question Posted:
Students also viewed these Computer science questions
-
List three specific parts of the Case Guide, Objectives and Strategy Section (See below) that you had the most difficulty understanding. Describe your current understanding of these parts. Provide...
-
In this week's lesson, we are focusing on peacekeeping. This assignment is 1 of the 5 that you will be asked to do during the course. Bear in mind that you only need to complete 3 of these...
-
Write a for loop that produces the following output: 1 4 9 16 25 36 49 64 81 100 For added challenge, try to modify your code so that it does not need to use the * multiplication operator.
-
Use Figure 17.2 to explain why cost minimization through a tangency between an isoquant and a budget line does not apply in cases where D and M are either perfect complements or perfect substitutes....
-
How does the Bankruptcy Abuse Prevention and Consumer Protection Act of 2005 differ from the Bankruptcy Reform Act of 1978? In what ways do you feel that it represents an improvement? In what ways...
-
The transactions completed by By Tomorrow Express Company during May 2012, the first month of the fiscal year, were as follows: May 1. Issued Check No. 205 for May rent, $1,500. 2. Purchased a...
-
Refer to Polaris financial statements in Appendix A to answer the following. 1. Identify and write down the revenue recognition principle as explained in the chapter. 2. Review Polaris footnotes to...
-
The Toyota Camry is one of the best-selling cars in North America. The cost of a previously owned Camry depends upon many factors, including the model year, mileage, and condition. To investigate the...
-
I have no idea about how to write a balance sheet at all. thank you! Take the following information on a company, and say what assets the company has and where the money came from to own those assets...
-
In the following, let r be the number of rows in a DRAM array, c the number of columns, b r the number of bits needed to address the rows, and b c the number of bits needed to address the columns....
-
We saw that our measurements of the prefix-sum function psum1 (Figure 5.1) yield a CPE of 9.00 on a machine where the basic operation to be performed, floating point addition, has a latency of just 3...
-
In Application 12.1, you learned that, in a second-price auction, bidding your true valuation weakly dominates all other strategies. You also learned that the same principle applies to proxy bidding...
-
Brice Looney owns a small retail ice cream parlor. He is considering expanding the business and has identified two attractive alternatives. One involves purchasing a machine that would enable Mr....
-
A positively charged particle initially at rest on the ground moves \(4.0 \mathrm{~m}\) upward in \(2.00 \mathrm{~s}\). If the particle has a chargeto-mass ratio of \(10 \mu \mathrm{C} / \mathrm{g}\)...
-
Central States Telecom provides communication services in Iowa, Nebraska, the Dakotas, and Montana. Central States purchased goodwill as part of the acquisition of Sheldon Wireless Company, which had...
-
Shown below is selected information from the financial records of Merris Corporation as of December 31: Required a. Determine which of the above items will appear on the statement of cash flows and...
-
Pippa runs a photographic studio specializing in black and white portrait photography. Clients book a one hour studio session and are entitled to receive two large photographs of their choice from...
-
Air undergoes a process from state 1 at 220 K and 200 kPa to state 2 at 300 K and 10 MPa. Estimate the change in enthalpy and entropy: i) Assuming the air is an ideal-gas with constant specific heats...
-
Respond to the ethical judgments required based on the following scenarios. Scenario 1. Assume you have collected a sample using MUS and that you have evaluated that sample to calculate a total...
-
Modify the advance method of the FibonacciProgression class so as to avoid use of any temporary variable.
-
Explain why the Java dynamic dispatch algorithm, which looks for the method to invoke for a call obj.foo( ), will never get into an infinite loop.
-
Write a program that consists of three classes, A, B, and C, such that B extends A and that C extends B. Each class should define an instance variable named x (that is, each has its own variable...
-
Task 3 Discuss various policy measures taken by the Central Bank of Oman to support the Banks/Financial and Leasing Institutes in the current scenario of prevailing economic conditions. Analyze the...
-
Adamo filed his 2017 tax return on March 15, 2018. Adamo accidentally omitted $10,000 of income from his individual tax return. The total gross income shown on the tax return was $35,000. When will...
-
The total charges to operations over the lease term are: 1.not comparable between a finance lease and an operating lease. 2. greater for a finance lease than an operating lease. 3.less for a finance...
Study smarter with the SolutionInn App