4 #include <boost/compute/context.hpp> 5 #include <boost/test/unit_test.hpp> 10 __kernel void add_float( 11 __global float *dst, __global float const *src, unsigned int const N) { 12 int row = get_global_id(0); 14 dst[row] = dst[row] + src[row]; 18 __kernel void add_int( 19 __global int *dst, __global int const *src, 20 unsigned int const N) { 21 int row = get_global_id(0); 23 dst[row] = dst[row] + src[row]; 30 __kernel void add_float( 31 __global float *dst, __global float const* src, unsigned int const N) { 32 int row = get_global_id(0); 34 dest[row] = dst[row] + src[row]; /* oops typo in the lhs */ 44 BOOST_TEST_MESSAGE(
"Running with device=" << device.name());
45 boost::compute::context context(device);
75 BOOST_TEST_MESSAGE(
"Running with device=" << device.name());
76 boost::compute::context context(device);
78 boost::compute::program program;
82 BOOST_CHECK_NO_THROW(boost::compute::kernel(program,
"add_float"));
83 BOOST_CHECK_NO_THROW(boost::compute::kernel(program,
"add_int"));
92 BOOST_CHECK_NO_THROW(boost::compute::kernel(program,
"add_float"));
93 BOOST_CHECK_NO_THROW(boost::compute::kernel(program,
"add_int"));
boost::compute::device device_selector(config const &cfg)
Select an OpenCL device matching the current configuration.
BOOST_AUTO_TEST_CASE(build_simple_kernel)
boost::compute::kernel build_simple_kernel(boost::compute::context context, boost::compute::device device, char const *code, char const *kernel_name)
Build a simple program (one where everything is in a single string) and get a kernel from it...
char const valid_program[]
char const invalid_program[]
boost::compute::program build_simple_program(boost::compute::context context, boost::compute::device device, char const *code)
Convenience function to build a simple program and return it.