4

I try to construct an controlled stepper with boost::odeint using the openmp_range_algebra

typedef vector< complex< double > > state_type;    
typedef runge_kutta_dopri5< state_type > error_stepper_type;
typedef controlled_runge_kutta< error_stepper_type > controlled_stepper_type;
controlled_stepper_type controlled_stepper(default_error_checker< double, openmp_range_algebra >;

However, no such constructor exists in odeint and hence the code does not compile.

My question: How can you create a controlled runge_kutte-dopri5 stepper such that I can use it with OpenMP?

I really want to parallelize the adaptive stepper since this is the most time consuming part of my program due to long state vectors (length: 2^20).

Thank you very much for your assistance

Vergilius
  • 41
  • 2
  • You also might want to consider using GPUs. For problems of your length, it might speed up your code by orders of magnitude. – headmyshoulder Dec 27 '14 at 20:27

1 Answers1

3

You need to parametrize the stepper with the range algebra:

// Disclaimer: Not tested if it compiles
typedef runge_kutta_dopri5<
    state_type, double,
    state_type, double,
    openmp_range_algebra
> stepper_type;
typedef controlled_runge_kutta< stepper_type > controlled_stepper_type;
typedef controlled_stepper_type::error_checker_type error_checker_type;
const double eps_absolute = 1.0e-6;
const double eps_relative = 1.0e-6;
controlled_stepper_type stepper( error_checker_type( eps_absolute , eps_relative ) );

And it is easier to use the make_controlled factory function. The above lines of code can be simplified to

typedef runge_kutta_dopri5<
    state_type, double,
    state_type, double,
    openmp_range_algebra
> stepper_type;
auto stepper = make_controlled( 1.0e-6 , 1.0e-6 , stepper_type() );
headmyshoulder
  • 6,240
  • 2
  • 20
  • 27