… | |
… | |
43 | |
43 | |
44 | OpenCL::Event objects are used to signal when something is complete. |
44 | OpenCL::Event objects are used to signal when something is complete. |
45 | |
45 | |
46 | =head2 HELPFUL RESOURCES |
46 | =head2 HELPFUL RESOURCES |
47 | |
47 | |
48 | The OpenCL spec used to develop this module (1.2 spec was available, but |
48 | The OpenCL specs used to develop this module: |
49 | no implementation was available to me :). |
|
|
50 | |
49 | |
51 | http://www.khronos.org/registry/cl/specs/opencl-1.1.pdf |
50 | http://www.khronos.org/registry/cl/specs/opencl-1.1.pdf |
|
|
51 | http://www.khronos.org/registry/cl/specs/opencl-1.2.pdf |
|
|
52 | http://www.khronos.org/registry/cl/specs/opencl-1.2-extensions.pdf |
52 | |
53 | |
53 | OpenCL manpages: |
54 | OpenCL manpages: |
54 | |
55 | |
55 | http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/ |
56 | http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/ |
|
|
57 | http://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/ |
56 | |
58 | |
57 | If you are into UML class diagrams, the following diagram might help - if |
59 | If you are into UML class diagrams, the following diagram might help - if |
58 | not, it will be mildly cobfusing: |
60 | not, it will be mildly confusing (also, the class hierarchy of this module |
|
|
61 | is much more fine-grained): |
59 | |
62 | |
60 | http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/classDiagram.html |
63 | http://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/classDiagram.html |
61 | |
64 | |
62 | Here's a tutorial from AMD (very AMD-centric, too), not sure how useful it |
65 | Here's a tutorial from AMD (very AMD-centric, too), not sure how useful it |
63 | is, but at least it's free of charge: |
66 | is, but at least it's free of charge: |
64 | |
67 | |
65 | http://developer.amd.com/zones/OpenCLZone/courses/Documents/Introduction_to_OpenCL_Programming%20Training_Guide%20%28201005%29.pdf |
68 | http://developer.amd.com/zones/OpenCLZone/courses/Documents/Introduction_to_OpenCL_Programming%20Training_Guide%20%28201005%29.pdf |
… | |
… | |
1241 | |
1244 | |
1242 | =item $ev = $queue->enqueue_task ($kernel, $wait_events...) |
1245 | =item $ev = $queue->enqueue_task ($kernel, $wait_events...) |
1243 | |
1246 | |
1244 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueTask.html> |
1247 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueTask.html> |
1245 | |
1248 | |
1246 | =item $ev = $queue->enqueue_nd_range_kernel ($kernel, @$global_work_offset, @$global_work_size, @$local_work_size, $wait_events...) |
1249 | =item $ev = $queue->enqueue_nd_range_kernel ($kernel, \@global_work_offset, \@global_work_size, \@local_work_size, $wait_events...) |
1247 | |
1250 | |
1248 | Enqueues a kernel execution. |
1251 | Enqueues a kernel execution. |
1249 | |
1252 | |
1250 | @$global_work_size must be specified as a reference to an array of |
1253 | \@global_work_size must be specified as a reference to an array of |
1251 | integers specifying the work sizes (element counts). |
1254 | integers specifying the work sizes (element counts). |
1252 | |
1255 | |
1253 | @$global_work_offset must be either C<undef> (in which case all offsets |
1256 | \@global_work_offset must be either C<undef> (in which case all offsets |
1254 | are C<0>), or a reference to an array of work offsets, with the same number |
1257 | are C<0>), or a reference to an array of work offsets, with the same number |
1255 | of elements as @$global_work_size. |
1258 | of elements as \@global_work_size. |
1256 | |
1259 | |
1257 | @$local_work_size must be either C<undef> (in which case the |
1260 | \@local_work_size must be either C<undef> (in which case the |
1258 | implementation is supposed to choose good local work sizes), or a |
1261 | implementation is supposed to choose good local work sizes), or a |
1259 | reference to an array of local work sizes, with the same number of |
1262 | reference to an array of local work sizes, with the same number of |
1260 | elements as @$global_work_size. |
1263 | elements as \@global_work_size. |
1261 | |
1264 | |
1262 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueNDRangeKernel.html> |
1265 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueNDRangeKernel.html> |
1263 | |
1266 | |
1264 | =item $ev = $queue->enqueue_acquire_gl_objects ([object, ...], $wait_events...) |
1267 | =item $ev = $queue->enqueue_acquire_gl_objects ([object, ...], $wait_events...) |
1265 | |
1268 | |
… | |
… | |
1682 | |
1685 | |
1683 | Calls C<clGetKernelWorkGroupInfo> with C<CL_KERNEL_PRIVATE_MEM_SIZE> and returns the result. |
1686 | Calls C<clGetKernelWorkGroupInfo> with C<CL_KERNEL_PRIVATE_MEM_SIZE> and returns the result. |
1684 | |
1687 | |
1685 | =for gengetinfo end kernel_work_group |
1688 | =for gengetinfo end kernel_work_group |
1686 | |
1689 | |
1687 | =item $kernel->set_TYPE ($index, $value) |
1690 | =item $kernel->set_TYPE ($index, $value) |
1688 | |
1691 | |
|
|
1692 | =item $kernel->set_char ($index, $value) |
|
|
1693 | |
|
|
1694 | =item $kernel->set_uchar ($index, $value) |
|
|
1695 | |
|
|
1696 | =item $kernel->set_short ($index, $value) |
|
|
1697 | |
|
|
1698 | =item $kernel->set_ushort ($index, $value) |
|
|
1699 | |
|
|
1700 | =item $kernel->set_int ($index, $value) |
|
|
1701 | |
|
|
1702 | =item $kernel->set_uint ($index, $value) |
|
|
1703 | |
|
|
1704 | =item $kernel->set_long ($index, $value) |
|
|
1705 | |
|
|
1706 | =item $kernel->set_ulong ($index, $value) |
|
|
1707 | |
|
|
1708 | =item $kernel->set_half ($index, $value) |
|
|
1709 | |
|
|
1710 | =item $kernel->set_float ($index, $value) |
|
|
1711 | |
|
|
1712 | =item $kernel->set_double ($index, $value) |
|
|
1713 | |
|
|
1714 | =item $kernel->set_memory ($index, $value) |
|
|
1715 | |
|
|
1716 | =item $kernel->set_buffer ($index, $value) |
|
|
1717 | |
|
|
1718 | =item $kernel->set_image ($index, $value) |
|
|
1719 | |
|
|
1720 | =item $kernel->set_sampler ($index, $value) |
|
|
1721 | |
|
|
1722 | =item $kernel->set_local ($index, $value) |
|
|
1723 | |
|
|
1724 | =item $kernel->set_event ($index, $value) |
|
|
1725 | |
1689 | This is a family of methods to set the kernel argument with the number C<$index> to the give C<$value>. |
1726 | This is a family of methods to set the kernel argument with the number |
1690 | |
1727 | C<$index> to the give C<$value>. |
1691 | TYPE is one of C<char>, C<uchar>, C<short>, C<ushort>, C<int>, C<uint>, |
|
|
1692 | C<long>, C<ulong>, C<half>, C<float>, C<double>, C<memory>, C<buffer>, |
|
|
1693 | C<image2d>, C<image3d>, C<sampler>, C<local> or C<event>. |
|
|
1694 | |
1728 | |
1695 | Chars and integers (including the half type) are specified as integers, |
1729 | Chars and integers (including the half type) are specified as integers, |
1696 | float and double as floating point values, memory/buffer/image2d/image3d |
1730 | float and double as floating point values, memory/buffer/image must be |
1697 | must be an object of that type or C<undef>, local-memory arguments are |
1731 | an object of that type or C<undef>, local-memory arguments are set by |
1698 | set by specifying the size, and sampler and event must be objects of that |
1732 | specifying the size, and sampler and event must be objects of that type. |
1699 | type. |
1733 | |
|
|
1734 | Note that C<set_memory> works for all memory objects (all types of buffers |
|
|
1735 | and images) - the main purpose of the more specific C<set_TYPE> functions |
|
|
1736 | is type checking. |
1700 | |
1737 | |
1701 | Setting an argument for a kernel does NOT keep a reference to the object - |
1738 | Setting an argument for a kernel does NOT keep a reference to the object - |
1702 | for example, if you set an argument to some image object, free the image, |
1739 | for example, if you set an argument to some image object, free the image, |
1703 | and call the kernel, you will run into undefined behaviour. |
1740 | and call the kernel, you will run into undefined behaviour. |
1704 | |
1741 | |