In this part, you will be summing all elements of two arrays in parallel. 1. Write...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
In this part, you will be summing all elements of two arrays in parallel. 1. Write your code using the following template and do necessary modifications, explaining them. #include #include #define N 10000000 int main (void) { float a [N], b[N], c[N]; int i; /* Initialize arrays a and b */ for (i = 0; i < N; i++) { i * 2.0; a[i] b[i] } i * 3.0; = /* Compute values of array c = a+b in parallel. */ #pragma omp parallel shared (a, b, c) private (i) #pragma omp for for (i 0; i < N; i++) { a[i] + b[i]; c[i] printf ("%f ", c[10]); In this part, you will be summing all elements of two arrays in parallel. 1. Write your code using the following template and do necessary modifications, explaining them. #include #include #define N 10000000 int main (void) { float a [N], b[N], c[N]; int i; /* Initialize arrays a and b */ for (i = 0; i < N; i++) { i * 2.0; a[i] b[i] } i * 3.0; = /* Compute values of array c = a+b in parallel. */ #pragma omp parallel shared (a, b, c) private (i) #pragma omp for for (i 0; i < N; i++) { a[i] + b[i]; c[i] printf ("%f ", c[10]);
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
Match each inequality with the appropriate calculator graph in AD. Do not use a calculator. y 3x - 6 B. SORTAL PLOAT sUTR E AIA A. iPLOAT TR IEHE FADIAH 10 10 F10 10 --10 10 - 10 D. ORAL PLOAT UTR...
-
Match each inequality with the appropriate calculator graph in AD. Do not use a calculator. y 3x - 6 B. SORTAL PLOAT sUTR E AIA A. iPLOAT TR IEHE FADIAH 10 10 F10 10 --10 10 - 10 D. ORAL PLOAT UTR...
-
Match the inequality with the appropriate calculator graph in AD. Do not use a calculator. y -3x - 6 B. SORTAL PLOAT sUTR E AIA A. iPLOAT TR IEHE FADIAH 10 10 F10 10 --10 10 - 10 D. ORAL PLOAT UTR...
-
You are given the equation(s) used to solve a problem. For each of these, you are to a. Write a realistic problem for which this is the correct equation(s). b. Finish the solution of the problem.
-
A project exploring the bottled-water phenomenon and preference of water types was conducted by researchers M. Lunsford and A. Fink in the article "Water Taste Test Data" (Journal of Statistics...
-
An unknown mass is hung from an ideal spring with an unknown spring constant and the spring stretches by 2 5 cm . The same mass is attached to the same spring and raised until the spring is not...
-
The temperature in a surface condenser is \(40^{\circ} \mathrm{C}\) and the vacuum is \(69 \mathrm{~cm}\) of \(\mathrm{Hg}\) while the barometer reads \(75 \mathrm{~cm}\) of \(\mathrm{Hg}\)....
-
Variance analysis, multiple products Soda-King manufactures and sells three soft drinks: Kola Limor, and Orlem. Budgeted and actual results for 2009 are as follows: 1. Compute the total sales-volume...
-
Two Riders players tackle the Argos quarterback in a football game. The first Riders player applies a force of 600 N [W] to the Argo player while the other Rider tackler impacts him with 750 N [S 15...
-
Petro Refinery LLC is a Kazakhstan-based oil refinery. Its main focus is on providing refined petroleum products to markets in China, the United States, and several European Union countries. The...
-
You are a small developer and have a construction deal that has been approved. Youre now looking for a lender and an equity partner. Its a $100M all-in cost to purchase and build the project. Youll...
-
The demand for a product varies from 150,000 units at \(\$ 110\) per unit to 300,000 at \(\$ 20\) per unit. Also, 300,000 could be supplied at \(\$ 90\) per unit, whereas only 200,000 could be...
-
Describe the addition method for solving a system of equations.
-
What is an objective function? What do we mean by constraints?
-
Suppose you want to invest \(\$ 30,000\). Part of this investment will be in a guaranteed rate \(5 \%\) annuity, and the remainder will be invested in a "friend's" business and she will pay you "a...
-
What is the inverse of a matrix?
-
Eric and Tamara are married and live in Geneva, Switzerland. Eric is a U.S. citizen and has a valid Social Security number. Tamara is a citizen of Switzerland and has an ITIN for U.S. filing...
-
Create a data model for one of the processes in the end-of-chapter Exercises for Chapter 4. Explain how you would balance the data model and process model.
-
Compute the derivative of g. (u) = sin u, g(x) = 2x + 1
-
This exercise is intended to reinforce the proof of Taylors Theorem. (a) Show that f(x) = To(x) + + -S* f'(u)du. (b) Use Integration by Parts to prove the formula ~x (x-u)f()(u) du = -f'(a)(x-a) + +...
-
What are i j and i k?
-
While the BohrSommerfeld condition sometimes gets the energy eigenvalues exactly correct, it can also be used for systems where the exact solution is not known. In this example, we will estimate the...
-
It's useful to see how our quantum perturbation theory works in a case that we can solve exactly. Let's consider a two-state system in which the Hamiltonian is...
-
Let's see how the variational method works in another application. Let's assume we didn't know the ground-state energy of the quantum harmonic oscillator and use the variational method to determine...
Study smarter with the SolutionInn App