Reduce overhead of read_data and write_data
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 重构
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- numpy, python
- 领域
- api, performance
调研方向
从 Python 绑定入口 read_data 和 write_data 开始,使用链接的 Discourse 讨论串来了解报告的开销,以及有关 reshape、分配和错误检查的说明。将 Python 侧的计时结果与 preCICE 的计时结果进行比较,然后验证这些函数在避免不必要的复制和分配的同时仍保持其行为。
由索引模型根据 Issue 内容生成。
描述
In this discourse thread, I tracked down the increased duration spent in the "do-nothing solver" down to read_data and write_data.
Most logical explanation would be the additional
- input
vertex_idsandvaluesare copied to a vector, even though passingnp.reshape(X, -1)to the preCICE API suffices and prevents copies. - output values are allocated, then passed to the API, then allocated to build an
np.array - we do a lot of additional error checking (which is good)
Example of rhoVW on solver2, being vectorial data of large mesh:
- Time measured in preCICE: 7ms (note: this doesn't allocate)
- Time measured in Python: 40ms (including overhead from activating profiling in python, this needs to allocate, so overhead scales with size)
Notes:
- With some tweaking I can get this down to 30ms. This makes the function actually shorter, simpler, and easier to follow.
np.flatten()copies the input, whilenp.reshapedoesn't if it can avoid it.- The majority of the generated code seems to be error handling, which we could potentially be avoided by using the CPP API directly for calls to
getDataDimensionsand do this in one place. - This overhead could be profiled with something like https://github.com/precice/precice/issues/1647
- 主要语言
- Cython
- 星标
- 30
- 派生
- 19
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
precice/python-bindings 的其他 Issue
-
documentation
难度 2/5 1-3 小时 新手友好度 68/100
precice/python-bindings#258 · 1 个 reaction ·
-
enhancement
难度 2/5 1-3 小时 新手友好度 78/100
precice/python-bindings#175 · 2 条评论 ·
-
难度 5/5 一周以上 新手友好度 20/100
precice/python-bindings#255 ·
-
good first issue
难度 3/5 1-2 天 新手友好度 68/100
precice/python-bindings#248 ·
-
难度 3/5 1-2 天 新手友好度 38/100
precice/python-bindings#238 · 6 条评论 ·
查看 precice/python-bindings 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
mksglu/context-mode#1200 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 70/100
-
clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr impact:auth-provider issue-rating: 🌊 off-meta tidepool P2
难度 1/5 1 小时以内 新手友好度 80/100
-
难度 2/5 1-3 小时 新手友好度 75/100