How to profile OpenMP bottlenecks(如何分析 OpenMP 瓶颈)
问题描述
我有一个由 OpenMP 并行化的循环,但由于任务的性质,有 4 个 critical
子句.
I have a loop that has been parallelized by OpenMP, but due to the nature of the task, there are 4 critical
clauses.
分析加速并找出哪个关键子句(或者可能是非关键子句(!))在循环中占用最多时间的最佳方法是什么?
What would be the best way to profile the speed up and find out which of the critical clauses (or maybe non-critical(!) ) take up the most time inside the loop?
我使用 Ubuntu 10.04 和 g++ 4.4.3
I use Ubuntu 10.04 with g++ 4.4.3
推荐答案
OpenMP 包括用于测量时序性能的函数 omp_get_wtime() 和 omp_get_wtick() (此处的文档),我建议使用这些.
OpenMP includes the functions omp_get_wtime() and omp_get_wtick() for measuring timing performance (docs here), I would recommend using these.
否则尝试分析器.我更喜欢可以在此处找到的 google CPU 分析器.
Otherwise try a profiler. I prefer the google CPU profiler which can be found here.
还有这个 答案.
这篇关于如何分析 OpenMP 瓶颈的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何分析 OpenMP 瓶颈


基础教程推荐
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- CString 到 char* 2021-01-01
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- 初始化列表*参数*评估顺序 2021-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16