Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quiz #5 question #5 #35

Open
hughkf opened this issue May 8, 2016 · 1 comment
Open

quiz #5 question #5 #35

hughkf opened this issue May 8, 2016 · 1 comment
Labels

Comments

@hughkf
Copy link

hughkf commented May 8, 2016

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"?

@cswiercz
Copy link
Member

cswiercz commented May 9, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants