Skip to content
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

[cmake治理]删除paddle_test多余无用依赖 #60013

Closed
risemeup1 opened this issue Dec 14, 2023 · 16 comments
Closed

[cmake治理]删除paddle_test多余无用依赖 #60013

risemeup1 opened this issue Dec 14, 2023 · 16 comments
Assignees
Labels
HappyOpenSource 快乐开源活动issue与PR status/close 已关闭

Comments

@risemeup1
Copy link
Contributor

risemeup1 commented Dec 14, 2023

问题描述 Please describe your issue

一、需求背景

飞桨正在优化cmake代码,来减少编译时候的开发成本,目前paddle编译c++单测有多种方式,如cc_test_old(link静态库),cc_test(windows下link静态库,linux下link paddle.so),paddle_test(windows和linux下都link动态库paddle.so),现在推荐使用paddle_test,好处在于:

  1. link动态库无需手动加过多的依赖,大部分符号在paddle.so中已存在;
  2. link libpaddle.so可以大幅度减小C++单测的体积 ,从而减少build目录体积大小

二、存在的问题

paddle仓库中大概有50个使用paddle_test的代码,有一部分后面加了额外不需要的依赖,需要删除,如test/cpp/pir/shape_dialect/CMakeLists.txt中shape_struct_test单测依赖了gtest,实际上是额外的依赖,应该删掉。

三、建议步骤

1 在linux下,将paddle_test DEPS依赖全部删掉编译,如果遇到找不到一些符号,再加上必要的依赖
2 linux下报错解决后,windows下可能也会遇到一些编译问题

四、任务划分

序号 目录 认领人/状态/PR号
1 paddle/fluid/inference/utils/CMakeLists.txt @Liyulingyue
2 test/cpp/auto_parallel/CMakeLists.txt @zade23 #60274 #60348
3 test/cpp/eager/performance_tests/CMakeLists.txt @BeingGod
4 test/cpp/fluid/CMakeLists.txt @DrRyanHuang #60160
5 test/cpp/fluid/cinn/CMakeLists.txt @ccsuzzh #60235
6 test/cpp/fluid/framework/CMakeLists.txt @RedContritio
7 test/cpp/fluid/framework/details/CMakeLists.txt @RedContritio
8 test/cpp/fluid/lite/CMakeLists.txt @ccsuzzh
9 test/cpp/fluid/pscore/CMakeLists.txt @xiaoyewww #60240
10 test/cpp/pir/cinn/CMakeLists.txt @zrr1999 #60239
11 test/cpp/pir/cinn/adt/CMakeLists.txt @zrr1999
@Liyulingyue #60154
12 test/cpp/pir/core/CMakeLists.txt @DrRyanHuang #60161
13 test/cpp/pir/shape_dialect/CMakeLists.txt @sanbuphy
@Liyulingyue #60517
14 test/cpp/pir/sub_graph/CMakeLists.txt @DrRyanHuang
@xiaoyewww #60087
15 test/cpp/prim/CMakeLists.txt @enkilee
@Liyulingyue #60149

认领方式

请大家以 comment 的形式认领任务,如:

【报名】:1、3、12-13

多个任务之间需要使用中文顿号分隔,报名多个连续任务可用横线表示,如 2-5
PR 提交格式:在 PR 的标题中以 【CMake opt】 开头,注明任务编号

看板信息

任务方向 任务数量 提交作品 / 任务认领 提交率 完成 完成率
快乐开源 15 10 / 15 66.67% 10 66.67%

统计信息

排名不分先后 @zade23 (1) @DrRyanHuang (2) @ccsuzzh (1) @xiaoyewww (2) @zrr1999 (1) @Liyulingyue (3)

@luotao1 luotao1 assigned luotao1 and risemeup1 and unassigned JZ-LIANG Dec 14, 2023
@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label Dec 14, 2023
@luotao1 luotao1 moved this to In Progress in Call for Contributions Dec 14, 2023
@Liyulingyue
Copy link
Contributor

【报名】:1

@DrRyanHuang
Copy link
Member

DrRyanHuang commented Dec 14, 2023

【报名】:4、12、14

@zrr1999
Copy link
Member

zrr1999 commented Dec 14, 2023

【报名】:10、11

@RedContritio
Copy link
Contributor

RedContritio commented Dec 14, 2023

【报名】:6、7

@zade23
Copy link
Contributor

zade23 commented Dec 14, 2023

【报名】:2

@enkilee
Copy link
Contributor

enkilee commented Dec 14, 2023

【报名】:15

@BeingGod
Copy link
Contributor

【报名】:3

@sanbuphy
Copy link
Contributor

【报名】:13

@ccsuzzh
Copy link
Contributor

ccsuzzh commented Dec 14, 2023

【报名】:5、8

@xiaoyewww
Copy link
Contributor

xiaoyewww commented Dec 15, 2023

【报名】:9、14

@Liyulingyue
Copy link
Contributor

Task No. 1 Finished. Nothing needs to delete.

The error log when delete the only DEPS, benchmark:

[ 85%] Built target test_mkldnn_cpu_quantize_pass
/usr/local/bin/ld: CMakeFiles/test_benchmark.dir/benchmark_tester.cc.o: in function `Benchmark_basic_Test::TestBody()':
benchmark_tester.cc:(.text._ZN20Benchmark_basic_Test8TestBodyEv+0xc8): undefined reference to `paddle::inference::Benchmark::SerializeToString[abi:cxx11]() const'
/usr/local/bin/ld: CMakeFiles/test_benchmark.dir/benchmark_tester.cc.o: in function `Benchmark_PersistToFile_Test::TestBody()':
benchmark_tester.cc:(.text._ZN28Benchmark_PersistToFile_Test8TestBodyEv+0xae): undefined reference to `paddle::inference::Benchmark::PersistToFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/usr/local/bin/ld: benchmark_tester.cc:(.text._ZN28Benchmark_PersistToFile_Test8TestBodyEv+0xea): undefined reference to `paddle::inference::Benchmark::PersistToFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/usr/local/bin/ld: benchmark_tester.cc:(.text._ZN28Benchmark_PersistToFile_Test8TestBodyEv+0x126): undefined reference to `paddle::inference::Benchmark::PersistToFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
collect2: error: ld returned 1 exit status
paddle/fluid/inference/utils/CMakeFiles/test_benchmark.dir/build.make:113: recipe for target 'paddle/fluid/inference/utils/test_benchmark' failed
make[2]: *** [paddle/fluid/inference/utils/test_benchmark] Error 1
CMakeFiles/Makefile2:95109: recipe for target 'paddle/fluid/inference/utils/CMakeFiles/test_benchmark.dir/all' failed
make[1]: *** [paddle/fluid/inference/utils/CMakeFiles/test_benchmark.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

@risemeup1
Copy link
Contributor Author

Task No. 1 Finished. Nothing needs to delete.

The error log when delete the only DEPS, benchmark:

[ 85%] Built target test_mkldnn_cpu_quantize_pass
/usr/local/bin/ld: CMakeFiles/test_benchmark.dir/benchmark_tester.cc.o: in function `Benchmark_basic_Test::TestBody()':
benchmark_tester.cc:(.text._ZN20Benchmark_basic_Test8TestBodyEv+0xc8): undefined reference to `paddle::inference::Benchmark::SerializeToString[abi:cxx11]() const'
/usr/local/bin/ld: CMakeFiles/test_benchmark.dir/benchmark_tester.cc.o: in function `Benchmark_PersistToFile_Test::TestBody()':
benchmark_tester.cc:(.text._ZN28Benchmark_PersistToFile_Test8TestBodyEv+0xae): undefined reference to `paddle::inference::Benchmark::PersistToFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/usr/local/bin/ld: benchmark_tester.cc:(.text._ZN28Benchmark_PersistToFile_Test8TestBodyEv+0xea): undefined reference to `paddle::inference::Benchmark::PersistToFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/usr/local/bin/ld: benchmark_tester.cc:(.text._ZN28Benchmark_PersistToFile_Test8TestBodyEv+0x126): undefined reference to `paddle::inference::Benchmark::PersistToFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
collect2: error: ld returned 1 exit status
paddle/fluid/inference/utils/CMakeFiles/test_benchmark.dir/build.make:113: recipe for target 'paddle/fluid/inference/utils/test_benchmark' failed
make[2]: *** [paddle/fluid/inference/utils/test_benchmark] Error 1
CMakeFiles/Makefile2:95109: recipe for target 'paddle/fluid/inference/utils/CMakeFiles/test_benchmark.dir/all' failed
make[1]: *** [paddle/fluid/inference/utils/CMakeFiles/test_benchmark.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

好的,那就不删除

@BeingGod
Copy link
Contributor

BeingGod commented Dec 21, 2023

Task NO.3 的common已经在 #60149 删除。

@ccsuzzh
Copy link
Contributor

ccsuzzh commented Dec 21, 2023

Task NO.8 的common已经在 #60149 删除。

@RedContritio
Copy link
Contributor

Task 6 已在 #60149 解决
Task 7 已在 #59995 解决

@luotao1
Copy link
Contributor

luotao1 commented Jan 3, 2024

[cmake治理]删除paddle_test多余无用依赖 已全部完成,感谢参与的小伙伴们!

@zade23 (1) @DrRyanHuang (2) @ccsuzzh (1) @xiaoyewww (2) @zrr1999 (1) @Liyulingyue (3) @BeingGod @RedContritio

欢迎继续参与快乐开源的其他任务

@luotao1 luotao1 closed this as completed Jan 3, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in Call for Contributions Jan 3, 2024
@paddle-bot paddle-bot bot added the status/close 已关闭 label Jan 3, 2024
luotao1 added a commit to PFCCLab/PaddleAutoProject that referenced this issue Jan 3, 2024
luotao1 added a commit to PFCCLab/PaddleAutoProject that referenced this issue Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
HappyOpenSource 快乐开源活动issue与PR status/close 已关闭
Projects
Development

No branches or pull requests