New user self-registration is currently disabled. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Bug 1203 - Eigen BLAS requires large stack sizes to build
Eigen BLAS requires large stack sizes to build
Status: RESOLVED FIXED
Product: Eigen
Classification: Unclassified
Component: Core - general
3.3 (current stable)
All All
: Normal Unknown
Assigned To: Nobody
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-04-15 17:21 UTC by Benoit Steiner
Modified: 2016-04-15 20:39 UTC (History)
3 users (show)



Attachments

Description Benoit Steiner 2016-04-15 17:21:39 UTC
I'm trying to use the Eigen BLAS wrappers in an environment with a limited maximum stack size, so I started to compile the code with the following warning: -Wframe-larger-than=16384. This results in the following warning:

/usr/local/google/home/bsteiner/EigenTensor/eigen/blas/../Eigen/src/Core/StableNorm.h: In member function ‘typename Eigen::NumTraits<typename Eigen::internal::traits<T>::Scalar>::Real Eigen::MatrixBase<Derived>::stableNorm() const [with Derived = Eigen::Map<Eigen::Matrix<std::complex<double>, -1, 1>, 0, Eigen::InnerStride<> >; typename Eigen::NumTraits<typename Eigen::internal::traits<T>::Scalar>::Real = double]’:
/usr/local/google/home/bsteiner/EigenTensor/eigen/blas/../Eigen/src/Core/StableNorm.h:185:1: warning: the frame size of 65664 bytes is larger than 16384 bytes [-Wframe-larger-than=]
In file included from /usr/local/google/home/bsteiner/EigenTensor/eigen/blas/../Eigen/Core:401:0,
                 from /usr/local/google/home/bsteiner/EigenTensor/eigen/blas/common.h:13,
                 from /usr/local/google/home/bsteiner/EigenTensor/eigen/blas/level1_impl.h:10,
                 from /usr/local/google/home/bsteiner/EigenTensor/eigen/blas/complex_single.cpp:16:
/usr/local/google/home/bsteiner/EigenTensor/eigen/blas/../Eigen/src/Core/StableNorm.h: In member function ‘typename Eigen::NumTraits<typename Eigen::internal::traits<T>::Scalar>::Real Eigen::MatrixBase<Derived>::stableNorm() const [with Derived = Eigen::Map<Eigen::Matrix<std::complex<float>, -1, 1> >; typename Eigen::NumTraits<typename Eigen::internal::traits<T>::Scalar>::Real = float]’:
/usr/local/google/home/bsteiner/EigenTensor/eigen/blas/../Eigen/src/Core/StableNorm.h:185:1: warning: the frame size of 32888 bytes is larger than 16384 bytes [-Wframe-larger-than=]
 }


I then decreased EIGEN_STACK_ALLOCATION_LIMIT from the default value of 131072 to something compatible with the allowed stack size (e.g 8000), but I ended up with a static assertion:

Building CXX object blas/CMakeFiles/eigen_blas_static.dir/complex_double.cpp.o
In file included from /usr/local/google/home/bsteiner/EigenTensor/eigen/blas/../Eigen/Core:315:0,
                 from /usr/local/google/home/bsteiner/EigenTensor/eigen/blas/common.h:13,
                 from /usr/local/google/home/bsteiner/EigenTensor/eigen/blas/level1_impl.h:10,
                 from /usr/local/google/home/bsteiner/EigenTensor/eigen/blas/single.cpp:15:
/usr/local/google/home/bsteiner/EigenTensor/eigen/blas/../Eigen/src/Core/DenseStorage.h: In instantiation of ‘void Eigen::internal::check_static_allocation_size() [with T = float; int Size = 4096]’:
/usr/local/google/home/bsteiner/EigenTensor/eigen/blas/../Eigen/src/Core/DenseStorage.h:110:42:   required from ‘Eigen::internal::plain_array<T, Size, MatrixOrArrayOptions, 16>::plain_array() [with T = float; int Size = 4096; int MatrixOrArrayOptions = 0]’
/usr/local/google/home/bsteiner/EigenTensor/eigen/blas/../Eigen/src/Core/DenseStorage.h:281:48:   required from ‘Eigen::DenseStorage<T, Size, -1, _Cols, _Options>::DenseStorage() [with T = float; int Size = 4096; int _Cols = 1; int _Options = 0]’
/usr/local/google/home/bsteiner/EigenTensor/eigen/blas/../Eigen/src/Core/PlainObjectBase.h:457:55:   required from ‘Eigen::PlainObjectBase<Derived>::PlainObjectBase() [with Derived = Eigen::Matrix<float, -1, 1, 0, 4096, 1>]’
/usr/local/google/home/bsteiner/EigenTensor/eigen/blas/../Eigen/src/Core/Matrix.h:259:41:   required from ‘Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::Matrix() [with _Scalar = float; int _Rows = -1; int _Cols = 1; int _Options = 0; int _MaxRows = 4096; int _MaxCols = 1]’
/usr/local/google/home/bsteiner/EigenTensor/eigen/blas/../Eigen/src/Core/Ref.h:238:5:   required from ‘Eigen::Ref<const TPlainObjectType, Options, StrideType>::Ref(const Eigen::DenseBase<OtherDerived>&, typename Eigen::internal::enable_if<(bool)(typename Eigen::internal::traits<Eigen::Ref<const TPlainObjectType, Options, StrideType> >::match<Derived>::ScalarTypeMatch), Derived>::type*) [with Derived = Eigen::Block<const Eigen::Map<Eigen::Matrix<float, -1, 1> >, -1, 1, false>; TPlainObjectType = Eigen::Matrix<float, -1, 1, 0, 4096, 1>; int Options = 0; StrideType = Eigen::InnerStride<1>; typename Eigen::internal::enable_if<(bool)(typename Eigen::internal::traits<Eigen::Ref<const TPlainObjectType, Options, StrideType> >::match<Derived>::ScalarTypeMatch), Derived>::type = Eigen::Block<const Eigen::Map<Eigen::Matrix<float, -1, 1> >, -1, 1, false>]’
/usr/local/google/home/bsteiner/EigenTensor/eigen/blas/../Eigen/src/Core/StableNorm.h:183:120:   required from ‘typename Eigen::NumTraits<typename Eigen::internal::traits<T>::Scalar>::Real Eigen::MatrixBase<Derived>::stableNorm() const [with Derived = Eigen::Map<Eigen::Matrix<float, -1, 1> >; typename Eigen::NumTraits<typename Eigen::internal::traits<T>::Scalar>::Real = float]’
/usr/local/google/home/bsteiner/EigenTensor/eigen/blas/level1_real_impl.h:53:53:   required from here
/usr/local/google/home/bsteiner/EigenTensor/eigen/blas/../Eigen/src/Core/util/StaticAssert.h:32:40: error: static assertion failed: OBJECT_ALLOCATED_ON_STACK_IS_TOO_BIG
     #define EIGEN_STATIC_ASSERT(X,MSG) static_assert(X,#MSG);
                                        ^
/usr/local/google/home/bsteiner/EigenTensor/eigen/blas/../Eigen/src/Core/DenseStorage.h:33:3: note: in expansion of macro ‘EIGEN_STATIC_ASSERT’
   EIGEN_STATIC_ASSERT(Size * sizeof(T) <= EIGEN_STACK_ALLOCATION_LIMIT, OBJECT_ALLOCATED_ON_STACK_IS_TOO_BIG);
Comment 1 Gael Guennebaud 2016-04-15 20:39:16 UTC
this should do the job:

https://bitbucket.org/eigen/eigen/commits/ba801cf99d1f/
Summary: Bug 1203: by-pass large stack-allocation in stableNorm if EIGEN_STACK_ALLOCATION_LIMIT is too small

Note You need to log in before you can comment on or make changes to this bug.