I've installed boost 1.62.0 to use the odeint library and I am unable to compile the sample code that is supposed to solve the Lorenz system using vexcl. I took this code directly from the installation directory of boost:
#include <iostream>
#include <vector>
#include <vexcl/vexcl.hpp>
#include <boost/numeric/odeint.hpp>
#include <boost/numeric/odeint/external/vexcl/vexcl.hpp>
namespace odeint = boost::numeric::odeint;
typedef vex::vector< double > vector_type;
typedef vex::multivector< double, 3 > state_type;
const double sigma = 10.0;
const double b = 8.0 / 3.0;
struct sys_func
{
const vector_type &R;
sys_func( const vector_type &_R ) : R( _R ) { }
void operator()( const state_type &x , state_type &dxdt , double t ) const
{
dxdt(0) = -sigma * ( x(0) - x(1) );
dxdt(1) = R * x(0) - x(1) - x(0) * x(2);
dxdt(2) = - b * x(2) + x(0) * x(1);
}
};
int main( int argc , char **argv )
{
using namespace std;
using namespace odeint;
// setup the opencl context
vex::Context ctx( vex::Filter::Type(CL_DEVICE_TYPE_GPU) );
std::cout << ctx << std::endl;
// set up number of system, time step and integration time
const size_t n = 1024 * 1024;
const double dt = 0.01;
const double t_max = 1000.0;
// initialize R
double Rmin = 0.1 , Rmax = 50.0 , dR = ( Rmax - Rmin ) / double( n - 1 );
std::vector<double> x( n * 3 ) , r( n );
for( size_t i=0 ; i<n ; ++i )
r[i] = Rmin + dR * double( i );
vector_type R( ctx.queue() , r );
// initialize the state of the lorenz ensemble
state_type X(ctx.queue(), n);
X(0) = 10.0;
X(1) = 10.0;
X(2) = 10.0;
// create a stepper
runge_kutta4< state_type > stepper;
// solve the system
integrate_const( stepper , sys_func( R ) , X , 0.0 , t_max , dt );
std::vector< double > res( 3 * n );
vex::copy( X(0) , res );
for( size_t i=0 ; i<n ; ++i )
cout << r[i] << "\t" << res[i] << "\t" << "\n";
}
When I try to compile using QT5.5.1 and mingw492_32 I get the following errors :
C:\boost_1_62_0\boost\numeric\odeint\algebra\detail\for_each.hpp:47: erreur : no match for call to '(boost::numeric::odeint::detail::generic_rk_scale_sum<1u, boost::numeric::odeint::default_operations, double, double>) (boost::iterators::detail::iterator_facade_base<vex::multivector<double, 3u>::iterator_type<vex::multivector<double, 3u>, vex::multivector<double, 3u>::element>, double, std::random_access_iterator_tag, vex::multivector<double, 3u>::element, int, false, false>::reference, boost::iterators::detail::iterator_facade_base<vex::multivector<double, 3u>::iterator_type<const vex::multivector<double, 3u>, vex::multivector<double, 3u>::const_element>, double, std::random_access_iterator_tag, vex::multivector<double, 3u>::const_element, int, false, false>::reference, boost::iterators::detail::iterator_facade_base<vex::multivector<double, 3u>::iterator_type<const vex::multivector<double, 3u>, vex::multivector<double, 3u>::const_element>, double, std::random_access_iterator_tag, vex::multivector<double, 3u>::const_element, int, false, false>::reference)'
op( *first1++ , *first2++ , *first3++ );
^
C:\boost_1_62_0\boost\numeric\odeint\algebra\detail\for_each.hpp:55: erreur : no match for call to '(boost::numeric::odeint::detail::generic_rk_scale_sum<2u, boost::numeric::odeint::default_operations, double, double>) (boost::iterators::detail::iterator_facade_base<vex::multivector<double, 3u>::iterator_type<vex::multivector<double, 3u>, vex::multivector<double, 3u>::element>, double, std::random_access_iterator_tag, vex::multivector<double, 3u>::element, int, false, false>::reference, boost::iterators::detail::iterator_facade_base<vex::multivector<double, 3u>::iterator_type<const vex::multivector<double, 3u>, vex::multivector<double, 3u>::const_element>, double, std::random_access_iterator_tag, vex::multivector<double, 3u>::const_element, int, false, false>::reference, boost::iterators::detail::iterator_facade_base<vex::multivector<double, 3u>::iterator_type<const vex::multivector<double, 3u>, vex::multivector<double, 3u>::const_element>, double, std::random_access_iterator_tag, vex::multivector<double, 3u>::const_element, int, false, false>::reference, boost::iterators::detail::iterator_facade_base<vex::multivector<double, 3u>::iterator_type<vex::multivector<double, 3u>, vex::multivector<double, 3u>::element>, double, std::random_access_iterator_tag, vex::multivector<double, 3u>::element, int, false, false>::reference)'
op( *first1++ , *first2++ , *first3++ , *first4++ );
^
C:\boost_1_62_0\boost\numeric\odeint\algebra\detail\for_each.hpp:64: erreur : no match for call to '(boost::numeric::odeint::detail::generic_rk_scale_sum<3u, boost::numeric::odeint::default_operations, double, double>) (boost::iterators::detail::iterator_facade_base<vex::multivector<double, 3u>::iterator_type<vex::multivector<double, 3u>, vex::multivector<double, 3u>::element>, double, std::random_access_iterator_tag, vex::multivector<double, 3u>::element, int, false, false>::reference, boost::iterators::detail::iterator_facade_base<vex::multivector<double, 3u>::iterator_type<const vex::multivector<double, 3u>, vex::multivector<double, 3u>::const_element>, double, std::random_access_iterator_tag, vex::multivector<double, 3u>::const_element, int, false, false>::reference, boost::iterators::detail::iterator_facade_base<vex::multivector<double, 3u>::iterator_type<const vex::multivector<double, 3u>, vex::multivector<double, 3u>::const_element>, double, std::random_access_iterator_tag, vex::multivector<double, 3u>::const_element, int, false, false>::reference, boost::iterators::detail::iterator_facade_base<vex::multivector<double, 3u>::iterator_type<vex::multivector<double, 3u>, vex::multivector<double, 3u>::element>, double, std::random_access_iterator_tag, vex::multivector<double, 3u>::element, int, false, false>::reference, boost::iterators::detail::iterator_facade_base<vex::multivector<double, 3u>::iterator_type<vex::multivector<double, 3u>, vex::multivector<double, 3u>::element>, double, std::random_access_iterator_tag, vex::multivector<double, 3u>::element, int, false, false>::reference)'
op( *first1++ , *first2++ , *first3++ , *first4++ , *first5++ );
^
C:\boost_1_62_0\boost\numeric\odeint\algebra\detail\for_each.hpp:73: erreur : no match for call to '(boost::numeric::odeint::detail::generic_rk_scale_sum<4u, boost::numeric::odeint::default_operations, double, double>) (boost::iterators::detail::iterator_facade_base<vex::multivector<double, 3u>::iterator_type<vex::multivector<double, 3u>, vex::multivector<double, 3u>::element>, double, std::random_access_iterator_tag, vex::multivector<double, 3u>::element, int, false, false>::reference, boost::iterators::detail::iterator_facade_base<vex::multivector<double, 3u>::iterator_type<const vex::multivector<double, 3u>, vex::multivector<double, 3u>::const_element>, double, std::random_access_iterator_tag, vex::multivector<double, 3u>::const_element, int, false, false>::reference, boost::iterators::detail::iterator_facade_base<vex::multivector<double, 3u>::iterator_type<const vex::multivector<double, 3u>, vex::multivector<double, 3u>::const_element>, double, std::random_access_iterator_tag, vex::multivector<double, 3u>::const_element, int, false, false>::reference, boost::iterators::detail::iterator_facade_base<vex::multivector<double, 3u>::iterator_type<vex::multivector<double, 3u>, vex::multivector<double, 3u>::element>, double, std::random_access_iterator_tag, vex::multivector<double, 3u>::element, int, false, false>::reference, boost::iterators::detail::iterator_facade_base<vex::multivector<double, 3u>::iterator_type<vex::multivector<double, 3u>, vex::multivector<double, 3u>::element>, double, std::random_access_iterator_tag, vex::multivector<double, 3u>::element, int, false, false>::reference, boost::iterators::detail::iterator_facade_base<vex::multivector<double, 3u>::iterator_type<vex::multivector<double, 3u>, vex::multivector<double, 3u>::element>, double, std::random_access_iterator_tag, vex::multivector<double, 3u>::element, int, false, false>::reference)'
op( *first1++ , *first2++ , *first3++ , *first4++ , *first5++ , *first6++ );
^
I could compile and execute the sample code that solved the Lorenz system without vexcl but as soon as I tried to use vexcl problems started to arise : before getting these errors I had to download the vexcl library and include it in my boost installation because it tried to include missing packages.
Aucun commentaire:
Enregistrer un commentaire