ddemidov / amgcl

C++ library for solving large sparse linear systems with algebraic multigrid method
http://amgcl.readthedocs.org/
MIT License
733 stars 112 forks source link

Boost static_vector dependency #112

Closed Tongdongq closed 5 years ago

Tongdongq commented 5 years ago

I noticed pybind11 and Boost are required. Boost is pretty common, but my version 1.53 does not have container/static_vector.hpp, which was added in 1.54. It is used in amgcl/adapter/block_matrix.hpp. I changed the type of base to std::vector<Base>, and it compiles. Running make test passes 8/8 tests. Unfortunately, I cannot do base.reserve(BlockSize) or similar, since base does not name a type. Is there a list of prerequisites available?

ddemidov commented 5 years ago

The master branch should only depend on boost::property_tree library, and only when the runtime interface is used. If you use compile-time interface, you should not depend on boost at all. Are you using the latest released version (1.2.0)? I would suggest using the master branch instead. I don't think there are other dependencies except the ones required by the selected backend (and the builtin/openmp backend should not have any).

pybind11 is only needed if you want to compile the python wrapper module.

Tongdongq commented 5 years ago

I see you got rid of the static_vector dependency on June 5 2018. For some reason, my repo was at April 27 2018.

Now I have a new error: cmake -DAMGCL_BUILD_EXAMPLES=ON .. followed by make: In file included from /usr/include/boost/iterator/transform_iterator.hpp:23:0, from /data/work/tqiu/amgcl/amgcl/lib/amgcl.cpp:4: /usr/include/boost/utility/result_of.hpp: In instantiation of ‘struct boost::detail::result_of_nested_result<const amgcl_precond_create_f(int, const int*, const int*, const double*, amgclHandle)::__lambda0, const amgcl_precond_create_f(int, const int*, const int*, const double*, amgclHandle)::__lambda0(const int&)>’: /usr/include/boost/utility/result_of.hpp:170:8: required from ‘struct boost::detail::tr1_result_of_impl<const amgcl_precond_create_f(int, const int*, const int*, const double*, amgclHandle)::__lambda0, const amgcl_precond_create_f(int, const int*, const int*, const double*, amgclHandle)::__lambda0(const int&), false>’ /usr/include/boost/utility/detail/result_of_iterate.hpp:27:8: required from ‘struct boost::tr1_result_of<const amgcl_precond_create_f(int, const int*, const int*, const double*, amgclHandle)::__lambda0(const int&)>’ /usr/include/boost/utility/detail/result_of_iterate.hpp:146:8: required from ‘struct boost::result_of<const amgcl_precond_create_f(int, const int*, const int*, const double*, amgclHandle)::__lambda0(const int&)>’ /usr/include/boost/mpl/eval_if.hpp:38:31: required from ‘struct boost::mpl::eval_if<boost::is_same<boost::use_default, boost::use_default>, boost::result_of<const amgcl_precond_create_f(int, const int*, const int*, const double*, amgclHandle)::__lambda0(const int&)>, boost::mpl::identity<boost::use_default> >’ /usr/include/boost/iterator/iterator_adaptor.hpp:160:12: required from ‘struct boost::detail::ia_dflt_help<boost::use_default, boost::result_of<const amgcl_precond_create_f(int, const int*, const int*, const double*, amgclHandle)::__lambda0(const int&)> >’ /usr/include/boost/iterator/transform_iterator.hpp:50:17: required from ‘struct boost::detail::transform_iterator_base<amgcl_precond_create_f(int, const int*, const int*, const double*, amgclHandle)::__lambda0, const int*, boost::use_default, boost::use_default>’ /usr/include/boost/iterator/transform_iterator.hpp:74:9: required from ‘class boost::transform_iterator<amgcl_precond_create_f(int, const int*, const int*, const double*, amgclHandle)::__lambda0, const int*, boost::use_default, boost::use_default>’ /data/work/tqiu/amgcl/amgcl/lib/amgcl.cpp:93:80: required from here /usr/include/boost/utility/result_of.hpp:166:8: error: no class template named ‘result’ in ‘const struct amgcl_precond_create_f(int, const int*, const int*, const double*, amgclHandle)::__lambda0’ struct result_of_nested_result : F::template result<FArgs> Line 93 is indeed auto ptr_c = boost::make_transform_iterator(ptr, [](int i){ return i - 1; });, but this seems like a Boost error

ddemidov commented 5 years ago

What is your boost version? Compiler? Can you try with a newer version of boost?

Tongdongq commented 5 years ago

It's pretty old, 1.53 from 2013, but I'm not sure if I can use a newer Boost version without admin rights. I'll check tomorrow

Tongdongq commented 5 years ago

I installed Boost locally in /path/to/boost_1_70_0, and added set(BOOST_ROOT "/path/to/boost_1_70_0") to the CMakeLists.txt in the amgcl root, line 31, before find_package(Boost .... Optionally change that line to find_package(Boost 1.70 ... to make sure it does not accept the older version of Boost. It compiles the tests and examples, 8/8 tests pass, examples/solver runs succesfully. Thanks for the help!