2

In OpenMP I can flush either a specified set of variables or the whole cache.

Does anybody have an idea of the performance of this operation? Does it make sense to flush only the variables that really have changed or is the "flush all" so fast, that I should not worry?

I have linked lists that I need to flush in my threads from time to time. Should I iterate through the list and flush each element individually, or simply flush everything ?

Massimiliano
  • 7,842
  • 2
  • 47
  • 62
Wolfgang
  • 1,408
  • 2
  • 15
  • 20

1 Answers1

3

Given the advice in the OpenMP 3.1 standard:

Use of a flush construct with a list is extremely error prone and users are strongly discouraged from attempting it.

and the following sentence:

An implementation may implement a flush with a list by ignoring the list, and treating it the same as a flush without a list.

I would implement first a solution with pragma omp flush (without any list).

Then, I would really think carefully before trying to optimize this implementation adding a list to flush constructs, as the code won't be performance portable.

Massimiliano
  • 7,842
  • 2
  • 47
  • 62