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

Failed to build test_benchmark in Release/2.6 (8189a99) #60092

Closed
jeng1220 opened this issue Dec 17, 2023 · 7 comments
Closed

Failed to build test_benchmark in Release/2.6 (8189a99) #60092

jeng1220 opened this issue Dec 17, 2023 · 7 comments
Assignees
Labels
NVIDIA status/close 已关闭 type/build 编译/安装问题 预测 原名Inference,包含Capi预测问题等

Comments

@jeng1220
Copy link
Collaborator

问题描述 Issue Description

Build release/2.6 branch but triggers following error if -DWITH_TESTING=ON:

[44/320] Linking CXX executable paddle/fluid/inference/utils/test_benchmark
FAILED: paddle/fluid/inference/utils/test_benchmark
: && /usr/local/bin/ccache /usr/bin/c++ -march=sandybridge -mtune=broadwell -Wno-error=range-loop-construct -Wno-error=maybe-uninitialized -Wno-error=switch -faligned-new=32 -Wno-error=uninitialized -Wno-error=deprecated-declarations -Wno-deprecated-declarations -std=c++17 -m64 -fPIC -fno-omit-frame-pointer -pipe -ffunction-sections -fdata-sections -Werror -Wall -Wextra -Wno-unused-parameter -Wno-unused-function -Wno-error=array-bounds -Wno-error=ignored-attributes -Wno-error=int-in-bool-context -Wimplicit-fallthrough=0 -Wno-sign-compare -Wno-non-virtual-dtor -Wno-ignored-qualifiers -Wno-ignored-attributes -Wno-parentheses -msse3 -O3 -DNDEBUG  paddle/fluid/inference/utils/CMakeFiles/test_benchmark.dir/benchmark_tester.cc.o -o paddle/fluid/inference/utils/test_benchmark  -Wl,-rpath,/workspace/paddle/build/paddle/fluid/pybind:/workspace/paddle/build/paddle/phi:/workspace/paddle/build/paddle/common  third_party/install/glog/lib/libglog.a  paddle/fluid/pybind/libpaddle.so  paddle/fluid/inference/utils/libbenchmark.a  paddle/testing/libpaddle_gtest_main_new.a  paddle/phi/libphi.so  /usr/lib/x86_64-linux-gnu/libpython3.10.so  paddle/fluid/platform/libenforce.a  paddle/phi/libphi.so  paddle/common/libcommon.so  paddle/phi/api/profiler/libphi_profiler_proto.a  paddle/phi/core/distributed/auto_parallel/libauto_parallel_proto.a  paddle/utils/libpaddle_flags.a  libcblas.a  third_party/install/openblas/lib/libopenblas.a  third_party/install/utf8proc/lib/libutf8proc.a  third_party/install/gloo/lib/libgloo.a  third_party/install/dgc/lib/libdgc.a  paddle/phi/core/libexternal_error_proto.a  third_party/install/gtest/lib/libgtest.a  third_party/install/xxhash/lib/libxxhash.a  paddle/fluid/framework/libframework_proto.a  third_party/install/glog/lib/libglog.a  third_party/install/protobuf/lib/libprotobuf.a -pthread -ldl -lrt -lz -lssl -lcrypto -pthread -Wl,--no-as-needed -ldl -lrt -lz && :
/usr/bin/ld: paddle/testing/libpaddle_gtest_main_new.a(paddle_gtest_main.cc.o): in function `main':
paddle_gtest_main.cc:(.text.startup.main+0x31): undefined reference to `paddle::memory::allocation::UseAllocatorStrategyGFlag()'
/usr/bin/ld: paddle_gtest_main.cc:(.text.startup.main+0x5e1): undefined reference to `paddle_flags::FLAGS_enable_gpu_memory_usage_log'
/usr/bin/ld: paddle_gtest_main.cc:(.text.startup.main+0x623): undefined reference to `paddle::framework::InitMemoryMethod()'
/usr/bin/ld: paddle_gtest_main.cc:(.text.startup.main+0x628): undefined reference to `paddle::framework::InitDevices()'
/usr/bin/ld: paddle_gtest_main.cc:(.text.startup.main+0x62d): undefined reference to `paddle::framework::InitDefaultKernelSignatureMap()'

版本&环境信息 Version & Environment Information

CCACHE_DIR=/workspace/ccache_storage
ARCH_FLAGS="-march=sandybridge -mtune=broadwell"
CXX_FLAGS="$ARCH_FLAGS -Wno-error=range-loop-construct -Wno-error=maybe-uninitialized -Wno-error=switch -faligned-new=32"
CUDA_FLAGS="-t2 --forward-unknown-to-host-compiler -Xfatbin=-compress-all $ARCH_FLAGS -lineinfo"

SKIP_DOWNLOAD_INFERENCE_DATA=ON cmake -Bpaddle/build -Spaddle \
    -GNinja \
    -DINFERENCE_DEMO_INSTALL_DIR=/home/scratch.rjeng_sw/baidu/paddle/test_data \
    -DCMAKE_CXX_FLAGS="$CXX_FLAGS" \
    -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_CUDA_FLAGS="$CUDA_FLAGS" \
    -DCUDA_ARCH_NAME=Manual \
    -DCUDA_ARCH_BIN="80" \
    -DWITH_INCREMENTAL_COVERAGE=OFF \
    -DWITH_INFERENCE_API_TEST=OFF \
    -DWITH_DISTRIBUTE=ON \
    -DWITH_COVERAGE=OFF \
    -DWITH_TENSORRT=OFF \
    -DWITH_TESTING=ON \
    -DWITH_CONTRIB=ON \
    -DWITH_ROCM=OFF \
    -DWITH_RCCL=OFF \
    -DWITH_STRIP=ON \
    -DWITH_MKL=OFF \
    -DWITH_AVX=OFF \
    -DWITH_GPU=ON \
    -DWITH_PYTHON=ON \
    -DWITH_CUDNN_FRONTEND=ON \
    -DPY_VERSION=$PYVER \
    -Wno-dev

cmake --build paddle/build -j$((`nproc`))
  • GCC 11.4.0
@jeng1220
Copy link
Collaborator Author

cc @onecatcn for vis

@paddle-bot paddle-bot bot removed the status/new-issue 新建 label Dec 18, 2023
@winter-wang winter-wang added the 预测 原名Inference,包含Capi预测问题等 label Dec 18, 2023
@jeng1220
Copy link
Collaborator Author

@Wangzheee ,
This bug is as same as #60091.
Manually moving shared libraries behind static libraries can address the error.
Before:

/usr/bin/c++ \
-march=sandybridge -mtune=broadwell -Wno-error=range-loop-construct -Wno-error=maybe-uninitialized -Wno-error=switch -faligned-new=32 -Wno-error=uninitialized -Wno-error=deprecated-declarations -Wno-deprecated-declarations -std=c++17 -m64 -fPIC -fno-omit-frame-pointer -pipe -ffunction-sections -fdata-sections -Werror -Wall -Wextra -Wno-unused-parameter -Wno-unused-function -Wno-error=array-bounds -Wno-error=ignored-attributes -Wno-error=int-in-bool-context -Wimplicit-fallthrough=0 -Wno-sign-compare -Wno-non-virtual-dtor -Wno-ignored-qualifiers -Wno-ignored-attributes -Wno-parentheses -msse3 -O3 -DNDEBUG  \
paddle/fluid/inference/utils/CMakeFiles/test_benchmark.dir/benchmark_tester.cc.o \
-o paddle/fluid/inference/utils/test_benchmark  \
-Wl,-rpath,/home/scratch.rjeng_sw/baidu/paddle/paddle/build/paddle/fluid/pybind:/home/scratch.rjeng_sw/baidu/paddle/paddle/build/paddle/phi:/home/scratch.rjeng_sw/baidu/paddle/paddle/build/paddle/common  \
third_party/install/glog/lib/libglog.a  \
paddle/fluid/pybind/libpaddle.so  \
paddle/fluid/inference/utils/libbenchmark.a  \
paddle/testing/libpaddle_gtest_main_new.a  \
paddle/phi/libphi.so  \
/usr/lib/x86_64-linux-gnu/libpython3.10.so  \
paddle/fluid/platform/libenforce.a  \
paddle/phi/libphi.so  \
paddle/common/libcommon.so  \
paddle/phi/api/profiler/libphi_profiler_proto.a  \
paddle/phi/core/distributed/auto_parallel/libauto_parallel_proto.a  \
paddle/utils/libpaddle_flags.a  \
libcblas.a  \
third_party/install/openblas/lib/libopenblas.a  \
third_party/install/utf8proc/lib/libutf8proc.a  \
third_party/install/gloo/lib/libgloo.a  \
third_party/install/dgc/lib/libdgc.a  \
paddle/phi/core/libexternal_error_proto.a  \
third_party/install/gtest/lib/libgtest.a  \
third_party/install/xxhash/lib/libxxhash.a  \
paddle/fluid/framework/libframework_proto.a  \
third_party/install/glog/lib/libglog.a  \
third_party/install/protobuf/lib/libprotobuf.a \
-pthread -ldl -lrt -lz -lssl -lcrypto -pthread -Wl,--no-as-needed -ldl -lrt -lz

After:

/usr/bin/c++ \
-march=sandybridge -mtune=broadwell -Wno-error=range-loop-construct -Wno-error=maybe-uninitialized -Wno-error=switch -faligned-new=32 -Wno-error=uninitialized -Wno-error=deprecated-declarations -Wno-deprecated-declarations -std=c++17 -m64 -fPIC -fno-omit-frame-pointer -pipe -ffunction-sections -fdata-sections -Werror -Wall -Wextra -Wno-unused-parameter -Wno-unused-function -Wno-error=array-bounds -Wno-error=ignored-attributes -Wno-error=int-in-bool-context -Wimplicit-fallthrough=0 -Wno-sign-compare -Wno-non-virtual-dtor -Wno-ignored-qualifiers -Wno-ignored-attributes -Wno-parentheses -msse3 -O3 -DNDEBUG  \
paddle/fluid/inference/utils/CMakeFiles/test_benchmark.dir/benchmark_tester.cc.o \
-o paddle/fluid/inference/utils/test_benchmark  \
-Wl,-rpath,/home/scratch.rjeng_sw/baidu/paddle/paddle/build/paddle/fluid/pybind:/home/scratch.rjeng_sw/baidu/paddle/paddle/build/paddle/phi:/home/scratch.rjeng_sw/baidu/paddle/paddle/build/paddle/common  \
third_party/install/glog/lib/libglog.a  \
paddle/fluid/inference/utils/libbenchmark.a  \
paddle/testing/libpaddle_gtest_main_new.a  \
paddle/fluid/platform/libenforce.a  \
paddle/phi/api/profiler/libphi_profiler_proto.a  \
paddle/phi/core/distributed/auto_parallel/libauto_parallel_proto.a  \
paddle/utils/libpaddle_flags.a  \
libcblas.a  \
third_party/install/openblas/lib/libopenblas.a  \
third_party/install/utf8proc/lib/libutf8proc.a  \
third_party/install/gloo/lib/libgloo.a  \
third_party/install/dgc/lib/libdgc.a  \
paddle/phi/core/libexternal_error_proto.a  \
third_party/install/gtest/lib/libgtest.a  \
third_party/install/xxhash/lib/libxxhash.a  \
paddle/fluid/framework/libframework_proto.a  \
third_party/install/glog/lib/libglog.a  \
third_party/install/protobuf/lib/libprotobuf.a \
paddle/fluid/pybind/libpaddle.so  \
paddle/phi/libphi.so  \
/usr/lib/x86_64-linux-gnu/libpython3.10.so  \
paddle/phi/libphi.so  \
paddle/common/libcommon.so  \
-pthread -ldl -lrt -lz -lssl -lcrypto -pthread -Wl,--no-as-needed -ldl -lrt -lz

The CMakeLists.txt still needs a fix.

@jeng1220
Copy link
Collaborator Author

@Wangzheee ,
The paddle/testing/libpaddle_gtest_main_new.a depends on paddle/fluid/pybind/libpaddle.so.
Thus, the correct link order should be:

third_party/install/glog/lib/libglog.a  \
paddle/fluid/pybind/libpaddle.so  \
paddle/fluid/inference/utils/libbenchmark.a  \
paddle/testing/libpaddle_gtest_main_new.a  \
+paddle/fluid/pybind/libpaddle.so  \
paddle/phi/libphi.so  \
/usr/lib/x86_64-linux-gnu/libpython3.10.so  \
paddle/fluid/platform/libenforce.a  \
paddle/phi/libphi.so  \
paddle/common/libcommon.so  \
paddle/phi/api/profiler/libphi_profiler_proto.a  \
paddle/phi/core/distributed/auto_parallel/libauto_parallel_proto.a  \
paddle/utils/libpaddle_flags.a  \
libcblas.a  \
third_party/install/openblas/lib/libopenblas.a  \
third_party/install/utf8proc/lib/libutf8proc.a  \
third_party/install/gloo/lib/libgloo.a  \
third_party/install/dgc/lib/libdgc.a  \
paddle/phi/core/libexternal_error_proto.a  \
third_party/install/gtest/lib/libgtest.a  \
third_party/install/xxhash/lib/libxxhash.a  \
paddle/fluid/framework/libframework_proto.a  \
third_party/install/glog/lib/libglog.a  \
third_party/install/protobuf/lib/libprotobuf.a \

@vivienfanghuagood
Copy link
Contributor

We will follow up on this issue, thank you!

@vivienfanghuagood
Copy link
Contributor

Hi, please verify this PR: #60767.

@jeng1220
Copy link
Collaborator Author

@vivienfanghuagood ,
I tried the #60767. It works. Please cherry-pick it to release/2.6.
Thanks.

@yuanlehome
Copy link
Contributor

@vivienfanghuagood , I tried the #60767. It works. Please cherry-pick it to release/2.6. Thanks.

#61427

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NVIDIA status/close 已关闭 type/build 编译/安装问题 预测 原名Inference,包含Capi预测问题等
Projects
None yet
Development

No branches or pull requests

4 participants