未验证 提交 ba09621a 编写于 作者: C chalsliu 提交者: GitHub

Fix eigen multiple definition (#54812)

上级 3ec55faa
...@@ -40,6 +40,13 @@ elseif(LINUX) ...@@ -40,6 +40,13 @@ elseif(LINUX)
endif() endif()
if(CMAKE_COMPILER_IS_GNUCC) if(CMAKE_COMPILER_IS_GNUCC)
file(TO_NATIVE_PATH ${PADDLE_SOURCE_DIR}/patches/eigen/TensorRandom.h.patch
tensor_random_header)
# See: [Why calling some `git` commands before `patch`?]
set(EIGEN_PATCH_COMMAND
git checkout -- . && git checkout ${EIGEN_TAG} && patch -Nd
${SOURCE_DIR}/unsupported/Eigen/CXX11/src/Tensor <
${tensor_random_header})
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpfullversion -dumpversion execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpfullversion -dumpversion
OUTPUT_VARIABLE GCC_VERSION) OUTPUT_VARIABLE GCC_VERSION)
string(REGEX MATCHALL "[0-9]+" GCC_VERSION_COMPONENTS ${GCC_VERSION}) string(REGEX MATCHALL "[0-9]+" GCC_VERSION_COMPONENTS ${GCC_VERSION})
...@@ -49,9 +56,8 @@ if(CMAKE_COMPILER_IS_GNUCC) ...@@ -49,9 +56,8 @@ if(CMAKE_COMPILER_IS_GNUCC)
if(GCC_VERSION GREATER_EQUAL "12.0") if(GCC_VERSION GREATER_EQUAL "12.0")
file(TO_NATIVE_PATH ${PADDLE_SOURCE_DIR}/patches/eigen/Complex.h.patch file(TO_NATIVE_PATH ${PADDLE_SOURCE_DIR}/patches/eigen/Complex.h.patch
complex_header) complex_header)
# See: [Why calling some `git` commands before `patch`?]
set(EIGEN_PATCH_COMMAND set(EIGEN_PATCH_COMMAND
git checkout -- . && git checkout ${EIGEN_TAG} && patch -Nd ${EIGEN_PATCH_COMMAND} && patch -Nd
${SOURCE_DIR}/Eigen/src/Core/arch/SSE/ < ${complex_header}) ${SOURCE_DIR}/Eigen/src/Core/arch/SSE/ < ${complex_header})
endif() endif()
endif() endif()
......
--- a/unsupported/Eigen/CXX11/src/Tensor/TensorRandom.h
+++ b/unsupported/Eigen/CXX11/src/Tensor/TensorRandom.h
@@ -16,7 +16,7 @@ namespace internal {
namespace {
-EIGEN_DEVICE_FUNC uint64_t get_random_seed() {
+static EIGEN_DEVICE_FUNC uint64_t get_random_seed() {
#if defined(EIGEN_GPU_COMPILE_PHASE)
// We don't support 3d kernels since we currently only use 1 and
// 2d kernels.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册