Commit Graph

1404 Commits

Author SHA1 Message Date
Kyle Lutz
5164ab4bd0 Cleanup constructors for wrapper classes
This cleans up the constructor methods for the OpenCL wrapper
classes and unifies the API used for creating a wrapper class
object from the underlying OpenCL objects.

Now, every wrapper class has a constructor taking the OpenCL
object and an optional boolean retain parameter which indicates
whether the constructor should increment the reference count.
2013-04-07 15:03:24 -04:00
Kyle Lutz
9a3d7c7d4b Add missing iostream header include to test_device
This adds a missing include for the iostream header to
test_device. This fixes a compilation issue when using
OpenCL 1.2.
2013-04-07 13:00:55 -04:00
Kyle Lutz
25a084deda Fix indentation in kernel::get_arg_info()
This fixes the indentation in the kernel::get_arg_info()
method.
2013-04-07 12:57:26 -04:00
Kyle Lutz
48e1bb4da0 Update image2d/3d constuctors for OpenCL 1.2
This updates the constructors for the image2d and image3d
classes to use the new clCreateImage() function instead of
the deprecated clCreateImage2D/3D() functions.
2013-03-31 15:01:30 -04:00
Kyle Lutz
d56e58b48e Add OpenCL 1.2 error codes to runtime_exception
This adds support for the OpenCL 1.2 error codes to the
runtime_exception class.
2013-03-31 14:58:00 -04:00
Kyle Lutz
0aa3d024dc Fix command_queue::enqueue_marker() for OpenCL 1.2
This changes the enqueue_marker() method in the command_queue
class to use clEnqueueMarkerWithWaitList() instead of the
deprecated clEnqueueMarker() function when compiling with
OpenCL 1.2.
2013-03-31 12:08:23 -04:00
Kyle Lutz
7e7e09b704 Fix command_queue::enqueue_barrier() for OpenCL 1.2
This changes the enqueue_barrier() method in the command_queue
class to use clEnqueueBarrierWithWaitList() instead of the
deprecated clEnqueueBarrier() function when compiling with
OpenCL 1.2.
2013-03-31 12:03:38 -04:00
Kyle Lutz
52fef4de6b Remove command_queue::enqueue_wait_for_event() method
This remove the enqueue_wait_for_event() method from the
command_queue class as the clEnqueueWaitForEvents() function
has been deprecated in OpenCL 1.2.
2013-03-31 11:59:14 -04:00
Kyle Lutz
c7a3bc8af6 Move unload_compiler() method to platform
This moves the unload_compiler() method from the system class
to the platform class. Also changes the method to use the
clUnloadPlatformCompiler() function instead of the deprecated
clUnloadCompiler() when compiling with OpenCL 1.2.
2013-03-31 11:29:40 -04:00
Kyle Lutz
d28354184c Move get_extension_function_address() method to platform
This moves the get_extension_function_address() method from
the system class to the platform class. Also changes the method
to use the clGetExtensionFunctionAddressForPlatform() function
instead of the deprecated clGetExtensionFunctionAddress() when
compiling with OpenCL 1.2.
2013-03-31 11:26:18 -04:00
Kyle Lutz
00fcb737cc Fix bug in move-constuctor for vector<T>
This fixes a bug in the move-constuctor for the vector<T>
class.

Previously, the moved-from object was also deallocating the
memory buffer leading to an error when the moved-to object
attempted to use it. Now, the constructor checks if the buffer
is non-empty before deallocating it.
2013-03-30 19:55:51 -04:00
Kyle Lutz
1161f89031 Make get_object_info() inline
This marks the get_object_info() method as inline.
2013-03-30 19:38:40 -04:00
Kyle Lutz
d585fbebad Make stream operator for vector types inline
This marks the stream operator for vector types as
inline.
2013-03-30 19:35:56 -04:00
Kyle Lutz
da1d7794b5 Remove support for cl_half
This removes support for cl_half (typedef'd to half_).

The issue is that the cl_half type is indistinguishable
from the cl_ushort type (both are typedefs for uint16_t)
which caused the cl_khr_fp16 pragma to be injected into
kernels using cl_ushort which causes errors on platforms
that do not support the cl_khr_fp16 extension.
2013-03-27 00:09:51 -04:00
Kyle Lutz
14ea0bdbff Fix bug in command_queue test on AMD platforms
This fixes a bug in the event_profiling test case in the
command_queue test. On AMD platforms, the event object
returned from clEnqueueMarker() has no profiling information
associated with it and returns an error code when accessed.

Now, profiling information for a simple write to a device
buffer is checked instead.
2013-03-26 23:36:58 -04:00
Kyle Lutz
4338b311f7 Add device::partition() method
This adds a new set of methods to the device class allowing
device objects to be partitioned into multiple sub-devices
using the clCreateSubDevices() function.

For now, device partitioning is only supported on systems
with OpenCL version 1.2 (or later).
2013-03-26 23:36:54 -04:00
Kyle Lutz
4752fb2404 Support returning std::vector<T> from get_info<T>()
This adds support for returning a std::vector<T> from the
various get_info<T>() methods. This provides a simpler
interface to get the values in an array returned from one
of the clGet*Info() functions.

This also adds a test using the new API to get the maximum
work item sizes in each dimension for a device.
2013-03-26 22:44:56 -04:00
Kyle Lutz
25e7214e5c Fix bug in inplace_reduce() test
This fixes a bug in the test for inplace_reduce() in which
the vector was being filled with data from two different
command queues leaving the data in an undefined state.
2013-03-25 21:05:42 -04:00
Denis Demidov
2df059738a Option to not retain program on creation 2013-03-25 20:59:50 -04:00
Kyle Lutz
ab0575dd0c Fix bug in remove_if() algorithm
This fixes a bug in which the remove_if() function would overwrite
parts of the input before they were properly copied to the output
range. This is fixed by first copying the input values to a temporary
vector and then passing that as the input range to copy_if().
2013-03-21 23:23:39 -04:00
Kyle Lutz
147baa05fe Fix bug in count_if() and find_if() with Intel CPUs
This fixes a bug in which the Intel OpenCL compiler would
fail to compile the count_if() and find_if() kernels for
vector types with the following error:

error: no matching function for call to 'all'
note: candidate function not viable: 1st argument ('__global int4')
is in address space 16776960, but parameter must be in address space 0

This is caused when the predicate compares a value from the input
buffer (in the global memory space) to a literal value (in the
private memory space).

This is fixed by first reading the value into a local variable in
the private memory space and then calling the predicate function.
2013-03-21 22:46:01 -04:00
Kyle Lutz
ecc0944afe Remove check for local_memory_size in test_kernel
This removes the check for local_memory_size in test_kernel. The
local memory size differs between platforms and some (e.g. Intel)
don't report any local memory usage.
2013-03-20 18:38:09 -04:00
Kyle Lutz
25b71579a5 Fix bug when calling fill() with vector types
This fixes a bug in which the fill() algorithm was called by
scan_impl() with an integer zero rather than zero of the value
type which caused issues when using scan() with vector values.
2013-03-20 18:10:48 -04:00
Kyle Lutz
35f3bdc7fd Add test for transform_iterator
This adds a unit test for transform_iterator.
2013-03-19 18:22:54 -04:00
Kyle Lutz
d80e2a5c30 Add test for permutation_iterator
This adds a unit test for permutation_iterator.
2013-03-19 18:22:08 -04:00
Kyle Lutz
5f6bdf8644 Add test for counting_iterator
This adds a unit test for counting_iterator.
2013-03-19 18:12:22 -04:00
Kyle Lutz
4aaf4bcbb0 Add test for constant_iterator
This adds a unit test for constant_iterator.
2013-03-19 18:11:59 -04:00
Kyle Lutz
7c3a05b421 Add construct_from_cl_context test-case to test_context
This adds a new test executable for the context class and
adds a new test-case which checks the functionality of the
context(cl_context) constructor.
2013-03-19 17:51:44 -04:00
Kyle Lutz
34cfe34edb Add construct_from_cl_command_queue test-case to test_command_queue
This adds a new test-case to test_command_queue which checks the
functionality of the command_queue(cl_command_queue) constructor.
2013-03-19 17:48:30 -04:00
Kyle Lutz
e8f77897eb Add construct_from_cl_mem test-case to test_buffer
This adds a new test-case to test_buffer which checks the
functionality of the buffer(cl_mem) constructor.
2013-03-19 17:46:14 -04:00
Kyle Lutz
e4b273fc22 Merge pull request #3 from ddemidov/master
Allow buffer and queue initialization from lowlevel types
2013-03-19 14:22:46 -07:00
Denis Demidov
6766b07fad Allow buffer and queue initialization from lowlevel types 2013-03-19 17:18:43 +04:00
Kyle Lutz
2d81f561c4 Add zip_iterator class
This adds a zip_iterator class which allows for one or more
iterators to be combined into a single iterator object.
2013-03-17 23:42:56 -04:00
Kyle Lutz
ada2351812 Add support for boost::tuple<>
This adds support for using boost::tuple<> types with the
Boost.Compute containers and algorithms.
2013-03-17 23:28:07 -04:00
Kyle Lutz
ad9309740e Add meta_kernel::inject_type<Type>() method
This adds a new method which allows for type definitions and
type pragmas to be added to a meta_kernel.

This provides a more generic and general interface and replaces
the previously used add_pair_type() method along with the special
case handling of half and double types.
2013-03-17 23:20:19 -04:00
Kyle Lutz
db53bdb246 Fix check for local memory size in test_kernel
This fixes the check for the local memory size in the
get_work_group_info kernel test.

While the kernel only allocates 16 float's, some platforms
will use more local memory. This changes the test to check
for at least 16 float's worth of local memory.
2013-03-17 22:42:56 -04:00
Kyle Lutz
2f81872403 Pass binary_status argument to clCreateProgramWithBinary()
This fixes a bug in which certain platforms would return
CL_INVALID_VALUE from clCreateProgramWithBinary() if the
binary_status argument was not provided.
2013-03-17 22:20:32 -04:00
Kyle Lutz
233df55978 Fix bug in program::binary()
This fixes a bug in the program::binary() method in which
the return size was not being passed to clGetProgramInfo().
2013-03-17 22:17:28 -04:00
Kyle Lutz
b88de104f3 Add queue.finish() call to test_mersenne_twister
This adds a call to queue.finish() to ensure that the results
are ready before being checked in the mersenne_twister test.
2013-03-14 22:17:50 -04:00
Kyle Lutz
e16890aa9f Add queue.finish() calls to test_merge
This adds calls to queue.finish() to ensure that the results
are ready before being checked in the merge test.
2013-03-14 22:16:39 -04:00
Kyle Lutz
ef2a14a278 Add queue.finish() calls to test_inplace_reduce
This adds calls to queue.finish() to ensure that the results
are ready before being checked in the inplace_reduce test.
2013-03-14 22:15:00 -04:00
Kyle Lutz
32a1926f6b Fix local array size in serial_insertion_sort()
This fixes the local array allocation size for the
serial_insertion_sort() function.
2013-03-14 21:27:00 -04:00
Kyle Lutz
77e75bd4cc Remove unused variable in serial_insertion_sort()
This removes the unused 'op' variable from the
serial_insertion_sort() function.
2013-03-14 21:22:40 -04:00
Kyle Lutz
ff204e1b61 Add asserts for null host pointers to command_queue
This adds assert()'s to the read and write methods in the
command_queue class to check for null host_ptr's.
2013-03-12 22:36:36 -04:00
Kyle Lutz
35984ae412 Remove default type_name_trait::value() implementation
This removes the default type_name_trait::value() function
implementation.

Previously, the default implementation would return a null
pointer leading to run-time errors if a type name was not
provided. Now, a compile-time error will occur if type_name()
is called for an unknown type.
2013-03-12 20:29:44 -04:00
Kyle Lutz
71df0d5fa6 Add type_name() specialization for char
This adds a type_name() specialization for char which is different
than the built-in cl_char type and thus was not covered before.
2013-03-12 20:23:33 -04:00
Kyle Lutz
9bd3e0e798 Add documentation for downloading and using the library
This adds more documentation with information on how to download
and how to compile programs with the boost compute library.
2013-03-10 20:42:16 -04:00
Kyle Lutz
de0bdcd2e4 Fix test module name for TestInsertionSort
This fixes the module name for the insertion sort test.
2013-03-10 20:21:26 -04:00
Kyle Lutz
30e5f6a836 Fix test module name for TestRadixSort
This fixes the module name for the radix sort test.
2013-03-10 20:20:32 -04:00
Kyle Lutz
08045a3466 Add test for sorting vectors by length
This adds a test for the sort() method which sorts a container
of 3D vectors by their length. This uses a lambda expression to
generate the compare function for the sort() algorithm.
2013-03-10 20:17:02 -04:00