Aakash Anuj
Aakash Anuj

Reputation: 3871

Pragma omp parallel sections

Can I use pragma omp parallel sections to solve two concurrent parts of my code which are calling the same function by its address??

In this case, is it the case that the function being called has common variables for both the thread and hence the speedup is not happening?

Upvotes: 0

Views: 522

Answers (1)

Konrad Rudolph
Konrad Rudolph

Reputation: 546153

Can I …?

Yes.

In this case, is it the case that the function being called has common variables for both the thread and hence the speedup is not happening?

Hmm? Local variables in that function are local to the thread. Whether you call it via its address or directly is irrelevant. You get problems only if the function modifies global state.

Upvotes: 1

Related Questions