opensim-org / opensim-moco

Solve optimal control problems for musculoskeletal models using OpenSim and direct collocation.
https://opensim.stanford.edu/moco
Apache License 2.0
56 stars 15 forks source link

Try CasADi just-in-time compilation #456

Open chrisdembia opened 4 years ago

chrisdembia commented 4 years ago

Using CasADi's JIT is essential for using autodiff with OpenSim and CasADi. As a first step, we could toy around with CasADi's JIT without OpenSim.

This requires compiling Clang from source with -DWITH_CLANG=ON. I've tried this but CasADi struggles to find Clang.

cc @antoinefalisse

chrisdembia commented 4 years ago

I can get CMake to proceed further by first setting the environment variable CLANG to /usr/local/Cellar/llvm/9.0.0.

Now, I get a bunch of undefined symbols related to Clang.

Undefined symbols for architecture x86_64:
  "clang::ast_matchers::MatchFinder::addMatcher(clang::ast_matchers::internal::Matcher<clang::Stmt> const&, clang::ast_matchers::MatchFinder::MatchCallback*)", referenced from:
      llvm::SmallVector<clang::ast_matchers::BoundNodes, 1u> clang::ast_matchers::match<clang::ast_matchers::internal::Matcher<clang::Stmt> >(clang::ast_matchers::internal::Matcher<clang::Stmt>, clang::ast_type_traits::DynTypedNode const&, clang::ASTContext&) in libclangAnalysis.a(ExprMutationAnalyzer.cpp.o)
      llvm::SmallVector<clang::ast_matchers::BoundNodes, 1u> clang::ast_matchers::match<clang::ast_matchers::internal::BindableMatcher<clang::Stmt> >(clang::ast_matchers::internal::BindableMatcher<clang::Stmt>, clang::ast_type_traits::DynTypedNode const&, clang::ASTContext&) in libclangAnalysis.a(ExprMutationAnalyzer.cpp.o)
  "clang::ast_matchers::MatchFinder::MatchCallback::~MatchCallback()", referenced from:
      llvm::SmallVector<clang::ast_matchers::BoundNodes, 1u> clang::ast_matchers::match<clang::ast_matchers::internal::Matcher<clang::Stmt> >(clang::ast_matchers::internal::Matcher<clang::Stmt>, clang::ast_type_traits::DynTypedNode const&, clang::ASTContext&) in libclangAnalysis.a(ExprMutationAnalyzer.cpp.o)
      clang::ast_matchers::internal::CollectMatchesCallback::~CollectMatchesCallback() in libclangAnalysis.a(ExprMutationAnalyzer.cpp.o)
      clang::ast_matchers::internal::CollectMatchesCallback::~CollectMatchesCallback() in libclangAnalysis.a(ExprMutationAnalyzer.cpp.o)
      llvm::SmallVector<clang::ast_matchers::BoundNodes, 1u> clang::ast_matchers::match<clang::ast_matchers::internal::BindableMatcher<clang::Stmt> >(clang::ast_matchers::internal::BindableMatcher<clang::Stmt>, clang::ast_type_traits::DynTypedNode const&, clang::ASTContext&) in libclangAnalysis.a(ExprMutationAnalyzer.cpp.o)
  "clang::ast_matchers::MatchFinder::match(clang::ast_type_traits::DynTypedNode const&, clang::ASTContext&)", referenced from:
      llvm::SmallVector<clang::ast_matchers::BoundNodes, 1u> clang::ast_matchers::match<clang::ast_matchers::internal::Matcher<clang::Stmt> >(clang::ast_matchers::internal::Matcher<clang::Stmt>, clang::ast_type_traits::DynTypedNode const&, clang::ASTContext&) in libclangAnalysis.a(ExprMutationAnalyzer.cpp.