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

Eigen version Clash when POLYSOLVE_WITH_ACCELERATE enabled #240

Open
zfergus opened this issue Aug 20, 2023 · 5 comments
Open

Eigen version Clash when POLYSOLVE_WITH_ACCELERATE enabled #240

zfergus opened this issue Aug 20, 2023 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@zfergus
Copy link
Member

zfergus commented Aug 20, 2023

There is an issue with conflicting versions of Eigen when this option is enabled.

I get this compilation error:

In file included from /Users/zachary/.cache/CPM/ipc-toolkit/ff96ec46f901ecdd6203d75076174d996a5eae0d/src/ipc/friction/constraints/friction_constraint.cpp:1:
In file included from /Users/zachary/.cache/CPM/ipc-toolkit/ff96ec46f901ecdd6203d75076174d996a5eae0d/src/ipc/friction/constraints/friction_constraint.hpp:3:
In file included from /Users/zachary/.cache/CPM/ipc-toolkit/ff96ec46f901ecdd6203d75076174d996a5eae0d/src/ipc/collisions/collision_constraints.hpp:3:
In file included from /Users/zachary/.cache/CPM/ipc-toolkit/ff96ec46f901ecdd6203d75076174d996a5eae0d/src/ipc/collision_mesh.hpp:5:
In file included from /Users/zachary/.cache/CPM/eigen/2e68522bbe453e136c9b281a06f112155cbeafd8/Eigen/Core:329:
/Users/zachary/.cache/CPM/eigen/2e68522bbe453e136c9b281a06f112155cbeafd8/Eigen/src/Core/IndexedView.h:148:14: error: data member instantiated with function type 'bool ()'
  ColIndices m_colIndices;
             ^
/Users/zachary/.cache/CPM/ipc-toolkit/ff96ec46f901ecdd6203d75076174d996a5eae0d/src/ipc/friction/constraints/friction_constraint.cpp:284:25: note: in instantiation of template class 'Eigen::IndexedView<const Eigen::Matrix<double, -1, -1, 0, 6, 12>, Eigen::ArithmeticSequence<long, long, long>, bool ()>' requested here
                        jac_Gamma_wrt_beta(
                        ^
/Users/zachary/.cache/CPM/ipc-toolkit/ff96ec46f901ecdd6203d75076174d996a5eae0d/src/ipc/friction/constraints/friction_constraint.cpp:285:63: error: no member named 'all' in namespace 'Eigen'; did you mean 'Eigen::indexing::all'?
                            Eigen::seqN(i, beta.size(), dim), Eigen::all)
                                                              ^~~~~~~~~~
                                                              Eigen::indexing::all
/Users/zachary/.cache/CPM/eigen/2e68522bbe453e136c9b281a06f112155cbeafd8/Eigen/src/Core/ArithmeticSequence.h:250:30: note: 'Eigen::indexing::all' declared here
  using Eigen::placeholders::all;
                             ^
In file included from /Users/zachary/.cache/CPM/ipc-toolkit/ff96ec46f901ecdd6203d75076174d996a5eae0d/src/ipc/friction/constraints/friction_constraint.cpp:1:
In file included from /Users/zachary/.cache/CPM/ipc-toolkit/ff96ec46f901ecdd6203d75076174d996a5eae0d/src/ipc/friction/constraints/friction_constraint.hpp:3:
In file included from /Users/zachary/.cache/CPM/ipc-toolkit/ff96ec46f901ecdd6203d75076174d996a5eae0d/src/ipc/collisions/collision_constraints.hpp:3:
In file included from /Users/zachary/.cache/CPM/ipc-toolkit/ff96ec46f901ecdd6203d75076174d996a5eae0d/src/ipc/collision_mesh.hpp:5:
In file included from /Users/zachary/.cache/CPM/eigen/2e68522bbe453e136c9b281a06f112155cbeafd8/Eigen/Core:290:
In file included from /Users/zachary/.cache/CPM/eigen/2e68522bbe453e136c9b281a06f112155cbeafd8/Eigen/src/Core/DenseBase.h:662:
/Users/zachary/.cache/CPM/eigen/2e68522bbe453e136c9b281a06f112155cbeafd8/Eigen/src/Core/util/../../plugins/IndexedViewMethods.h:63:73: error: no matching member function for call to 'ivcCol'
    return ConstReturnType(derived, derived.ivcRow(rowIndices), derived.ivcCol(colIndices));
                                                                ~~~~~~~~^~~~~~
/Users/zachary/.cache/CPM/eigen/2e68522bbe453e136c9b281a06f112155cbeafd8/Eigen/src/Core/util/../../plugins/IndexedViewMethods.h:239:55: note: in instantiation of member function 'Eigen::DenseBase<Eigen::Matrix<double, -1, -1, 0, 6, 12>>::IndexedViewSelector<Eigen::ArithmeticSequence<long, long, long>, bool (), false, false, true>::run' requested here
  return IndexedViewSelector<RowIndices, ColIndices>::run(derived(), rowIndices, colIndices);
                                                      ^
/Users/zachary/.cache/CPM/ipc-toolkit/ff96ec46f901ecdd6203d75076174d996a5eae0d/src/ipc/friction/constraints/friction_constraint.cpp:284:25: note: in instantiation of function template specialization 'Eigen::DenseBase<Eigen::Matrix<double, -1, -1, 0, 6, 12>>::operator()<Eigen::ArithmeticSequence<long, long, long>, bool (), true>' requested here
                        jac_Gamma_wrt_beta(
                        ^
/Users/zachary/.cache/CPM/eigen/2e68522bbe453e136c9b281a06f112155cbeafd8/Eigen/src/Core/util/../../plugins/IndexedViewMethods.h:34:28: note: candidate template ignored: substitution failure [with Indices = bool ()]: function cannot return function type 'IvcColType<bool ()>' (aka 'bool ()')
inline IvcColType<Indices> ivcCol(const Indices& indices) const {
       ~~~~~~~~~~          ^
3 errors generated.
make[2]: *** [_deps/ipc-toolkit-build/CMakeFiles/ipc_toolkit.dir/src/ipc/friction/constraints/friction_constraint.cpp.o] Error 1
make[1]: *** [_deps/ipc-toolkit-build/CMakeFiles/ipc_toolkit.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

Originally posted by @zfergus in #239 (comment)

@zfergus zfergus mentioned this issue Aug 20, 2023
@zfergus
Copy link
Member Author

zfergus commented Sep 18, 2023

Through some clever rewrites of the Jacobian calculation done in the IPC Toolkit (ipc-sim/ipc-toolkit#56), I can now compile the IPC Toolkit with the newer Eigen. Unfortunately, it hits a snag when it needs to compile libigl:

[ 74%] Building CXX object CMakeFiles/polyfem.dir/src/polyfem/basis/PolygonalBasis3d.cpp.o
In file included from /Users/zachary/Development/research/polyfem/polyfem/src/polyfem/basis/PolygonalBasis3d.cpp:18:
In file included from /Users/zachary/.cache/CPM/libigl/121135a7e89a917cf11e894acdbecd58f5460544/include/igl/per_vertex_normals.h:77:
In file included from /Users/zachary/.cache/CPM/libigl/121135a7e89a917cf11e894acdbecd58f5460544/include/igl/per_vertex_normals.cpp:11:
In file included from /Users/zachary/.cache/CPM/libigl/121135a7e89a917cf11e894acdbecd58f5460544/include/igl/per_face_normals.h:76:
In file included from /Users/zachary/.cache/CPM/libigl/121135a7e89a917cf11e894acdbecd58f5460544/include/igl/per_face_normals.cpp:104:
In file included from /Users/zachary/.cache/CPM/libigl/121135a7e89a917cf11e894acdbecd58f5460544/include/igl/cotmatrix.h:79:
In file included from /Users/zachary/.cache/CPM/libigl/121135a7e89a917cf11e894acdbecd58f5460544/include/igl/cotmatrix.cpp:84:
In file included from /Users/zachary/.cache/CPM/libigl/121135a7e89a917cf11e894acdbecd58f5460544/include/igl/diag.h:59:
/Users/zachary/.cache/CPM/libigl/121135a7e89a917cf11e894acdbecd58f5460544/include/igl/diag.cpp:75:10: error: no member named 'DynamicSparseMatrix' in namespace 'Eigen'
  Eigen::DynamicSparseMatrix<T, Eigen::RowMajor> dyn_X(V.size(),V.size());
  ~~~~~~~^
/Users/zachary/.cache/CPM/libigl/121135a7e89a917cf11e894acdbecd58f5460544/include/igl/diag.cpp:75:30: error: 'T' does not refer to a value
  Eigen::DynamicSparseMatrix<T, Eigen::RowMajor> dyn_X(V.size(),V.size());
                             ^
/Users/zachary/.cache/CPM/libigl/121135a7e89a917cf11e894acdbecd58f5460544/include/igl/diag.cpp:69:20: note: declared here
template <typename T>
                   ^
/Users/zachary/.cache/CPM/libigl/121135a7e89a917cf11e894acdbecd58f5460544/include/igl/diag.cpp:76:3: error: use of undeclared identifier 'dyn_X'
  dyn_X.reserve(V.size());
  ^
/Users/zachary/.cache/CPM/libigl/121135a7e89a917cf11e894acdbecd58f5460544/include/igl/diag.cpp:80:5: error: use of undeclared identifier 'dyn_X'
    dyn_X.coeffRef(it.index(),it.index()) += it.value();
    ^
/Users/zachary/.cache/CPM/libigl/121135a7e89a917cf11e894acdbecd58f5460544/include/igl/diag.cpp:82:30: error: use of undeclared identifier 'dyn_X'
  X = Eigen::SparseMatrix<T>(dyn_X);
                             ^
/Users/zachary/.cache/CPM/libigl/121135a7e89a917cf11e894acdbecd58f5460544/include/igl/diag.cpp:92:10: error: no member named 'DynamicSparseMatrix' in namespace 'Eigen'
  Eigen::DynamicSparseMatrix<T, Eigen::RowMajor> dyn_X(V.size(),V.size());
  ~~~~~~~^
/Users/zachary/.cache/CPM/libigl/121135a7e89a917cf11e894acdbecd58f5460544/include/igl/diag.cpp:92:30: error: 'T' does not refer to a value
  Eigen::DynamicSparseMatrix<T, Eigen::RowMajor> dyn_X(V.size(),V.size());
                             ^
/Users/zachary/.cache/CPM/libigl/121135a7e89a917cf11e894acdbecd58f5460544/include/igl/diag.cpp:85:20: note: declared here
template <typename T, typename DerivedV>
                   ^
/Users/zachary/.cache/CPM/libigl/121135a7e89a917cf11e894acdbecd58f5460544/include/igl/diag.cpp:93:3: error: use of undeclared identifier 'dyn_X'
  dyn_X.reserve(V.size());
  ^
/Users/zachary/.cache/CPM/libigl/121135a7e89a917cf11e894acdbecd58f5460544/include/igl/diag.cpp:97:5: error: use of undeclared identifier 'dyn_X'
    dyn_X.coeffRef(i,i) += V[i];
    ^
/Users/zachary/.cache/CPM/libigl/121135a7e89a917cf11e894acdbecd58f5460544/include/igl/diag.cpp:99:30: error: use of undeclared identifier 'dyn_X'
  X = Eigen::SparseMatrix<T>(dyn_X);
                             ^
10 errors generated.
make[2]: *** [CMakeFiles/polyfem.dir/src/polyfem/basis/PolygonalBasis3d.cpp.o] Error 1
make[1]: *** [CMakeFiles/polyfem.dir/all] Error 2
make: *** [all] Error 2

It looks like we need to bug the libigl folks to remove the usage of the deprecated Eigen::DynamicSparseMatrix.

@zfergus zfergus added the bug Something isn't working label Sep 18, 2023
@jdumas
Copy link
Contributor

jdumas commented Sep 18, 2023

DynamicSparseMatrix stuff was removed from libigl last year as part of libigl/libigl#2016. You should be able to simply update the libigl version used in PolyFEM.

@zfergus
Copy link
Member Author

zfergus commented Sep 18, 2023

Oh, thanks for letting me know! Maybe they should release a new version (the last one was Feb. 2022).

@zfergus
Copy link
Member Author

zfergus commented Sep 18, 2023

Dang, so close!

[ 59%] Building CXX object _deps/wildmeshing-toolkit-build/CMakeFiles/wildmeshing_toolkit.dir/src/wmtk/utils/InsertTriangleUtils.cpp.o
In file included from /Users/zachary/.cache/CPM/wildmeshing-toolkit/a785d7e79c8a55035c3bcc3873c9730090efc95a/src/wmtk/utils/InsertTriangleUtils.cpp:3:
In file included from /Users/zachary/.cache/CPM/libigl/3d08427119f752ef9c9358f32224f9bb34efd025/include/igl/remove_duplicate_vertices.h:55:
/Users/zachary/.cache/CPM/libigl/3d08427119f752ef9c9358f32224f9bb34efd025/include/igl/predicates/../remove_duplicate_vertices.cpp:35:33: error: no member named 'all' in namespace 'Eigen'
    SV = V(SVI.derived(),Eigen::all);
                         ~~~~~~~^

I think Eigen::all was renamed to Eigen::placeholders::all

@jdumas
Copy link
Contributor

jdumas commented Sep 18, 2023

That may be a change with the development version of Eigen, but I think the latest stable release still uses Eigen::all.

As for tagging a new release of libigl you'll have to check with @alecjacobson. I'm not involved in libigl development anymore.

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

3 participants