在 OpenMP 中,我可以刷新一组指定的变量或整个缓存。
有人知道这个操作的性能吗?仅刷新真正已更改的变量是否有意义,或者“刷新全部”如此之快,我不应该担心?
我有一些链接列表,需要时不时地刷新我的线程。我应该迭代列表并单独刷新每个元素,还是简单地刷新所有内容?
最佳答案
鉴于 OpenMP 3.1 标准中的建议:
Use of a flush construct with a list is extremely error prone and users are strongly discouraged from attempting it.
以及以下句子:
An implementation may implement a flush with a list by ignoring the list, and treating it the same as a flush without a list.
我将首先使用 pragma omplush
实现一个解决方案(没有任何列表)。
然后,在尝试优化此实现之前,我真的会仔细考虑,添加一个列表来刷新构造,因为代码不会具有性能可移植性。
关于c++ - OpenMP 刷新与刷新(列表),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14859219/