Open hughkf opened 8 years ago
The question asks
which of the following are correct parallelizations using OpenMP? (Select all that apply.)
I would argue that the code
void vec_add(double* out, double* v, double* w, int N)
{
#pragma omp parallel
{
for (int i=0; i<N; ++i)
out[i] = v[i] + w[i];
}
}
is an incorrect parallelization because, although the code is run in parallel and uses the #pragma omp parallel
directive in the correct way, the problem itself is not solved in parallel.
As indicated in the posted solution to question #5 in quiz #5, option #3 is wrong because it is inefficient, but otherwise gives the correct result. In that case, shouldn't the question have been "which of the following are correct and efficient parallelizations using OpenMP"?