JayBeams  0.1
Another project to have fun coding.
Classes | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
jb::clfft::plan< in_timeseries_type, out_timeseries_type > Class Template Reference

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...
 
planoperator= (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
 
planoperator= (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)
 

Detailed Description

template<typename in_timeseries_type, typename out_timeseries_type>
class jb::clfft::plan< in_timeseries_type, out_timeseries_type >

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.

Template Parameters
in_timeseries_typethe type of the input timeseries, typically an instantiation of boost::compute::vector<T>.
out_timseries_typethe type of the output timeseries, typically an instantiation of boost::compute::vector<T>.

Definition at line 35 of file plan.hpp.

Member Typedef Documentation

◆ in_value_traits

template<typename in_timeseries_type, typename out_timeseries_type>
using jb::clfft::plan< in_timeseries_type, out_timeseries_type >::in_value_traits = ::jb::clfft::detail::complex_traits<in_value_type>

Definition at line 43 of file plan.hpp.

◆ in_value_type

template<typename in_timeseries_type, typename out_timeseries_type>
using jb::clfft::plan< in_timeseries_type, out_timeseries_type >::in_value_type = typename in_timeseries_type::value_type

type straits

Definition at line 41 of file plan.hpp.

◆ out_value_traits

template<typename in_timeseries_type, typename out_timeseries_type>
using jb::clfft::plan< in_timeseries_type, out_timeseries_type >::out_value_traits = ::jb::clfft::detail::complex_traits<out_value_type>

Definition at line 44 of file plan.hpp.

◆ out_value_type

template<typename in_timeseries_type, typename out_timeseries_type>
using jb::clfft::plan< in_timeseries_type, out_timeseries_type >::out_value_type = typename out_timeseries_type::value_type

Definition at line 42 of file plan.hpp.

◆ precision_type

template<typename in_timeseries_type, typename out_timeseries_type>
using jb::clfft::plan< in_timeseries_type, out_timeseries_type >::precision_type = typename jb::extract_value_type<in_value_type>::precision

Definition at line 49 of file plan.hpp.

Constructor & Destructor Documentation

◆ plan() [1/4]

template<typename in_timeseries_type, typename out_timeseries_type>
jb::clfft::plan< in_timeseries_type, out_timeseries_type >::plan ( )
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().

◆ plan() [2/4]

template<typename in_timeseries_type, typename out_timeseries_type>
jb::clfft::plan< in_timeseries_type, out_timeseries_type >::plan ( plan< in_timeseries_type, out_timeseries_type > &&  rhs)
inline

◆ ~plan()

template<typename in_timeseries_type, typename out_timeseries_type>
jb::clfft::plan< in_timeseries_type, out_timeseries_type >::~plan ( )
inlinenoexcept

◆ plan() [3/4]

template<typename in_timeseries_type, typename out_timeseries_type>
jb::clfft::plan< in_timeseries_type, out_timeseries_type >::plan ( plan< in_timeseries_type, out_timeseries_type > const &  )
privatedelete

◆ plan() [4/4]

template<typename in_timeseries_type, typename out_timeseries_type>
jb::clfft::plan< in_timeseries_type, out_timeseries_type >::plan ( clfftPlanHandle  p,
clfftDirection  d 
)
inlineexplicitprivate

Constructor from a clfftPlanHandle.

Definition at line 222 of file plan.hpp.

Member Function Documentation

◆ create_plan_1d_impl()

template<typename in_timeseries_type, typename out_timeseries_type>
static plan jb::clfft::plan< in_timeseries_type, out_timeseries_type >::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 
)
inlinestaticprivate

Refactor code to create plans.

Parameters
outthe output destination prototype. The actual output in execute() must have the same size as this parameter.
inthe input data prototype. The actual input in execute() must have the same size as this parameter.
contexta collection of devices in a single OpenCL platform.
queuea command queue associated with context.
directionthe direction of the transform
batch_sizethe size of the batch, the size of out and in must be a multiple of this number.
Returns
a new plan that computes a DFT (or the inverse DFT) from a vector like in into a vector like out.
Exceptions
std::exceptionif 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().

◆ enqueue()

template<typename in_timeseries_type, typename out_timeseries_type>
boost::compute::event jb::clfft::plan< in_timeseries_type, out_timeseries_type >::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() 
)
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.

Parameters
outthe output location for the data, must have the same size as the prototype used to construct the plan.
inthe input for the data, must have the same size as the prototype used to construct the plan.
queuewhere to schedule the computation on.
waita set of events to wait for before starting the computation.
Returns
a event that when satisfied indicates the computation has completed.
Exceptions
std::exceptionif 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().

◆ operator=() [1/2]

template<typename in_timeseries_type, typename out_timeseries_type>
plan& jb::clfft::plan< in_timeseries_type, out_timeseries_type >::operator= ( plan< in_timeseries_type, out_timeseries_type > &&  rhs)
inline

◆ operator=() [2/2]

template<typename in_timeseries_type, typename out_timeseries_type>
plan& jb::clfft::plan< in_timeseries_type, out_timeseries_type >::operator= ( plan< in_timeseries_type, out_timeseries_type > const &  )
privatedelete

Friends And Related Function Documentation

◆ create_forward_plan_1d

template<typename in_timeseries_type, typename out_timeseries_type>
template<typename itype , typename otype >
plan<itype, otype> create_forward_plan_1d ( otype const &  ,
itype const &  ,
boost::compute::context &  ,
boost::compute::command_queue &  ,
int   
)
friend

◆ create_inverse_plan_1d

template<typename in_timeseries_type, typename out_timeseries_type>
template<typename itype , typename otype >
plan<itype, otype> create_inverse_plan_1d ( otype const &  ,
itype const &  ,
boost::compute::context &  ,
boost::compute::command_queue &  ,
int   
)
friend

Member Data Documentation

◆ d_

template<typename in_timeseries_type, typename out_timeseries_type>
clfftDirection jb::clfft::plan< in_timeseries_type, out_timeseries_type >::d_
private

◆ p_

template<typename in_timeseries_type, typename out_timeseries_type>
clfftPlanHandle jb::clfft::plan< in_timeseries_type, out_timeseries_type >::p_
private

The documentation for this class was generated from the following file: