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

Fix c++17 bug #54228

Merged
merged 27 commits into from
Jun 13, 2023
Merged

Fix c++17 bug #54228

merged 27 commits into from
Jun 13, 2023

Conversation

risemeup1
Copy link
Contributor

@risemeup1 risemeup1 commented May 31, 2023

PR types

Others

PR changes

Others

Description

Pcard-67010
修复升级cmake标准之后和c++标准后暴露的错误,均是cmake依赖的问题

FAILED: paddle/fluid/distributed/fleet_executor/test/compute_interceptor_run_op_test
...
/usr/local/bin/ld: paddle/fluid/distributed/fleet_executor/libfleet_executor.a(dist_model.cc.o): in function `paddle::distributed::DistModel::CommInit()':
dist_model.cc:(.text+0x717f): undefined reference to `paddle::framework::NaiveExecutor::CreateVariables(paddle::framework::ProgramDesc const&, int, bool, paddle::framework::Scope*)'
/usr/local/bin/ld: dist_model.cc:(.text+0x719a): undefined reference to `paddle::framework::NaiveExecutor::Prepare(paddle::framework::Scope*, paddle::framework::ProgramDesc const&, int, bool)'
...

主要原因:fleet_executor 没有添加 naive_executor 的依赖,但添加依赖后会在 cmake 阶段检测出循环依赖,分析后如下图:

image

上面只是 cmake 里添加了依赖,可能代码并没有真正依赖,通过分析,executor 代码里并没有依赖 fleet_executor,真正依赖了 fleet_executor 代码的只有 analysis_predictor,而 analysis_predictor 是间接通过 executor 依赖 fleet_executor,所以只需要稍微调整一下 cmake 应该就可以了

这里其实不够完善,因为感觉 tensorrt_engine_op_test 并没有依赖 fleet_executor,但是不加这个会在第三方库 brpc 的代码报另一个第三方库 leveldb 用法的 undefined reference,而且这个错误在本地能够复现:

../../../../third_party/install/brpc/lib/libbrpc.a(span.cpp.o): In function `brpc::SpanDB::Open()':
/paddle/build/third_party/brpc/src/extern_brpc/src/brpc/span.cpp:472: undefined reference to `leveldb::Options::Options()'
/paddle/build/third_party/brpc/src/extern_brpc/src/brpc/span.cpp:488: undefined reference to `leveldb::DB::Open(leveldb::Options const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, leveldb::DB**)'
...
collect2: error: ld returned 1 exit status
paddle/fluid/operators/tensorrt/CMakeFiles/test_tensorrt_engine_op.dir/build.make:647: recipe for target 'paddle/fluid/operators/tensorrt/test_tensorrt_engine_op' failed

我试过加上个第三方库的依赖,但是没用,最后试着加上依赖 fleet_executor 就没问题了(fleet_executor 依赖了这两个第三方库)

@paddle-bot
Copy link

paddle-bot bot commented May 31, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot
Copy link

paddle-bot bot commented May 31, 2023

❌ The PR is not created using PR's template. You can refer to this Demo.
Please use PR's template, it helps save our maintainers' time so that more developers get helped.

@risemeup1 risemeup1 force-pushed the fix_c++17_bug branch 3 times, most recently from 3f11741 to e7dc018 Compare June 3, 2023 14:05
@risemeup1 risemeup1 merged commit 1b5e1e8 into PaddlePaddle:develop Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants