Creating a managed step in odeint using OpenMP

I am trying to build a managed stepper with boost :: odeint using 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, such a constructor does not exist in odeint and, therefore, the code does not compile.

My question is: how to create a runge_kutte-dopri5 managed stapler so that I can use it with OpenMP?

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

Many thanks for your help.

+4
source share
1 answer

You need to parameterize the stepper with 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 ) );

make_controlled factory.

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() );
+3

Source: https://habr.com/ru/post/1569137/


All Articles