Question: write a program that uses threads to calculate the dot product of two vectors. Do not change the code in dotpr-hw.txt but only add statements.
write a program that uses threads to calculate the dot product of two vectors. Do not change the code in dotpr-hw.txt but only add statements. Some of the places where new code must be added are shown by /* ... */.
#include#define NUMTHRDS 4 #define VECLEN 100000 pthread_t callThd[NUMTHRDS]; double *array_a; double *array_b; double big_sum; int veclen; void *dotprod(void *arg) { /* ... */ x = array_a; y = array_b; /* ... */ mysum = 0; for (i=start; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
