Question: In this part, you will be summing all elements of two arrays in parallel. 1. Write your code using the following template and do
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]);
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
