grid_map icon indicating copy to clipboard operation
grid_map copied to clipboard

Unit tests fail when built with AVX instruction set option

Open wsascha opened this issue 7 years ago • 1 comments

We tried to make grid_map_core run using AVX instructions. Therefore, we added set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx") in line 3 of the grid_map_core's CMakeLists.txt file.

Unfortunately, this will generate runtime segfaults, e.g. when running the following unit test in test/GridMapTest.cpp:

TEST(GridMap, CopyConstructor)
{
  GridMap map({"layer_a", "layer_b"});
  map.setGeometry(Length(1.0, 2.0), 0.1, Position(0.1, 0.2));
  map["layer_a"].setConstant(1.0);
  map["layer_b"].setConstant(2.0);
  // ...
}

The segfault happens during call of the setConstant method.

Has anyone ever tried to build grid_map with AVX instructions or any idea why this simple test fails?

wsascha avatar Mar 12 '18 14:03 wsascha

Hi @wsascha. We also had segfaults with grid_map and other code using Eigen. There is a bug with AVX alignment in Eigen 3.3~beta1-2 which is part of Ubuntu 16.04. Unfortunately I cannot remember where I read about the issue in the bug tracker of Eigen but disabling AVX optimizations prevented the segfaults.

thomasemter avatar Apr 05 '18 20:04 thomasemter