Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors in Python interface #64

Open
stephanietsuei opened this issue May 25, 2022 · 2 comments
Open

Errors in Python interface #64

stephanietsuei opened this issue May 25, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@stephanietsuei
Copy link
Collaborator

stephanietsuei commented May 25, 2022

Investigate and fix the following two broken Python interfaces.

  1. The variable Estimator::MeasurementUpdateInitialized_ should be false at first, but then switch to true after the first measurement update is performed (see manager.cpp, line 210), and remain true after that. However, no matter what, the getter Estimator::MeasurementUpdateInitialized() always returns false.
  2. The variable Estimator::vision_initialized_ should be false at first, but then switch to true after an estimate of gravity is initialized. For some reason, the getter Estimator::VisionInitialized() always returns false unless XIVO is compiled in debug mode.
  3. Although the variable Estimator::P_ appears to work, its size gets messed up when calling Estimator::Pstate() through the Python interface and the whole program segfaults.

The third error may be related to this warning that is seen during compilation (with g++-12, eigen-3.3.9).

In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/12.1.0/include/immintrin.h:43,
                 from /home/stephanie/Code/xivo/thirdparty/eigen/include/eigen3/Eigen/Core:210,
                 from /home/stephanie/Code/xivo/thirdparty/eigen/include/eigen3/Eigen/SparseCore:11,
                 from /home/stephanie/Code/xivo/thirdparty/eigen/include/eigen3/Eigen/Sparse:26,
                 from /home/stephanie/Code/xivo/src/estimator.h:19,
                 from /home/stephanie/Code/xivo/src/feature.cpp:3:
In function ‘void _mm256_store_pd(double*, __m256d)’,
    inlined from ‘void Eigen::internal::pstore(Scalar*, const Packet&) [with Scalar = double; Packet = __vector(4) double]’ at /home/stephanie/Code/xivo/thirdparty/eigen/include/eigen3/Eigen/src/Core/arch/AVX/PacketMath.h:252:129,
    inlined from ‘void Eigen::internal::pstoret(Scalar*, const Packet&) [with Scalar = double; Packet = __vector(4) double; int Alignment = 32]’ at /home/stephanie/Code/xivo/thirdparty/eigen/include/eigen3/Eigen/src/Core/GenericPacketMath.h:471:11,
    inlined from ‘void Eigen::internal::assign_op<DstScalar, SrcScalar>::assignPacket(DstScalar*, const Packet&) const [with int Alignment = 32; Packet = __vector(4) double; DstScalar = double; SrcScalar = double]’ at /home/stephanie/Code/xivo/thirdparty/eigen/include/eigen3/Eigen/src/Core/functors/AssignmentFunctors.h:28:50,
    inlined from ‘void Eigen::internal::generic_dense_assignment_kernel<DstEvaluatorTypeT, SrcEvaluatorTypeT, Functor, Version>::assignPacket(Eigen::Index) [with int StoreMode = 32; int LoadMode = 0; PacketType = __vector(4) double; DstEvaluatorTypeT = Eigen::internal::evaluator<Eigen::Block<Eigen::Matrix<double, 3, 1>, -1, 1, false> >; SrcEvaluatorTypeT = Eigen::internal::evaluator<Eigen::Block<Eigen::Matrix<double, 3, 1>, -1, 1, false> >; Functor = Eigen::internal::assign_op<double, double>; int Version = 0]’ at /home/stephanie/Code/xivo/thirdparty/eigen/include/eigen3/Eigen/src/Core/AssignEvaluator.h:658:47,
    inlined from ‘static void Eigen::internal::dense_assignment_loop<Kernel, 3, 0>::run(Kernel&) [with Kernel = Eigen::internal::generic_dense_assignment_kernel<Eigen::internal::evaluator<Eigen::Block<Eigen::Matrix<double, 3, 1>, -1, 1, false> >, Eigen::internal::evaluator<Eigen::Block<Eigen::Matrix<double, 3, 1>, -1, 1, false> >, Eigen::internal::assign_op<double, double>, 0>]’ at /home/stephanie/Code/xivo/thirdparty/eigen/include/eigen3/Eigen/src/Core/AssignEvaluator.h:416:75,
    inlined from ‘void Eigen::internal::call_dense_assignment_loop(DstXprType&, const SrcXprType&, const Functor&) [with DstXprType = Eigen::Block<Eigen::Matrix<double, 3, 1>, -1, 1, false>; SrcXprType = Eigen::Block<Eigen::Matrix<double, 3, 1>, -1, 1, false>; Functor = assign_op<double, double>]’ at /home/stephanie/Code/xivo/thirdparty/eigen/include/eigen3/Eigen/src/Core/AssignEvaluator.h:741:37,
    inlined from ‘static void Eigen::internal::Assignment<DstXprType, SrcXprType, Functor, Eigen::internal::Dense2Dense, Weak>::run(DstXprType&, const SrcXprType&, const Functor&) [with DstXprType = Eigen::Block<Eigen::Matrix<double, 3, 1>, -1, 1, false>; SrcXprType = Eigen::Block<Eigen::Matrix<double, 3, 1>, -1, 1, false>; Functor = Eigen::internal::assign_op<double, double>; Weak = void]’ at /home/stephanie/Code/xivo/thirdparty/eigen/include/eigen3/Eigen/src/Core/AssignEvaluator.h:879:31,
    inlined from ‘void Eigen::internal::call_assignment_no_alias(Dst&, const Src&, const Func&) [with Dst = Eigen::Block<Eigen::Matrix<double, 3, 1>, -1, 1, false>; Src = Eigen::Block<Eigen::Matrix<double, 3, 1>, -1, 1, false>; Func = assign_op<double, double>]’ at /home/stephanie/Code/xivo/thirdparty/eigen/include/eigen3/Eigen/src/Core/AssignEvaluator.h:836:49,
    inlined from ‘void Eigen::internal::call_assignment(Dst&, const Src&, const Func&, typename enable_if<(! evaluator_assume_aliasing<Src>::value), void*>::type) [with Dst = Eigen::Block<Eigen::Matrix<double, 3, 1>, -1, 1, false>; Src = Eigen::Block<Eigen::Matrix<double, 3, 1>, -1, 1, false>; Func = assign_op<double, double>]’ at /home/stephanie/Code/xivo/thirdparty/eigen/include/eigen3/Eigen/src/Core/AssignEvaluator.h:804:27,
    inlined from ‘void Eigen::internal::call_assignment(Dst&, const Src&) [with Dst = Eigen::Block<Eigen::Matrix<double, 3, 1>, -1, 1, false>; Src = Eigen::Block<Eigen::Matrix<double, 3, 1>, -1, 1, false>]’ at /home/stephanie/Code/xivo/thirdparty/eigen/include/eigen3/Eigen/src/Core/AssignEvaluator.h:782:18,
    inlined from ‘Derived& Eigen::MatrixBase<Derived>::operator=(const Eigen::MatrixBase<Derived>&) [with Derived = Eigen::Block<Eigen::Matrix<double, 3, 1>, -1, 1, false>]’ at /home/stephanie/Code/xivo/thirdparty/eigen/include/eigen3/Eigen/src/Core/Assign.h:57:28,
    inlined from ‘Derived& Eigen::MapBase<Derived, 1>::operator=(const Eigen::MapBase<Derived, 1>&) [with Derived = Eigen::Block<Eigen::Matrix<double, 3, 1>, -1, 1, false>]’ at /home/stephanie/Code/xivo/thirdparty/eigen/include/eigen3/Eigen/src/Core/MapBase.h:292:39,
    inlined from ‘Eigen::internal::BlockImpl_dense<XprType, BlockRows, BlockCols, InnerPanel, true>& Eigen::internal::BlockImpl_dense<XprType, BlockRows, BlockCols, InnerPanel, true>::operator=(const Eigen::internal::BlockImpl_dense<XprType, BlockRows, BlockCols, InnerPanel, true>&) [with XprType = Eigen::Matrix<double, 3, 1>; int BlockRows = -1; int BlockCols = 1; bool InnerPanel = false]’ at /home/stephanie/Code/xivo/thirdparty/eigen/include/eigen3/Eigen/src/Core/Block.h:341:5,
    inlined from ‘Eigen::BlockImpl<XprType, BlockRows, BlockCols, InnerPanel, Eigen::Dense>& Eigen::BlockImpl<XprType, BlockRows, BlockCols, InnerPanel, Eigen::Dense>::operator=(const Eigen::BlockImpl<XprType, BlockRows, BlockCols, InnerPanel, Eigen::Dense>&) [with XprType = Eigen::Matrix<double, 3, 1>; int BlockRows = -1; int BlockCols = 1; bool InnerPanel = false]’ at /home/stephanie/Code/xivo/thirdparty/eigen/include/eigen3/Eigen/src/Core/Block.h:161:5,
    inlined from ‘Eigen::Block<XprType, BlockRows, BlockCols, InnerPanel>& Eigen::Block<XprType, BlockRows, BlockCols, InnerPanel>::operator=(const Eigen::Block<XprType, BlockRows, BlockCols, InnerPanel>&) [with XprType = Eigen::Matrix<double, 3, 1>; int BlockRows = -1; int BlockCols = 1; bool InnerPanel = false]’ at /home/stephanie/Code/xivo/thirdparty/eigen/include/eigen3/Eigen/src/Core/Block.h:111:5,
    inlined from ‘void Eigen::TriangularViewImpl<_MatrixType, _Mode, Eigen::Dense>::_solve_impl(const RhsType&, DstType&) const [with RhsType = Eigen::Block<Eigen::Matrix<double, 3, 1>, -1, 1, false>; DstType = Eigen::Block<Eigen::Matrix<double, 3, 1>, -1, 1, false>; _MatrixType = const Eigen::Block<const Eigen::Matrix<double, 3, 3>, -1, -1, false>; unsigned int _Mode = 2]’ at /home/stephanie/Code/xivo/thirdparty/eigen/include/eigen3/Eigen/src/Core/TriangularMatrix.h:538:13,
    inlined from ‘static void Eigen::internal::Assignment<DstXprType, Eigen::Solve<DecType, RhsType>, Eigen::internal::assign_op<Scalar, Scalar>, Eigen::internal::Dense2Dense>::run(DstXprType&, const SrcXprType&, const Eigen::internal::assign_op<Scalar, Scalar>&) [with DstXprType = Eigen::Block<Eigen::Matrix<double, 3, 1>, -1, 1, false>; DecType = Eigen::TriangularView<const Eigen::Block<const Eigen::Matrix<double, 3, 3>, -1, -1, false>, 2>; RhsType = Eigen::Block<Eigen::Matrix<double, 3, 1>, -1, 1, false>; Scalar = double]’ at /home/stephanie/Code/xivo/thirdparty/eigen/include/eigen3/Eigen/src/Core/Solve.h:147:26,
    inlined from ‘void Eigen::internal::call_assignment_no_alias(Dst&, const Src&, const Func&) [with Dst = Eigen::Block<Eigen::Matrix<double, 3, 1>, -1, 1, false>; Src = Eigen::Solve<Eigen::TriangularView<const Eigen::Block<const Eigen::Matrix<double, 3, 3>, -1, -1, false>, 2>, Eigen::Block<Eigen::Matrix<double, 3, 1>, -1, 1, false> >; Func = assign_op<double, double>]’ at /home/stephanie/Code/xivo/thirdparty/eigen/include/eigen3/Eigen/src/Core/AssignEvaluator.h:836:49,
    inlined from ‘void Eigen::internal::call_assignment(Dst&, const Src&, const Func&, typename enable_if<(! evaluator_assume_aliasing<Src>::value), void*>::type) [with Dst = Eigen::Block<Eigen::Matrix<double, 3, 1>, -1, 1, false>; Src = Eigen::Solve<Eigen::TriangularView<const Eigen::Block<const Eigen::Matrix<double, 3, 3>, -1, -1, false>, 2>, Eigen::Block<Eigen::Matrix<double, 3, 1>, -1, 1, false> >; Func = assign_op<double, double>]’ at /home/stephanie/Code/xivo/thirdparty/eigen/include/eigen3/Eigen/src/Core/AssignEvaluator.h:804:27,
    inlined from ‘void Eigen::internal::call_assignment(Dst&, const Src&) [with Dst = Eigen::Block<Eigen::Matrix<double, 3, 1>, -1, 1, false>; Src = Eigen::Solve<Eigen::TriangularView<const Eigen::Block<const Eigen::Matrix<double, 3, 3>, -1, -1, false>, 2>, Eigen::Block<Eigen::Matrix<double, 3, 1>, -1, 1, false> >]’ at /home/stephanie/Code/xivo/thirdparty/eigen/include/eigen3/Eigen/src/Core/AssignEvaluator.h:782:18,
    inlined from ‘Derived& Eigen::MatrixBase<Derived>::operator=(const Eigen::DenseBase<OtherDerived>&) [with OtherDerived = Eigen::Solve<Eigen::TriangularView<const Eigen::Block<const Eigen::Matrix<double, 3, 3>, -1, -1, false>, 2>, Eigen::Block<Eigen::Matrix<double, 3, 1>, -1, 1, false> >; Derived = Eigen::Block<Eigen::Matrix<double, 3, 1>, -1, 1, false>]’ at /home/stephanie/Code/xivo/thirdparty/eigen/include/eigen3/Eigen/src/Core/Assign.h:66:28,
    inlined from ‘void Eigen::CompleteOrthogonalDecomposition<MatrixType>::_solve_impl(const RhsType&, DstType&) const [with RhsType = Eigen::Matrix<double, 3, 1>; DstType = Eigen::Matrix<double, 3, 1>; _MatrixType = Eigen::Matrix<double, 3, 3>]’ at /home/stephanie/Code/xivo/thirdparty/eigen/include/eigen3/Eigen/src/QR/CompleteOrthogonalDecomposition.h:510:21:
/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.0/include/avxintrin.h:875:19: warning: ‘void* __builtin_memcpy(void*, const void*, long unsigned int)’ reading 32 or more bytes from a region of size 24 [-Wstringop-overread]
  875 |   *(__m256d *)__P = __A;
      |   ~~~~~~~~~~~~~~~~^~~~~
In file included from /home/stephanie/Code/xivo/thirdparty/eigen/include/eigen3/Eigen/QR:37,
                 from /home/stephanie/Code/xivo/thirdparty/eigen/include/eigen3/Eigen/Dense:4,
                 from /home/stephanie/Code/xivo/common/rodrigues.h:2,
                 from /home/stephanie/Code/xivo/common/alias.h:5,
                 from /home/stephanie/Code/xivo/src/core.h:15,
                 from /home/stephanie/Code/xivo/src/estimator.h:24:
/home/stephanie/Code/xivo/thirdparty/eigen/include/eigen3/Eigen/src/QR/CompleteOrthogonalDecomposition.h: In member function ‘void Eigen::CompleteOrthogonalDecomposition<MatrixType>::_solve_impl(const RhsType&, DstType&) const [with RhsType = Eigen::Matrix<double, 3, 1>; DstType = Eigen::Matrix<double, 3, 1>; _MatrixType = Eigen::Matrix<double, 3, 3>]’:
/home/stephanie/Code/xivo/thirdparty/eigen/include/eigen3/Eigen/src/QR/CompleteOrthogonalDecomposition.h:505:33: note: source object ‘c’ of size 24
  505 |   typename RhsType::PlainObject c(rhs);
      |                                 ^
@stephanietsuei stephanietsuei added the bug Something isn't working label May 25, 2022
@stephanietsuei
Copy link
Collaborator Author

stephanietsuei commented May 26, 2022

Item 2 appears on both Ubuntu 20.04/gcc-9 and Arch Linux/gcc-12 when we set the following lines in src/CMakeLists.txt:

add_definitions(-DEKF_MAX_FEATURES=100)
add_definitions(-DEKF_MAX_GROUPS=50)

However, it doesn't happen on either machine when we set

add_definitions(-DEKF_MAX_FEATURES=45)
add_definitions(-DEKF_MAX_GROUPS=30)

When the number of features and groups is dropped further (to our default value), then item 1 disappears too.

add_definitions(-DEKF_MAX_FEATURES=30)
add_definitions(-DEKF_MAX_GROUPS=15)

@stephanietsuei
Copy link
Collaborator Author

The compilation warning mentioned in the first post disappears when we comment out this line in CMakeLists.txt.

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=native -march=native")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant