Question: BELOW IS THE QUESTION AND TWO CODES THAT WERE PROVIDED TO HELP. PLEASE USE AS MUCH AS YOU CAN OF THE PROVIDED CODE. TRY TO

BELOW IS THE QUESTION AND TWO CODES THAT WERE PROVIDED TO HELP. PLEASE USE AS MUCH AS YOU CAN OF THE PROVIDED CODE. TRY TO KEEP THE CONCEPTS SIMPLE AND USE MULTIPLE THREADS IF NEEDED. MAYBE 5 OR 6.BELOW IS THE QUESTION AND TWO CODES THAT WERE PROVIDED TO HELP.

PLEASE USE AS MUCH AS YOU CAN OF THE PROVIDED CODE. TRY

TO KEEP THE CONCEPTS SIMPLE AND USE MULTIPLE THREADS IF NEEDED. MAYBE

2. Given the serial code that finds the dot product of two vectors, convert the code into a parallel program, create at least three threads and use them to find the dot product of the arrays given in the code. Submit your code. (20 points) // given the arrays int a[] = { 4, 3, 1, 6, 8, 9, 100, 23, 13, 14, 14, 67, 89, 34, 23, 69, 100, 65, 32, 33, 4 ,5 ,6 , 18 }; int b[] = { 1, 7, 8, 4, 9, 12, 10, 3, 1, 14, 7, 7, 9, 3, 3, 6, 11, 165, 2, 1, 14, 15, 8, 33 }; int result = 0; // adds every item of the array to the sum for (int i = 0; i #include using namespace std; // This program finds the sum of numbers from 0-100 with 11 variable p number of threads int global_sum = @; int N = 101; const int P = 5; void myThreadMethod( int id) { int local_sum = %; int mystart. - id * N/P int myend - (id + 1) * N/P for (int i = mystart; i join(); } cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!