perf report shows most cycles spent in blas_thread_server
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 28/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 领域
- backend, performance
调研方向
首先使用 Linux perf record 和 perf report 重现缓慢的导入过程,并比较 numpy 和 pytorch 的导入。检查引用行附近的 driver/others/blas_server.c,并比较来自 liblapack.so.3 和 libcblas.so.3 的 blas_thread_server 样本。完成的标准是确定时间消耗在 OpenBLAS 中还是某个 consumer 中,并给出可复现的诊断。
由索引模型根据 Issue 内容生成。
描述
Not sure this is necessarily an issue with OpenBLAS vs users of OpenBLAS (numpy, pytorch).
I'm seeing slow python imports of pytorch; literally import pytorch is taking multiple seconds on my system.
When I record the python interpreter with linux perf record, perf report shows most cycles are spent in blas_thread_server via BOTH liblapack.so.3 and libcblas.so.3. i.e.
Overhead Command Shared Object Symbol
40.31% python liblapack.so.3 [.] blas_thread_server
36.85% python libcblas.so.3 [.] blas_thread_server
If I annotate either, it seems both are near reading the time stamp counter:
0.31 │3c:┌─→mov (%r15),%rax ▒
│ │ cmp $0x1,%rax ▒
│ │↓ ja b0 ▒
│ │ nop ▒
│ │ nop ▒
│ │ nop ▒
│ │ nop ▒
│ │ nop ▒
│ │ nop ▒
5.29 │ │ nop ▒
│ │ nop ▒
│ │ rdtsc ◆
91.82 │ │ sub %ecx,%eax ▒
│ │ cmp %eax,thread_timeout ▒
2.59 │ └──jae 3c
I'm guessing that's corresponding to code around here.
https://github.com/numpy/numpy/issues/24639 seems like someone else hit this, too, but...https://xkcd.com/979/.
How do I even go about debugging this further? Is it an issue in pytorch? numpy? openblas? PEBKAC?
Importing numpy alone doesn't seem problematic, though I suspect that it's part of the chain of dependencies here. Perhaps related to how pytorch is (mis)using numpy then???
- 主要语言
- C
- 星标
- 7.6k
- 派生
- 1.7k
- 平均合并
- 1 天 6 小时
- 30 天内合并 PR
- 46
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
OpenMathLib/OpenBLAS 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 68/100
OpenMathLib/OpenBLAS#6069 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 52/100
OpenMathLib/OpenBLAS#6059 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
OpenMathLib/OpenBLAS#6029 · 21 条评论 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 68/100
OpenMathLib/OpenBLAS#6028 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 35/100
OpenMathLib/OpenBLAS#6005 · 21 条评论 · 2 个 reaction ·
维护者通常 1 天内回复
查看 OpenMathLib/OpenBLAS 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 90/100
BasedHardware/omi#19711 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
microsoft/ebpf-for-windows#5604 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
trezor/trezor-firmware#7985 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 2 天内回复