JayBeams
0.1
Another project to have fun coding.
|
Wrap clfftPlanHandle objects. More...
#include <plan.hpp>
Classes | |
struct | check_constraints |
Check the compile-time constraints for a jb::fftw::plan<> More... | |
Public Types | |
using | in_value_type = typename in_timeseries_type::value_type |
type straits More... | |
using | out_value_type = typename out_timeseries_type::value_type |
using | in_value_traits = ::jb::clfft::detail::complex_traits< in_value_type > |
using | out_value_traits = ::jb::clfft::detail::complex_traits< out_value_type > |
using | precision_type = typename jb::extract_value_type< in_value_type >::precision |
Public Member Functions | |
plan () | |
Default constructor. More... | |
plan (plan &&rhs) | |
Basic move constructor. More... | |
plan & | operator= (plan &&rhs) |
Move assigment operator. More... | |
~plan () noexcept(false) | |
Destructor, cleanup the plan. More... | |
boost::compute::event | enqueue (out_timeseries_type &out, in_timeseries_type const &in, boost::compute::command_queue &queue, boost::compute::wait_list const &wait=boost::compute::wait_list()) |
Enqueue the transform to be executed. More... | |
Private Member Functions | |
plan (clfftPlanHandle p, clfftDirection d) | |
Constructor from a clfftPlanHandle. More... | |
Deleted functions | |
plan (plan const &)=delete | |
plan & | operator= (plan const &)=delete |
Static Private Member Functions | |
static plan | create_plan_1d_impl (out_timeseries_type const &out, in_timeseries_type const &in, boost::compute::context &context, boost::compute::command_queue &queue, clfftDirection direction, std::size_t batch_size) |
Refactor code to create plans. More... | |
Private Attributes | |
clfftPlanHandle | p_ |
clfftDirection | d_ |
Friends | |
template<typename itype , typename otype > | |
plan< itype, otype > | create_forward_plan_1d (otype const &, itype const &, boost::compute::context &, boost::compute::command_queue &, int) |
template<typename itype , typename otype > | |
plan< itype, otype > | create_inverse_plan_1d (otype const &, itype const &, boost::compute::context &, boost::compute::command_queue &, int) |
Wrap clfftPlanHandle objects.
The clFFT library optimizes execution by pre-computing coefficients, execution plans, and OpenCL kernels for a given input. The plan also stores the precision (float vs. double), and the input and output types (e.g. float to std::complex<float> vs. std::complex<float> to std::complex<float>).
In JayBeams we prefer to store such details in the type system, and create a different plan type for different input and output types.
in_timeseries_type | the type of the input timeseries, typically an instantiation of boost::compute::vector<T>. |
out_timseries_type | the type of the output timeseries, typically an instantiation of boost::compute::vector<T>. |
using jb::clfft::plan< in_timeseries_type, out_timeseries_type >::in_value_traits = ::jb::clfft::detail::complex_traits<in_value_type> |
using jb::clfft::plan< in_timeseries_type, out_timeseries_type >::in_value_type = typename in_timeseries_type::value_type |
using jb::clfft::plan< in_timeseries_type, out_timeseries_type >::out_value_traits = ::jb::clfft::detail::complex_traits<out_value_type> |
using jb::clfft::plan< in_timeseries_type, out_timeseries_type >::out_value_type = typename out_timeseries_type::value_type |
using jb::clfft::plan< in_timeseries_type, out_timeseries_type >::precision_type = typename jb::extract_value_type<in_value_type>::precision |
|
inline |
Default constructor.
Definition at line 53 of file plan.hpp.
Referenced by jb::clfft::plan< in_timeseries_type, out_timeseries_type >::create_plan_1d_impl().
|
inline |
Basic move constructor.
Definition at line 59 of file plan.hpp.
References jb::clfft::plan< in_timeseries_type, out_timeseries_type >::d_, and jb::clfft::plan< in_timeseries_type, out_timeseries_type >::p_.
|
inlinenoexcept |
Destructor, cleanup the plan.
Definition at line 76 of file plan.hpp.
References jb::clfft::check_error_code(), jb::clfft::plan< in_timeseries_type, out_timeseries_type >::d_, and jb::clfft::plan< in_timeseries_type, out_timeseries_type >::p_.
|
privatedelete |
|
inlineexplicitprivate |
|
inlinestaticprivate |
Refactor code to create plans.
out | the output destination prototype. The actual output in execute() must have the same size as this parameter. |
in | the input data prototype. The actual input in execute() must have the same size as this parameter. |
context | a collection of devices in a single OpenCL platform. |
queue | a command queue associated with context. |
direction | the direction of the transform |
batch_size | the size of the batch, the size of out and in must be a multiple of this number. |
std::exception | if the parameters are invalid or there was an OpenCL or clFFT error. |
Definition at line 151 of file plan.hpp.
References jb::clfft::check_error_code(), jb::clfft::plan< in_timeseries_type, out_timeseries_type >::operator=(), and jb::clfft::plan< in_timeseries_type, out_timeseries_type >::plan().
Referenced by jb::clfft::create_forward_plan_1d(), and jb::clfft::create_inverse_plan_1d().
|
inline |
Enqueue the transform to be executed.
As it is often the case with OpenCL, this is an asynchronous operation. The transform is scheduled to be executed, but it may not have completed by the time this function returns. One must wait for the returned event to reach the done state before any operations can depend on the state of the output.
out | the output location for the data, must have the same size as the prototype used to construct the plan. |
in | the input for the data, must have the same size as the prototype used to construct the plan. |
queue | where to schedule the computation on. |
wait | a set of events to wait for before starting the computation. |
std::exception | if there is an error scheduling the computation. |
Definition at line 107 of file plan.hpp.
References jb::clfft::check_error_code(), jb::clfft::plan< in_timeseries_type, out_timeseries_type >::create_forward_plan_1d, jb::clfft::plan< in_timeseries_type, out_timeseries_type >::create_inverse_plan_1d, jb::clfft::plan< in_timeseries_type, out_timeseries_type >::d_, and jb::clfft::plan< in_timeseries_type, out_timeseries_type >::p_.
Referenced by BOOST_AUTO_TEST_CASE(), and main().
|
inline |
Move assigment operator.
Definition at line 68 of file plan.hpp.
References jb::clfft::plan< in_timeseries_type, out_timeseries_type >::d_, and jb::clfft::plan< in_timeseries_type, out_timeseries_type >::p_.
Referenced by jb::clfft::plan< in_timeseries_type, out_timeseries_type >::create_plan_1d_impl().
|
privatedelete |
|
friend |
|
friend |
|
private |
Definition at line 229 of file plan.hpp.
Referenced by jb::clfft::plan< in_timeseries_type, out_timeseries_type >::enqueue(), jb::clfft::plan< in_timeseries_type, out_timeseries_type >::operator=(), jb::clfft::plan< in_timeseries_type, out_timeseries_type >::plan(), and jb::clfft::plan< in_timeseries_type, out_timeseries_type >::~plan().
|
private |
Definition at line 228 of file plan.hpp.
Referenced by jb::clfft::plan< in_timeseries_type, out_timeseries_type >::enqueue(), jb::clfft::plan< in_timeseries_type, out_timeseries_type >::operator=(), jb::clfft::plan< in_timeseries_type, out_timeseries_type >::plan(), and jb::clfft::plan< in_timeseries_type, out_timeseries_type >::~plan().