7 #include <boost/test/unit_test.hpp> 17 using invector = boost::compute::vector<std::complex<float>>;
18 using outvector = boost::compute::vector<std::complex<float>>;
30 boost::compute::context context(device);
31 boost::compute::command_queue queue(context, device);
34 std::size_t
size = 128;
35 using invector = boost::compute::vector<std::complex<float>>;
36 using outvector = boost::compute::vector<std::complex<float>>;
38 std::vector<std::complex<float>> src(size);
41 invector in(size, context);
42 outvector out(size, context);
44 boost::compute::copy(src.begin(), src.end(), in.begin(), queue);
49 auto p(std::move(fft));
51 BOOST_CHECK_NO_THROW(p.enqueue(out, in, queue).wait());
52 BOOST_CHECK_THROW(fft.enqueue(out, in, queue), std::exception);
59 BOOST_CHECK_NO_THROW(p.
enqueue(out, in, queue).wait());
60 BOOST_CHECK_THROW(fft.enqueue(out, in, queue), std::exception);
66 BOOST_CHECK_NO_THROW(p.
enqueue(out, in, queue).wait());
74 std::size_t
const size = 1 << 8;
79 int const tol = 1 << 8;
82 boost::compute::context context(device);
83 boost::compute::command_queue queue(context, device);
86 using invector = boost::compute::vector<std::complex<float>>;
87 using outvector = boost::compute::vector<std::complex<float>>;
89 std::vector<std::complex<float>> src(size);
92 invector in(size, context);
93 outvector tmp(size, context);
94 invector out(size, context);
99 boost::compute::copy(src.begin(), src.end(), in.begin(), queue);
101 fft.enqueue(tmp, in, queue).wait();
102 ifft.enqueue(out, tmp, queue).wait();
104 std::vector<std::complex<float>> dst(size);
105 boost::compute::copy(out.begin(), out.end(), dst.begin(), queue);
108 BOOST_CHECK_MESSAGE(res,
"collections are not within tolerance=" << tol);
115 using invector = boost::compute::vector<std::complex<float>>;
116 using outvector = boost::compute::vector<std::complex<float>>;
118 std::size_t
const size = 1 << 8;
120 boost::compute::context context(device);
121 boost::compute::command_queue queue(context, device);
124 invector in(size, context);
125 outvector tmp(size - 1, context);
129 std::invalid_argument);
131 outvector out(size, context);
134 std::invalid_argument);
137 std::invalid_argument);
plan< invector, outvector > create_forward_plan_1d(outvector const &out, invector const &in, boost::compute::context &ct, boost::compute::command_queue &q, int batch_size=1)
Create a forward DFT plan.
plan< invector, outvector > create_inverse_plan_1d(outvector const &out, invector const &in, boost::compute::context &ct, boost::compute::command_queue &q, int batch_size=1)
Create an inverse DFT plan.
Wrap clfftPlanHandle objects in a class that can automatically destroy them.
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.
boost::compute::device device_selector(config const &cfg)
Select an OpenCL device matching the current configuration.
Wrap clfftPlanHandle objects.
void create_square_timeseries(int nsamples, timeseries &ts)
Create a simple timeseries where the values look like a square.
void init(config const &cfg)
Initialize the logging functions using the configuration provided.
bool check_collection_close_enough(collection_t const &a, collection_t const &b, int tol=1, int max_differences_printed=JB_TESTING_MAX_DIFFERENCES_PRINTED)
Given two collections of numbers of the same value type, find the differences that are out of a given...
BOOST_AUTO_TEST_CASE(clfft_plan_default)