Skip to content

fix: respect onnxruntime_USE_PREINSTALLED_EIGEN option - #22057

Closed
cloudhan wants to merge 1 commit into
mainfrom
guangyunhan/fix-eigen
Closed

fix: respect onnxruntime_USE_PREINSTALLED_EIGEN option#22057
cloudhan wants to merge 1 commit into
mainfrom
guangyunhan/fix-eigen

Conversation

@cloudhan

Copy link
Copy Markdown
Contributor

Description

In #21348, eigen find logic is changed if the eigen package is present on the system, causing

FAILED: CMakeFiles/onnxruntime_common.dir/home/username/onnxruntime/onnxruntime/core/platform/posix/env.cc.o 
ccache /usr/bin/c++ -DCPUINFO_SUPPORTED_PLATFORM=1 -DEIGEN_MPL2_ONLY -DEIGEN_USE_THREADS -DNSYNC_ATOMIC_CPP11 -DONLY_C_LOCALE=0 -DORT_ENABLE_STREAM -DPLATFORM_POSIX -DUSE_QNN=1 -D_GNU_SOURCE -I/home/username/onnxruntime/build_qnn/RelWithDebInfo/_deps/utf8_range-src -I/home/username/onnxruntime/include/onnxruntime -I/home/username/onnxruntime/include/onnxruntime/core/session -I/home/username/onnxruntime/build_qnn/RelWithDebInfo/_deps/pytorch_cpuinfo-src/include -I/home/username/onnxruntime/build_qnn/RelWithDebInfo/_deps/google_nsync-src/public -I/home/username/onnxruntime/build_qnn/RelWithDebInfo -I/home/username/onnxruntime/onnxruntime -I/home/username/onnxruntime/build_qnn/RelWithDebInfo/_deps/abseil_cpp-src -I/home/username/onnxruntime/build_qnn/RelWithDebInfo/_deps/date-src/include -I/usr/include/eigen3 -I/home/username/onnxruntime/build_qnn/RelWithDebInfo/_deps/safeint-src -isystem /home/username/onnxruntime/build_qnn/RelWithDebInfo/_deps/gsl-src/include -ffunction-sections -fdata-sections -Wno-restrict  -DCPUINFO_SUPPORTED -O2 -g -DNDEBUG -std=gnu++17 -fPIC -Wall -Wextra -Wno-deprecated-copy -Wno-nonnull-compare -Werror -MD -MT CMakeFiles/onnxruntime_common.dir/home/username/onnxruntime/onnxruntime/core/platform/posix/env.cc.o -MF CMakeFiles/onnxruntime_common.dir/home/username/onnxruntime/onnxruntime/core/platform/posix/env.cc.o.d -o CMakeFiles/onnxruntime_common.dir/home/username/onnxruntime/onnxruntime/core/platform/posix/env.cc.o -c /home/username/onnxruntime/onnxruntime/core/platform/posix/env.cc
In file included from /home/username/onnxruntime/onnxruntime/core/platform/posix/env.cc:57:
/home/username/onnxruntime/include/onnxruntime/core/platform/EigenNonBlockingThreadPool.h: In constructor ‘onnxruntime::concurrency::ThreadPoolTempl<Environment>::ThreadPoolTempl(const CHAR_TYPE*, int, bool, Environment&, const onnxruntime::ThreadOptions&)’:
/home/username/onnxruntime/include/onnxruntime/core/platform/EigenNonBlockingThreadPool.h:789:21: error: ‘class Eigen::MaxSizeVector<Eigen::MaxSizeVector<unsigned int> >’ has no member named ‘emplace_back’
  789 |       all_coprimes_.emplace_back(i);
      |                     ^~~~~~~~~~~~

Because if find the very old version of eigen which do not have the emplace_back defined.

@cloudhan
cloudhan requested a review from snnn September 11, 2024 09:07
@snnn

snnn commented Sep 11, 2024

Copy link
Copy Markdown
Contributor

When the option is set, user should also set "eigen_SOURCE_PATH" to point to a preinstalled eigen path. This is how the option was used in the past.

endif()

find_package(Eigen3 CONFIG)
if (onnxruntime_USE_PREINSTALLED_EIGEN)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onnxruntime_USE_PREINSTALLED_EIGEN is not used for indicating whether find_package should be used for looking for Eigen or not. It is a deprecated feature. I even couldn't remember why it was added. It is used with another cmake variable.

By default, cmake always call find_package first, unless FETCHCONTENT_TRY_FIND_PACKAGE_MODE is set to NEVER.

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.

2 participants