-
Notifications
You must be signed in to change notification settings - Fork 5.9k
[CI-Precision] Optimize precision test logic #49441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CI-Precision] Optimize precision test logic #49441
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
| ): | ||
| os.system('echo %s >> %s' % (message, fn_filename)) | ||
| f.close() | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这段代码的优化思路是这样的吗?
首先把TN所在的空白行删掉,然后只遍历覆盖率文件中FNH不为0(函数总数被执行个数不为0的那一块代码),在原来的基础上删掉了对很多FNDA为0的无效遍历,从而减少了不必要的遍历,缩短了时间,达到pr所提到的优化效果?
| read testcase <<< $(echo "$line"|grep -oEi "\w+$") | ||
|
|
||
| if [["$testcase" == "simple_test"]]; then | ||
| continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if [["$testcase" == "simple_test"]] 需要改成if [[ "$testcase" == "simple_test" ]]这样把,不然会报错
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, tks!
risemeup1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM for optimizing precision test logic
PR types
Performance optimization
PR changes
Others
Describe
优化1:
依据gcov覆盖率分析工具,提升C++单测精准测试命中率。优化方式如下:

利用gcov覆盖率分析工具分析发现:一个不调用任何Paddle组件的C++单测统计出来的覆盖率分析结果表明其执行了很多Paddle文件。例如如下这个简单的C++单测:
#include "gtest/gtest.h" TEST(interface_test, type) { int a = 0; }覆盖率统计结果如下:
基于该现象,我们对精准测试流水线做如下优化:
经过测试,以variant_test为例,经过上述优化后,筛选到的与该单测相关的cc文件从767减少为0
优化2:
优化精准测试流水线
getFNDAFile函数,加速覆盖率文件解析速度。以一个简单的 C++ 单测 variant_test 的 gcov 覆盖率文件为例,对比优化前后解析耗时: