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

[StateContainer] Accelerate copy of MatrixDeriv for CRS matrices #4443

Merged
merged 7 commits into from
Jan 25, 2024

Conversation

alxbilger
Copy link
Contributor

@alxbilger alxbilger commented Jan 18, 2024

Based on #4442
Diff: alxbilger/sofa@filtervalues...alxbilger:sofa:copymatrixderiv

The goal is to accelerate the computation of mappings jacobians when projecting the mapped stiffness matrices. In some cases, the conversion from the MatrixDeriv (stored in the mechanical objects) is really slow, even slower than the actual computation of the matrix. A special case is now added when the destination is a CompressedRowSparseMatrixMechanical. Unfortunately, this is detected with a dynamic_cast.

To benchmark the changes, let's add the following timers in MatrixLinearSystem.inl (line 1076):

        {
            SCOPED_TIMER("copyToBaseMatrix");
            input->copyToBaseMatrix(J.get(), mappingJacobianId, offset);
        }
        {
            SCOPED_TIMER("fullRows");
            J->fullRows();
        }

Reduced Diamond (1000 time steps)

ModelOrderReduction relies heavily on mapped matrices (a huge matrix projected on a small matrix)

Before

[INFO]    [BatchGUI] 1000 iterations done in 22.5868 s ( 44.2737 FPS).
 LEVEL   START    NUM      MIN     MAX   MEAN     DEV    TOTAL  PERCENT ID
   6       1.06    1      14.53   33.47   16.75    2.42   16.75   90.54 ......projectMappedMatrices
   7       3.08    1       3.72   11.63    4.31    0.89    4.31   23.29 .......copyToBaseMatrix
   7       7.39    1       1.78    7.48    2.05    0.52    2.05   11.10 .......fullRows

After

[INFO]    [BatchGUI] 1000 iterations done in 16.4596 s ( 60.7547 FPS).
 LEVEL   START    NUM      MIN     MAX   MEAN     DEV    TOTAL  PERCENT ID
   6       1.03    1      10.91   18.91   12.14    1.17   12.14   88.05 ......projectMappedMatrices
   7       2.95    1       2.09    4       2.38    0.26    2.38   17.25 .......copyToBaseMatrix
   7       5.33    1       0.01    0.04    0.01    0       0.01    0.09 .......fullRows

Speedup

Speed up of x1.4 on the timer projectMappedMatrices. The bottleneck is now in the computation of J^T * K * J.

MatrixLinearSystem.scn (1000 time steps)

Before

[INFO]    [BatchGUI] 1000 iterations done in 17.5332 s ( 57.0347 FPS).
 LEVEL   START    NUM      MIN     MAX   MEAN     DEV    TOTAL  PERCENT ID
   6       7.28    2       0.06   13.43    2.26    2.27    4.52   31.65 ......projectMappedMatrices
   7       8.28   12       0       0.54    0.03    0.04    0.34    2.35 .......copyToBaseMatrix
   7       8.37   12       0       0.23    0.02    0.02    0.21    1.48 .......fullRows

After

[INFO]    [BatchGUI] 1000 iterations done in 16.4943 s ( 60.6268 FPS). 
 LEVEL   START    NUM      MIN     MAX   MEAN     DEV    TOTAL  PERCENT ID
   6       7.11    2       0.04   12.74    1.94    1.95    3.89   28.81 ......projectMappedMatrices
   7       8.13   12       0       0.14    0.01    0.02    0.18    1.32 .......copyToBaseMatrix
   7       8.17   12       0       0.05    0       0       0       0.02 .......fullRows

Conclusion

In both scenes, the timer fullRows is almost at zero because the functions copyNonZeros already produces a compressed matrix. In addition, the timer copyToBaseMatrix is faster.

FYI @olivier-goury @VannesteFelix


By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).


Reviewers will merge this pull-request only if

  • it builds with SUCCESS for all platforms on the CI.
  • it does not generate new warnings.
  • it does not generate new unit test failures.
  • it does not generate new scene test failures.
  • it does not break API compatibility.
  • it is more than 1 week old (or has fast-merge label).

@alxbilger alxbilger added enhancement About a possible enhancement pr: status to review To notify reviewers to review this pull-request labels Jan 18, 2024
@alxbilger
Copy link
Contributor Author

[ci-build][with-all-tests]

@alxbilger
Copy link
Contributor Author

alxbilger commented Jan 19, 2024

The call stack of the runtime error on Linux is the following:

########## SIG 6 - SIGABRT: usually caused by an abort() or assert() ##########
  sofa::helper::BackTrace::sig(int)
  pthread_kill
  raise
  abort
  free
  std::__new_allocator<int>::deallocate(int*, unsigned long)
  std::_Vector_base<int, std::allocator<int> >::_M_deallocate(int*, unsigned long)
  std::_Vector_base<int, std::allocator<int> >::~_Vector_base()
  std::vector<int, std::allocator<int> >::~vector()
  sofa::type::vector<int, sofa::type::CPUMemoryManager<int> >::~vector()
  sofa::linearalgebra::CompressedRowSparseMatrixGeneric<double, sofa::linearalgebra::CRSMechanicalPolicy>::~CompressedRowSparseMatrixGeneric()
  sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy>::~CompressedRowSparseMatrixMechanical()
  void std::_Destroy<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> >(sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy>*)
  std::_Sp_counted_ptr_inplace<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy>, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_M_dispose()
  std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release()
  std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count()
  std::__shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy>, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr()
  std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> >::~shared_ptr()
  std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > >::~pair()
  std::_Rb_tree<sofa::core::behavior::BaseMechanicalState*, std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > >, std::_Select1st<std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > > >, std::less<sofa::core::behavior::BaseMechanicalState*>, std::allocator<std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > > > >::_M_destroy_node(std::_Rb_tree_node<std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > > >*)
  std::_Rb_tree<sofa::core::behavior::BaseMechanicalState*, std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > >, std::_Select1st<std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > > >, std::less<sofa::core::behavior::BaseMechanicalState*>, std::allocator<std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > > > >::_M_drop_node(std::_Rb_tree_node<std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > > >*)
  std::_Rb_tree<sofa::core::behavior::BaseMechanicalState*, std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > >, std::_Select1st<std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > > >, std::less<sofa::core::behavior::BaseMechanicalState*>, std::allocator<std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > > > >::_M_erase(std::_Rb_tree_node<std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > > >*)
  std::_Rb_tree<sofa::core::behavior::BaseMechanicalState*, std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > >, std::_Select1st<std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > > >, std::less<sofa::core::behavior::BaseMechanicalState*>, std::allocator<std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > > > >::_M_erase(std::_Rb_tree_node<std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > > >*)
  std::_Rb_tree<sofa::core::behavior::BaseMechanicalState*, std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > >, std::_Select1st<std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > > >, std::less<sofa::core::behavior::BaseMechanicalState*>, std::allocator<std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > > > >::~_Rb_tree()
  std::map<sofa::core::behavior::BaseMechanicalState*, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> >, std::less<sofa::core::behavior::BaseMechanicalState*>, std::allocator<std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > > > >::~map()
  sofa::component::linearsystem::MappingJacobians<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> >::~MappingJacobians()
  sofa::component::linearsystem::MatrixLinearSystem<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy>, sofa::linearalgebra::FullVector<double> >::projectMappedMatrices(sofa::core::MechanicalParams const*)
  sofa::component::linearsystem::MatrixLinearSystem<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy>, sofa::linearalgebra::FullVector<double> >::assembleMappedMatrices(sofa::core::MechanicalParams const*)
  sofa::component::linearsystem::MatrixLinearSystem<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy>, sofa::linearalgebra::FullVector<double> >::assembleSystem(sofa::core::MechanicalParams const*)
  sofa::core::behavior::BaseMatrixLinearSystem::buildSystemMatrix(sofa::core::MechanicalParams const*)
  sofa::component::linearsolver::MatrixLinearSolver<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy>, sofa::linearalgebra::FullVector<double>, sofa::component::linearsolver::NoThreadManager>::setSystemMBKMatrix(sofa::core::MechanicalParams const*)
  sofa::simulation::common::MechanicalOperations::m_setSystemMBKMatrix(double, double, double)
  sofa::core::behavior::MultiMatrix<sofa::simulation::common::MechanicalOperations>::setSystemMBKMatrix(sofa::core::behavior::MechanicalMatrix const&)
  sofa::component::odesolver::backward::EulerImplicitSolver::solve(sofa::core::ExecParams const*, double, sofa::core::TMultiVecId<(sofa::core::VecType)1, (sofa::core::VecAccess)1>, sofa::core::TMultiVecId<(sofa::core::VecType)2, (sofa::core::VecAccess)1>)
  sofa::simulation::SolveVisitor::processSolver(sofa::simulation::Node*, sofa::core::behavior::OdeSolver*)
  void sofa::simulation::Visitor::runVisitorTask<sofa::simulation::SolveVisitor, sofa::simulation::Node, sofa::core::behavior::OdeSolver>(sofa::simulation::SolveVisitor*, sofa::simulation::Node*, void (sofa::simulation::SolveVisitor::*)(sofa::simulation::Node*, sofa::core::behavior::OdeSolver*), sofa::core::behavior::OdeSolver*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
  void sofa::simulation::Visitor::for_each<sofa::simulation::SolveVisitor, sofa::simulation::Node, sofa::simulation::NodeSequence<sofa::core::behavior::OdeSolver, false>, sofa::core::behavior::OdeSolver>(sofa::simulation::SolveVisitor*, sofa::simulation::Node*, sofa::simulation::NodeSequence<sofa::core::behavior::OdeSolver, false> const&, void (sofa::simulation::SolveVisitor::*)(sofa::simulation::Node*, sofa::core::behavior::OdeSolver*), std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
  sofa::simulation::SolveVisitor::sequentialSolve(sofa::simulation::Node*)
  sofa::simulation::SolveVisitor::processNodeTopDown(sofa::simulation::Node*)
  sofa::simulation::graph::DAGNode::executeVisitorTopDown(sofa::simulation::Visitor*, std::__cxx11::list<sofa::simulation::graph::DAGNode*, std::allocator<sofa::simulation::graph::DAGNode*> >&, std::map<sofa::simulation::graph::DAGNode*, sofa::simulation::graph::DAGNode::StatusStruct, std::less<sofa::simulation::graph::DAGNode*>, std::allocator<std::pair<sofa::simulation::graph::DAGNode* const, sofa::simulation::graph::DAGNode::StatusStruct> > >&, sofa::simulation::graph::DAGNode*)
  sofa::simulation::graph::DAGNode::executeVisitorTopDown(sofa::simulation::Visitor*, std::__cxx11::list<sofa::simulation::graph::DAGNode*, std::allocator<sofa::simulation::graph::DAGNode*> >&, std::map<sofa::simulation::graph::DAGNode*, sofa::simulation::graph::DAGNode::StatusStruct, std::less<sofa::simulation::graph::DAGNode*>, std::allocator<std::pair<sofa::simulation::graph::DAGNode* const, sofa::simulation::graph::DAGNode::StatusStruct> > >&, sofa::simulation::graph::DAGNode*)
  sofa::simulation::graph::DAGNode::doExecuteVisitor(sofa::simulation::Visitor*, bool)
  sofa::simulation::Node::executeVisitor(sofa::simulation::Visitor*, bool)
  sofa::simulation::Node::execute(sofa::simulation::Visitor*, bool)
  sofa::component::animationloop::FreeMotionAnimationLoop::computeFreeMotion(sofa::core::ExecParams const*, sofa::core::ConstraintParams const&, double, sofa::core::TMultiVecId<(sofa::core::VecType)0, (sofa::core::VecAccess)1>, sofa::core::TMultiVecId<(sofa::core::VecType)0, (sofa::core::VecAccess)1>, sofa::core::TMultiVecId<(sofa::core::VecType)2, (sofa::core::VecAccess)1>, sofa::simulation::common::MechanicalOperations*)
  sofa::component::animationloop::FreeMotionAnimationLoop::computeFreeMotionAndCollisionDetection(sofa::core::ExecParams const*, sofa::core::ConstraintParams const&, double, sofa::core::TMultiVecId<(sofa::core::VecType)0, (sofa::core::VecAccess)1>, sofa::core::TMultiVecId<(sofa::core::VecType)0, (sofa::core::VecAccess)1>, sofa::core::TMultiVecId<(sofa::core::VecType)2, (sofa::core::VecAccess)1>, sofa::simulation::common::MechanicalOperations*)
  sofa::component::animationloop::FreeMotionAnimationLoop::step(sofa::core::ExecParams const*, double)
  sofa::simulation::node::animate(sofa::simulation::Node*, double)
  sofa::gui::batch::BatchGUI::mainLoop()
  sofa::gui::common::GUIManager::MainLoop(boost::intrusive_ptr<sofa::simulation::Node>, char const*)
  __libc_start_main

and with GDB:

double free or corruption (out)

Program received signal SIGABRT, Aborted.
__pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:44
Download failed: Invalid argument.  Continuing without source file ./nptl/./nptl/pthread_kill.c.                       
44	./nptl/pthread_kill.c: No such file or directory.
(gdb) where
#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3  0x00007ffff5242866 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x00007ffff52268b7 in __GI_abort () at ./stdlib/abort.c:79
#5  0x00007ffff5227750 in __libc_message (fmt=fmt@entry=0x7ffff53c3b34 "%s\n") at ../sysdeps/posix/libc_fatal.c:150
#6  0x00007ffff52a3c67 in malloc_printerr (str=str@entry=0x7ffff53c6a20 "double free or corruption (out)")
    at ./malloc/malloc.c:5765
#7  0x00007ffff52a5c50 in _int_free_merge_chunk (av=0x7ffff53feca0 <main_arena>, p=0x5555567f2740, size=2619930050800)
    at ./malloc/malloc.c:4669
#8  0x00007ffff52a87f3 in __GI___libc_free (mem=<optimized out>) at ./malloc/malloc.c:3391
#9  0x00007ffff79b94db in std::__new_allocator<int>::deallocate (this=0x5555567f23c8, __p=0x5555567f2750, __n=57)
    at /usr/include/c++/13/bits/new_allocator.h:168
#10 0x00007ffff79ae098 in std::allocator_traits<std::allocator<int> >::deallocate (__n=57, __p=0x5555567f2750, 
    __a=...) at /usr/include/c++/13/bits/alloc_traits.h:516
#11 std::_Vector_base<int, std::allocator<int> >::_M_deallocate (this=0x5555567f23c8, __p=0x5555567f2750, __n=57)
    at /usr/include/c++/13/bits/stl_vector.h:387
#12 0x00007ffff79a8bde in std::_Vector_base<int, std::allocator<int> >::~_Vector_base (this=0x5555567f23c8, 
    __in_chrg=<optimized out>) at /usr/include/c++/13/bits/stl_vector.h:366
#13 0x00007ffff79a4b8b in std::vector<int, std::allocator<int> >::~vector (this=0x5555567f23c8, 
    __in_chrg=<optimized out>) at /usr/include/c++/13/bits/stl_vector.h:735
#14 0x00007ffff5caf956 in sofa::type::vector<int, sofa::type::CPUMemoryManager<int> >::~vector (this=0x5555567f23c8, 
    __in_chrg=<optimized out>) at /home/alex/Documents/sofa/Sofa/framework/Type/src/sofa/type/vector_T.h:55
#15 0x00007ffff3b58ba2 in sofa::linearalgebra::CompressedRowSparseMatrixGeneric<double, sofa::linearalgebra::CRSMechanicalPolicy>::~CompressedRowSparseMatrixGeneric (this=0x5555567f2310, __in_chrg=<optimized out>)
    at /home/alex/Documents/sofa/Sofa/framework/LinearAlgebra/src/sofa/linearalgebra/CompressedRowSparseMatrixGeneric.h:246
#16 0x00007ffff3b58fff in sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy>::~CompressedRowSparseMatrixMechanical (this=0x5555567f2310, __in_chrg=<optimized out>)
    at /home/alex/Documents/sofa/Sofa/framework/LinearAlgebra/src/sofa/linearalgebra/CompressedRowSparseMatrixMechanical.h:51
#17 0x00007fffeafdc335 in std::_Destroy<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > (__pointer=0x5555567f2310) at /usr/include/c++/13/bits/stl_construct.h:151
--Type <RET> for more, q to quit, c to continue without paging--
#18 0x00007fffeafc247e in std::allocator_traits<std::allocator<void> >::destroy<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > (__p=0x5555567f2310)
    at /usr/include/c++/13/bits/alloc_traits.h:674
#19 std::_Sp_counted_ptr_inplace<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy>, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_M_dispose (this=0x5555567f2300)
    at /usr/include/c++/13/bits/shared_ptr_base.h:613
#20 0x00005555555c9ad5 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (this=0x5555567f2300)
    at /usr/include/c++/13/bits/shared_ptr_base.h:346
#21 0x00005555555cb9f5 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count (this=0x5555566c0330, 
    __in_chrg=<optimized out>) at /usr/include/c++/13/bits/shared_ptr_base.h:1071
#22 0x00007fffeaeb0346 in std::__shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy>, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr (this=0x5555566c0328, 
    __in_chrg=<optimized out>) at /usr/include/c++/13/bits/shared_ptr_base.h:1524
#23 0x00007fffeaeb03ce in std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> >::~shared_ptr (this=0x5555566c0328, __in_chrg=<optimized out>)
    at /usr/include/c++/13/bits/shared_ptr.h:175
#24 0x00007fffeaf9492a in std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > >::~pair (
    this=0x5555566c0320, __in_chrg=<optimized out>) at /usr/include/c++/13/bits/stl_pair.h:187
#25 0x00007fffeaf63fa2 in std::__new_allocator<std::_Rb_tree_node<std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > > > >::destroy<std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > > > (
    __p=0x5555566c0320, this=0x7fffffffabc8) at /usr/include/c++/13/bits/new_allocator.h:194
#26 std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > > > > >::destroy<std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > > > (__p=0x5555566c0320, 
    __a=...) at /usr/include/c++/13/bits/alloc_traits.h:557
#27 std::_Rb_tree<sofa::core::behavior::BaseMechanicalState*, std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > >, std::_Select1st<std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > > >, std::less<sofa::core--Type <RET> for more, q to quit, c to continue without paging--
::behavior::BaseMechanicalState*>, std::allocator<std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > > > >::_M_destroy_node (this=0x7fffffffabc8, __p=0x5555566c0300) at /usr/include/c++/13/bits/stl_tree.h:625
#28 0x00007fffeaf405ab in std::_Rb_tree<sofa::core::behavior::BaseMechanicalState*, std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > >, std::_Select1st<std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > > >, std::less<sofa::core::behavior::BaseMechanicalState*>, std::allocator<std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > > > >::_M_drop_node (this=0x7fffffffabc8, __p=0x5555566c0300)
    at /usr/include/c++/13/bits/stl_tree.h:633
#29 0x00007fffeaf15b79 in std::_Rb_tree<sofa::core::behavior::BaseMechanicalState*, std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > >, std::_Select1st<std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > > >, std::less<sofa::core::behavior::BaseMechanicalState*>, std::allocator<std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > > > >::_M_erase (this=0x7fffffffabc8, __x=0x5555566c0300)
    at /usr/include/c++/13/bits/stl_tree.h:1938
#30 0x00007fffeaf15b56 in std::_Rb_tree<sofa::core::behavior::BaseMechanicalState*, std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > >, std::_Select1st<std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > > >, std::less<sofa::core::behavior::BaseMechanicalState*>, std::allocator<std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > > > >::_M_erase (this=0x7fffffffabc8, __x=0x5555566c2750)
    at /usr/include/c++/13/bits/stl_tree.h:1936
#31 0x00007fffeaec4e58 in std::_Rb_tree<sofa::core::behavior::BaseMechanicalState*, std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > >, std::_Select1st<std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > > >, std::less<sofa::core::behavior::BaseMechanicalState*>, std::allocator<std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSM--Type <RET> for more, q to quit, c to continue without paging--
echanicalPolicy> > > > >::~_Rb_tree (this=0x7fffffffabc8, __in_chrg=<optimized out>)
    at /usr/include/c++/13/bits/stl_tree.h:986
#32 0x00007fffeaeb0f4e in std::map<sofa::core::behavior::BaseMechanicalState*, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> >, std::less<sofa::core::behavior::BaseMechanicalState*>, std::allocator<std::pair<sofa::core::behavior::BaseMechanicalState* const, std::shared_ptr<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> > > > >::~map (
    this=0x7fffffffabc8, __in_chrg=<optimized out>) at /usr/include/c++/13/bits/stl_map.h:314
#33 0x00007fffeaeb0f72 in sofa::component::linearsystem::MappingJacobians<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy> >::~MappingJacobians (this=0x7fffffffabc0, 
    __in_chrg=<optimized out>)
    at /home/alex/Documents/sofa/Sofa/Component/LinearSystem/src/sofa/component/linearsystem/MappingGraph.h:152
#34 0x00007fffeae78798 in sofa::component::linearsystem::MatrixLinearSystem<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy>, sofa::linearalgebra::FullVector<double> >::projectMappedMatrices (this=0x5555560c5fb0, mparams=0x7fffffffb750)
    at /home/alex/Documents/sofa/Sofa/Component/LinearSystem/src/sofa/component/linearsystem/MatrixLinearSystem.inl:974
#35 0x00007fffeae791d8 in sofa::component::linearsystem::MatrixLinearSystem<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy>, sofa::linearalgebra::FullVector<double> >::assembleMappedMatrices (this=0x5555560c5fb0, mparams=0x7fffffffb750)
    at /home/alex/Documents/sofa/Sofa/Component/LinearSystem/src/sofa/component/linearsystem/MatrixLinearSystem.inl:1100



#36 0x00007fffeae75834 in sofa::component::linearsystem::MatrixLinearSystem<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy>, sofa::linearalgebra::FullVector<double> >::assembleSystem (this=0x5555560c5fb0, mparams=0x7fffffffb750)
    at /home/alex/Documents/sofa/Sofa/Component/LinearSystem/src/sofa/component/linearsystem/MatrixLinearSystem.inl:225
#37 0x00007ffff6baca56 in sofa::core::behavior::BaseMatrixLinearSystem::buildSystemMatrix (this=0x5555560c5fb0, 
    mparams=0x7fffffffb750)
    at /home/alex/Documents/sofa/Sofa/framework/Core/src/sofa/core/behavior/BaseMatrixLinearSystem.cpp:37
#38 0x00007fffea0e84f4 in sofa::component::linearsolver::MatrixLinearSolver<sofa::linearalgebra::CompressedRowSparseMatrixMechanical<double, sofa::linearalgebra::CRSMechanicalPolicy>, sofa::linearalgebra::FullVector<double>, sofa::component::linearsolver::NoThreadManager>::setSystemMBKMatrix (this=0x555555e2eb50, mparams=0x7fffffffb750)
    at /home/alex/Documents/sofa/Sofa/Component/LinearSolver/Iterative/src/sofa/component/linearsolver/iterative/Matrix--Type <RET> for more, q to quit, c to continue without paging--
LinearSolver.inl:268
#39 0x00007ffff749d574 in sofa::simulation::common::MechanicalOperations::m_setSystemMBKMatrix (this=0x7fffffffb750, 
    mFact=1, bFact=-0.01, kFact=-0.00060000000000000006)
    at /home/alex/Documents/sofa/Sofa/framework/Simulation/Core/src/sofa/simulation/MechanicalOperations.cpp:455
#40 0x00007fffebdcc032 in sofa::core::behavior::MultiMatrix<sofa::simulation::common::MechanicalOperations>::setSystemMBKMatrix (this=0x7fffffffb520, m=...)
    at /home/alex/Documents/sofa/Sofa/framework/Core/src/sofa/core/behavior/MultiMatrix.h:68
#41 0x00007fffebd289fa in sofa::component::odesolver::backward::EulerImplicitSolver::solve (this=0x555555e2be90, 
    params=0x555555e65700, dt=0.01, xResult=..., vResult=...)
    at /home/alex/Documents/sofa/Sofa/Component/ODESolver/Backward/src/sofa/component/odesolver/backward/EulerImplicitSolver.cpp:157
#42 0x00007ffff756e5a0 in sofa::simulation::SolveVisitor::processSolver (this=0x7fffffffc430, node=0x555555e275c0, 
    s=0x555555e2be90)
    at /home/alex/Documents/sofa/Sofa/framework/Simulation/Core/src/sofa/simulation/SolveVisitor.cpp:38
#43 0x00007ffff756fe25 in sofa::simulation::Visitor::runVisitorTask<sofa::simulation::SolveVisitor, sofa::simulation::Node, sofa::core::behavior::OdeSolver> (this=0x7fffffffc430, visitor=0x7fffffffc430, ctx=0x555555e275c0, 
    task=&virtual sofa::simulation::SolveVisitor::processSolver(sofa::simulation::Node*, sofa::core::behavior::OdeSolver*), ptr=0x555555e2be90, typeInfo="type")
    at /home/alex/Documents/sofa/Sofa/framework/Simulation/Core/src/sofa/simulation/Visitor.h:248
#44 0x00007ffff756fa2b in sofa::simulation::Visitor::for_each<sofa::simulation::SolveVisitor, sofa::simulation::Node, sofa::simulation::NodeSequence<sofa::core::behavior::OdeSolver, false>, sofa::core::behavior::OdeSolver> (
    this=0x7fffffffc430, visitor=0x7fffffffc430, ctx=0x555555e275c0, list=..., 
    task=&virtual sofa::simulation::SolveVisitor::processSolver(sofa::simulation::Node*, sofa::core::behavior::OdeSolver*), typeInfo="type") at /home/alex/Documents/sofa/Sofa/framework/Simulation/Core/src/sofa/simulation/Visitor.h:288
#45 0x00007ffff756eee5 in sofa::simulation::SolveVisitor::sequentialSolve (this=0x7fffffffc430, node=0x555555e275c0)
    at /home/alex/Documents/sofa/Sofa/framework/Simulation/Core/src/sofa/simulation/SolveVisitor.cpp:138
#46 0x00007ffff756e85a in sofa::simulation::SolveVisitor::processNodeTopDown (this=0x7fffffffc430, 
    node=0x555555e275c0)
    at /home/alex/Documents/sofa/Sofa/framework/Simulation/Core/src/sofa/simulation/SolveVisitor.cpp:61
#47 0x00007ffff7f7e76e in sofa::simulation::graph::DAGNode::executeVisitorTopDown (this=0x555555e275c0, 
    action=0x7fffffffc430, executedNodes=std::__cxx11::list = {...}, statusMap=std::map with 7 elements = {...}, 
    visitorRoot=0x555555dabc80)
    at /home/alex/Documents/sofa/Sofa/framework/Simulation/Graph/src/sofa/simulation/graph/DAGNode.cpp:685
--Type <RET> for more, q to quit, c to continue without paging--
#48 0x00007ffff7f7e92c in sofa::simulation::graph::DAGNode::executeVisitorTopDown (this=0x555555dabc80, 
    action=0x7fffffffc430, executedNodes=std::__cxx11::list = {...}, statusMap=std::map with 7 elements = {...}, 
    visitorRoot=0x555555dabc80)
    at /home/alex/Documents/sofa/Sofa/framework/Simulation/Graph/src/sofa/simulation/graph/DAGNode.cpp:698

#49 0x00007ffff7f7ddfa in sofa::simulation::graph::DAGNode::doExecuteVisitor (this=0x555555dabc80, 
    action=0x7fffffffc430, precomputedOrder=false)
    at /home/alex/Documents/sofa/Sofa/framework/Simulation/Graph/src/sofa/simulation/graph/DAGNode.cpp:607
#50 0x00007ffff74b0032 in sofa::simulation::Node::executeVisitor (this=0x555555dabc80, action=0x7fffffffc430, 
    precomputedOrder=false)
    at /home/alex/Documents/sofa/Sofa/framework/Simulation/Core/src/sofa/simulation/Node.cpp:894
#51 0x00007ffff746728a in sofa::simulation::Node::execute (this=0x555555dabc80, p=0x7fffffffc430, 
    precomputedOrder=false) at /home/alex/Documents/sofa/Sofa/framework/Simulation/Core/src/sofa/simulation/Node.h:197
#52 0x00007fffea5a3ae0 in sofa::component::animationloop::FreeMotionAnimationLoop::computeFreeMotion (
    this=0x555555e33ff0, params=0x555555e65700, cparams=..., dt=0.01, pos=..., freePos=..., freeVel=..., 
    mop=0x7fffffffcaa0)
    at /home/alex/Documents/sofa/Sofa/Component/AnimationLoop/src/sofa/component/animationloop/FreeMotionAnimationLoop.cpp:388
#53 0x00007fffea5a3362 in sofa::component::animationloop::FreeMotionAnimationLoop::computeFreeMotionAndCollisionDetection (this=0x555555e33ff0, params=0x555555e65700, cparams=..., dt=0.01, pos=..., freePos=..., freeVel=..., 
    mop=0x7fffffffcaa0)
    at /home/alex/Documents/sofa/Sofa/Component/AnimationLoop/src/sofa/component/animationloop/FreeMotionAnimationLoop.cpp:328
#54 0x00007fffea5a1f77 in sofa::component::animationloop::FreeMotionAnimationLoop::step (this=0x555555e33ff0, 
    params=0x555555e65700, dt=0.01)
    at /home/alex/Documents/sofa/Sofa/Component/AnimationLoop/src/sofa/component/animationloop/FreeMotionAnimationLoop.cpp:254
#55 0x00007ffff7568933 in sofa::simulation::node::animate (root=0x555555dabc80, dt=0)
    at /home/alex/Documents/sofa/Sofa/framework/Simulation/Core/src/sofa/simulation/Simulation.cpp:221
#56 0x00007ffff7ea5e4e in sofa::gui::batch::BatchGUI::mainLoop (this=0x555555637050)
    at /home/alex/Documents/sofa/Sofa/GUI/Batch/src/sofa/gui/batch/BatchGUI.cpp:72
#57 0x00007ffff795ae2e in sofa::gui::common::GUIManager::MainLoop (groot=..., 
    filename=0x555555dab770 "../../sofa/applications/plugins/SoftRobots/examples/tutorials/Tripod/details/step4-3.py")
    at /home/alex/Documents/sofa/Sofa/GUI/Common/src/sofa/gui/common/GUIManager.cpp:288
--Type <RET> for more, q to quit, c to continue without paging--
#58 0x00005555555c6bb5 in main (argc=6, argv=0x7fffffffdf28)
    at /home/alex/Documents/sofa/applications/projects/runSofa/Main.cpp:526

@hugtalbot hugtalbot added pr: status ready Approved a pull-request, ready to be squashed and removed pr: status to review To notify reviewers to review this pull-request labels Jan 24, 2024
@fredroy fredroy merged commit d3d20a1 into sofa-framework:master Jan 25, 2024
9 of 11 checks passed
@bakpaul bakpaul added this to the v24.06 milestone Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement About a possible enhancement pr: status ready Approved a pull-request, ready to be squashed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants