-
Notifications
You must be signed in to change notification settings - Fork 104
Open
Description
Hello, it came to light that in line 85 of the lorenz-parameters example
odeint-v2/examples/thrust/lorenz_parameters.cu
Lines 70 to 90 in db8b39a
| void operator()( const State &x , Deriv &dxdt , value_type t ) const | |
| { | |
| thrust::for_each( | |
| thrust::make_zip_iterator( thrust::make_tuple( | |
| boost::begin( x ) , | |
| boost::begin( x ) + m_N , | |
| boost::begin( x ) + 2 * m_N , | |
| m_beta.begin() , | |
| boost::begin( dxdt ) , | |
| boost::begin( dxdt ) + m_N , | |
| boost::begin( dxdt ) + 2 * m_N ) ) , | |
| thrust::make_zip_iterator( thrust::make_tuple( | |
| boost::begin( x ) + m_N , | |
| boost::begin( x ) + 2 * m_N , | |
| boost::begin( x ) + 3 * m_N , | |
| m_beta.begin() , | |
| boost::begin( dxdt ) + m_N , | |
| boost::begin( dxdt ) + 2 * m_N , | |
| boost::begin( dxdt ) + 3 * m_N ) ) , | |
| lorenz_functor() ); | |
| } |
and in line 152
odeint-v2/examples/thrust/lorenz_parameters.cu
Lines 125 to 162 in db8b39a
| { | |
| thrust::for_each( | |
| thrust::make_zip_iterator( thrust::make_tuple( | |
| thrust::make_zip_iterator( thrust::make_tuple( | |
| boost::begin( x ) , | |
| boost::begin( x ) + m_N , | |
| boost::begin( x ) + 2 * m_N , | |
| boost::begin( x ) + 3 * m_N , | |
| boost::begin( x ) + 4 * m_N , | |
| boost::begin( x ) + 5 * m_N ) ) , | |
| m_beta.begin() , | |
| thrust::make_zip_iterator( thrust::make_tuple( | |
| boost::begin( dxdt ) , | |
| boost::begin( dxdt ) + m_N , | |
| boost::begin( dxdt ) + 2 * m_N , | |
| boost::begin( dxdt ) + 3 * m_N , | |
| boost::begin( dxdt ) + 4 * m_N , | |
| boost::begin( dxdt ) + 5 * m_N ) ) | |
| ) ) , | |
| thrust::make_zip_iterator( thrust::make_tuple( | |
| thrust::make_zip_iterator( thrust::make_tuple( | |
| boost::begin( x ) + m_N , | |
| boost::begin( x ) + 2 * m_N , | |
| boost::begin( x ) + 3 * m_N , | |
| boost::begin( x ) + 4 * m_N , | |
| boost::begin( x ) + 5 * m_N , | |
| boost::begin( x ) + 6 * m_N ) ) , | |
| m_beta.begin() , | |
| thrust::make_zip_iterator( thrust::make_tuple( | |
| boost::begin( dxdt ) + m_N , | |
| boost::begin( dxdt ) + 2 * m_N , | |
| boost::begin( dxdt ) + 3 * m_N , | |
| boost::begin( dxdt ) + 4 * m_N , | |
| boost::begin( dxdt ) + 5 * m_N , | |
| boost::begin( dxdt ) + 6 * m_N ) ) | |
| ) ) , | |
| lorenz_perturbation_functor() ); | |
| } |
implementation details of the
thrust::make_zip_iterator are being used. Specifically this code should not work under the normal behavior of zip_iterators, as the shortest element in the iterator tuple is m_beta. This however still works because of how the implementation of thrust`s zip_iterator works.Specifically referencing the answer to this question https://stackoverflow.com/a/75212854/20624687 .
This should get fixed as people use this when learning about the capabilities of boost and thrust using this website:
https://www.boost.org/doc/libs/1_81_0/libs/numeric/odeint/doc/html/boost_numeric_odeint/tutorial/using_cuda__or_openmp__tbb_______via_thrust.html
Metadata
Metadata
Assignees
Labels
No labels