-2

I'm wondering if this is a known issue; if not, has anyone experienced this, and has anyone managed to find a fix?

I'm building a numerical computation code using Eigen 3.3.4 using GCC 6.4 on Fedora 25 on a Core i7-3700. My proc/cpuinfo says I should have AVX. I've tried two builds. Build 1:

g++ -std=c++14 -O3 -m64 -mavx

and build 2:

g++ -std=c++14 -O3 -m64 -msse4.2

Build 2 runs fine. But when I try build 1, I get segfaults in the Zero function for a square fixed-size matrix as well as in the inverse() method. I'll appreciate any pointers as to what might be going on.

EDIT: I forgot one very important detail: I was actually using a std::vector of fixed-size Eigen matrices.

Aditya Kashi
  • 266
  • 2
  • 13

1 Answers1

2

The fact that I was using a std::vector of fixed-size matrices was the key. Thanks very much for the request for a minimal example, @rex. While preparing the example, I found out the following.

For certain large input sizes (of the std::vector containing the matrices), Eigen throws a runtime error, which led me to this site. Following the instructions there fixed the issue.

Essentially, std::vector with its standard allocator seems to mess with Eigen's alignment requirements for vectorization of fixed-size array operations. Using Eigen's provided aligned_allocator fixes the issue.

Aditya Kashi
  • 266
  • 2
  • 13