Paddle icon indicating copy to clipboard operation
Paddle copied to clipboard

Duplicate symbol error when installing PaddlePaddle with WITH_ROCM option on

Open terU3760 opened this issue 3 years ago • 5 comments

问题描述 Issue Description

When I use the following command to install PaddlePaddle on ROCm platform:

(base) [root@hpe02 Paddle]# rm -rf ./build
(base) [root@hpe02 Paddle]# mkdir build && cd build
(base) [root@hpe02 build]# cmake .. -DPY_VERSION=3.7 -DWITH_ROCM=ON -DWITH_TESTING=ON -DWITH_DISTRIBUTE=ON -DWITH_MKL=ON -DCMAKE_BUILD_TYPE=Release
(base) [root@hpe02 build]# make -j1

it reports the following error:

......
[ 91%] Linking HIP executable phi_test_scalar
ld.lld: error: duplicate symbol: guard variable for phi::TypeInfoTraits<phi::TensorBase, phi::TensorArray>::kType
>>> defined at test_scalar.cu
>>>            CMakeFiles/phi_test_scalar.dir/phi_test_scalar_generated_test_scalar.cu.o:(guard variable for phi::TypeInfoTraits<phi::TensorBase, phi::TensorArray>::kType)
>>> defined at paddle_gtest_main.cc
>>>            paddle_gtest_main.cc.o:(.bss._ZGVN3phi14TypeInfoTraitsINS_10TensorBaseENS_11TensorArrayEE5kTypeE+0x0) in archive ../../../testing/libpaddle_gtest_main.a

ld.lld: error: duplicate symbol: guard variable for phi::TypeInfo<phi::StorageProperties>::kUnknownType
>>> defined at test_scalar.cu
>>>            CMakeFiles/phi_test_scalar.dir/phi_test_scalar_generated_test_scalar.cu.o:(guard variable for phi::TypeInfo<phi::StorageProperties>::kUnknownType)
>>> defined at scalar.cc
>>>            scalar.cc.o:(.bss._ZGVN3phi8TypeInfoINS_17StoragePropertiesEE12kUnknownTypeE+0x0) in archive ../../common/libscalar.a

ld.lld: error: duplicate symbol: guard variable for phi::TypeInfo<phi::TensorBase>::kUnknownType
>>> defined at test_scalar.cu
>>>            CMakeFiles/phi_test_scalar.dir/phi_test_scalar_generated_test_scalar.cu.o:(guard variable for phi::TypeInfo<phi::TensorBase>::kUnknownType)
>>> defined at scalar.cc
>>>            scalar.cc.o:(.bss._ZGVN3phi8TypeInfoINS_10TensorBaseEE12kUnknownTypeE+0x0) in archive ../../common/libscalar.a

ld.lld: error: duplicate symbol: guard variable for phi::TypeInfo<phi::DeviceContext>::kUnknownType
>>> defined at test_scalar.cu
>>>            CMakeFiles/phi_test_scalar.dir/phi_test_scalar_generated_test_scalar.cu.o:(guard variable for phi::TypeInfo<phi::DeviceContext>::kUnknownType)
>>> defined at scalar.cc
>>>            scalar.cc.o:(.bss._ZGVN3phi8TypeInfoINS_13DeviceContextEE12kUnknownTypeE+0x0) in archive ../../common/libscalar.a

ld.lld: error: duplicate symbol: guard variable for phi::TypeInfoTraits<phi::StorageProperties, phi::NPUStorageProperties>::kType
>>> defined at test_scalar.cu
>>>            CMakeFiles/phi_test_scalar.dir/phi_test_scalar_generated_test_scalar.cu.o:(guard variable for phi::TypeInfoTraits<phi::StorageProperties, phi::NPUStorageProperties>::kType)
>>> defined at scalar.cc
>>>            scalar.cc.o:(.bss._ZGVN3phi14TypeInfoTraitsINS_17StoragePropertiesENS_20NPUStoragePropertiesEE5kTypeE+0x0) in archive ../../common/libscalar.a

ld.lld: error: duplicate symbol: guard variable for phi::TypeInfoTraits<phi::StorageProperties, phi::OneDNNStorageProperties>::kType
>>> defined at test_scalar.cu
>>>            CMakeFiles/phi_test_scalar.dir/phi_test_scalar_generated_test_scalar.cu.o:(guard variable for phi::TypeInfoTraits<phi::StorageProperties, phi::OneDNNStorageProperties>::kType)
>>> defined at scalar.cc
>>>            scalar.cc.o:(.bss._ZGVN3phi14TypeInfoTraitsINS_17StoragePropertiesENS_23OneDNNStoragePropertiesEE5kTypeE+0x0) in archive ../../common/libscalar.a
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [paddle/phi/tests/common/phi_test_scalar] Error 1
make[1]: *** [paddle/phi/tests/common/CMakeFiles/phi_test_scalar.dir/all] Error 2
make: *** [all] Error 2

What could be the cause? Please help! Thanks in advance!

版本&环境信息 Version & Environment Information


Paddle version: https://github.com/ROCmSoftwarePlatform/Paddle/blob/develop_8c416653_hip_1209/tools/dockerfile/Dockerfile.rocm Paddle with WITH_ROCM on

OS: CentOS Linux 7 GCC version: 7.3.1 Clang version: 3.8.0 CMake version: 3.16.0 Libc version: 2.17 Python version: 3.7.9

ROCm version: 5.3.0 Hardware: MI100 gpu


terU3760 avatar Jan 09 '23 17:01 terU3760

您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看官网API文档、常见问题、历史Issue、AI社区来寻求解答。祝您生活愉快~

Hi! We've received your issue and please be patient to get responded. We will arrange technicians to answer your questions as soon as possible. Please make sure that you have posted enough message to demo your request. You may also check out the API,FAQ,Github Issue and AI community to get the answer.Have a nice day!

paddle-bot avatar Jan 09 '23 17:01 paddle-bot

hi, @terU3760 ,

ROCm version 5.3.0 has not been verified on PaddlePaddle yet, and the version official support now is 4.0.1 ONLY.

While based on the error message, propose to change your cmake command as following may help:

# change WITH_TESTING to OFF here to avoid duplicate symbol
cmake .. -DPY_VERSION=3.7 -DWITH_ROCM=ON -DWITH_TESTING=OFF -DWITH_DISTRIBUTE=ON \
         -DWITH_MKL=ON -DCMAKE_BUILD_TYPE=Release

Please let me know if it works, and apologize that we do not have environment to reproduced this issue.

BTW, we have tested AMD MI100 GPU with ROCm version 4.5.2 once, and it works fine. You may also downgrade your ROCm version to 4.5.2 to work-around.

qili93 avatar Jan 10 '23 02:01 qili93

hi,@qili93, Do we have any plan to adapt for rocm5.0+?

milliar2020 avatar Mar 22 '23 14:03 milliar2020

Hello everyone, inspired by the efforts made in this Repo, I did some research and have successfully built an older commit of paddle (from Dec 2022). Additionally, i have added gfx1030 support.

The configuration: centos:7.8.2003 Docker, gcc 7.3.1, ROCm 5.0.2, AMDGPU 21.50.2 Intel Xeon E5-2683 (x2), AMD RX Radeon 6800 (LLVM build target gfx1030)

paddle.utils.run_check() will pass, it will also run paddlespeech=1.4.1.

Feel free to take a look in my repo: https://github.com/linwownil/Paddle/tree/develop_rocm502

Hope this helps!

linwownil avatar Jun 26 '23 11:06 linwownil

Since you haven't replied for more than a year, we have closed this issue/pr. If the problem is not solved or there is a follow-up one, please reopen it at any time and we will continue to follow up. 由于您超过一年未回复,我们将关闭这个issue/pr。 若问题未解决或有后续问题,请随时重新打开,我们会继续跟进。

paddle-bot avatar Jul 02 '24 06:07 paddle-bot