OpenMP flush vs flush(list)

允我心安 提交于 2020-01-15 05:00:05

问题


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 ?


回答1:


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.



来源:https://stackoverflow.com/questions/14859219/openmp-flush-vs-flushlist

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!