… | |
… | |
96 | initialised at creation time). |
96 | initialised at creation time). |
97 | |
97 | |
98 | Enqueue the kernel execution. |
98 | Enqueue the kernel execution. |
99 | |
99 | |
100 | Enqueue buffer reads for your output buffer to read results. |
100 | Enqueue buffer reads for your output buffer to read results. |
|
|
101 | |
|
|
102 | =head1 OPENCL 1.1 VS. OPENCL 1.2 |
|
|
103 | |
|
|
104 | This module supports both OpenCL version 1.1 and 1.2, although the OpenCL |
|
|
105 | 1.2 interface hasn't been tested much for lack of availability of an |
|
|
106 | actual implementation. |
|
|
107 | |
|
|
108 | Every function or method in this manual page that interfaces to a |
|
|
109 | particular OpenCL function has a link to the its C manual page. |
|
|
110 | |
|
|
111 | If the link contains a F<1.1>, then this function is an OpenCL 1.1 |
|
|
112 | function. Most but not all also exist in OpenCL 1.2, and this module |
|
|
113 | tries to emulate the missing ones for you, when told to do so at |
|
|
114 | compiletime. You cna check whether a function was removed in OpenCL 1.2 by |
|
|
115 | replacing the F<1.1> component in the URL by F<1.2>. |
|
|
116 | |
|
|
117 | If the link contains a F<1.2>, then this is a OpenCL 1.2-only |
|
|
118 | function. Even if the module was compiled with OpenCL 1.2 header files |
|
|
119 | and has an 1.2 OpenCL library, calling such a function on a platform that |
|
|
120 | doesn't implement 1.2 causes undefined behaviour, usually a crash (But |
|
|
121 | this is not guaranteed). |
|
|
122 | |
|
|
123 | You can find out whether this module was compiled to prefer 1.1 |
|
|
124 | functionality by ooking at C<OpenCL::PREFER_1_1> - if it is true, then |
|
|
125 | 1.1 functions generally are implemented using 1.1 OpenCL functions. If it |
|
|
126 | is false, then 1.1 functions missing from 1.2 are emulated by calling 1.2 |
|
|
127 | fucntions. |
|
|
128 | |
|
|
129 | This is a somewhat sorry state of affairs, but the Khronos group choose to |
|
|
130 | make every release of OpenCL source and binary incompatible with previous |
|
|
131 | releases. |
101 | |
132 | |
102 | =head1 EXAMPLES |
133 | =head1 EXAMPLES |
103 | |
134 | |
104 | =head2 Enumerate all devices and get contexts for them. |
135 | =head2 Enumerate all devices and get contexts for them. |
105 | |
136 | |
… | |
… | |
620 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetPlatformIDs.html> |
651 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetPlatformIDs.html> |
621 | |
652 | |
622 | =item $ctx = OpenCL::context_from_type $properties, $type = OpenCL::DEVICE_TYPE_DEFAULT, $callback->($err, $pvt) = $print_stderr |
653 | =item $ctx = OpenCL::context_from_type $properties, $type = OpenCL::DEVICE_TYPE_DEFAULT, $callback->($err, $pvt) = $print_stderr |
623 | |
654 | |
624 | Tries to create a context from a default device and platform type - never worked for me. |
655 | Tries to create a context from a default device and platform type - never worked for me. |
|
|
656 | Consider using C<< $platform->context_from_type >> instead. |
625 | |
657 | |
626 | type: OpenCL::DEVICE_TYPE_DEFAULT, OpenCL::DEVICE_TYPE_CPU, OpenCL::DEVICE_TYPE_GPU, |
658 | type: OpenCL::DEVICE_TYPE_DEFAULT, OpenCL::DEVICE_TYPE_CPU, OpenCL::DEVICE_TYPE_GPU, |
627 | OpenCL::DEVICE_TYPE_ACCELERATOR, OpenCL::DEVICE_TYPE_CUSTOM, OpenCL::DEVICE_TYPE_ALL. |
659 | OpenCL::DEVICE_TYPE_ACCELERATOR, OpenCL::DEVICE_TYPE_CUSTOM, OpenCL::DEVICE_TYPE_ALL. |
628 | |
660 | |
629 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateContextFromType.html> |
661 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateContextFromType.html> |
630 | |
662 | |
631 | =item $ctx = OpenCL::context $properties, \@devices, $callback->($err, $pvt) = $print_stderr) |
663 | =item $ctx = OpenCL::context $properties, \@devices, $callback->($err, $pvt) = $print_stderr) |
632 | |
664 | |
633 | Create a new OpenCL::Context object using the given device object(s). This |
665 | Create a new OpenCL::Context object using the given device object(s). |
634 | function isn't implemented yet, use C<< $platform->context >> instead. |
666 | Consider using C<< $platform->context >> instead. |
635 | |
667 | |
636 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateContext.html> |
668 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateContext.html> |
637 | |
669 | |
638 | =item OpenCL::wait_for_events $wait_events... |
670 | =item OpenCL::wait_for_events $wait_events... |
639 | |
671 | |
… | |
… | |
1270 | =item $program = $ctx->program_with_built_in_kernels (\@devices, $kernel_names) |
1302 | =item $program = $ctx->program_with_built_in_kernels (\@devices, $kernel_names) |
1271 | |
1303 | |
1272 | Creates a new OpenCL::Program object from the given built-in kernel names. |
1304 | Creates a new OpenCL::Program object from the given built-in kernel names. |
1273 | |
1305 | |
1274 | L<http://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clCreateProgramWithBuiltInKernels.html> |
1306 | L<http://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clCreateProgramWithBuiltInKernels.html> |
|
|
1307 | |
|
|
1308 | =item $program = $ctx->link_program (\@devices, $options, \@programs, $cb->($program) = undef) |
|
|
1309 | |
|
|
1310 | Links all (already compiled) program objects specified in C<@programs> |
|
|
1311 | together and returns a new OpenCL::Program object with the result. |
|
|
1312 | |
|
|
1313 | L<http://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clLinkProgram.html> |
1275 | |
1314 | |
1276 | =item $packed_value = $ctx->info ($name) |
1315 | =item $packed_value = $ctx->info ($name) |
1277 | |
1316 | |
1278 | See C<< $platform->info >> for details. |
1317 | See C<< $platform->info >> for details. |
1279 | |
1318 | |
… | |
… | |
1773 | C<-cl-mad-enable>, C<-cl-no-signed-zeros>, C<-cl-unsafe-math-optimizations>, |
1812 | C<-cl-mad-enable>, C<-cl-no-signed-zeros>, C<-cl-unsafe-math-optimizations>, |
1774 | C<-cl-finite-math-only>, C<-cl-fast-relaxed-math>, |
1813 | C<-cl-finite-math-only>, C<-cl-fast-relaxed-math>, |
1775 | C<-w>, C<-Werror>, C<-cl-std=CL1.1/CL1.2>, C<-cl-kernel-arg-info>, |
1814 | C<-w>, C<-Werror>, C<-cl-std=CL1.1/CL1.2>, C<-cl-kernel-arg-info>, |
1776 | C<-create-library>, C<-enable-link-options>. |
1815 | C<-create-library>, C<-enable-link-options>. |
1777 | |
1816 | |
|
|
1817 | build_status: OpenCL::BUILD_SUCCESS, OpenCL::BUILD_NONE, |
|
|
1818 | OpenCL::BUILD_ERROR, OpenCL::BUILD_IN_PROGRESS. |
|
|
1819 | |
1778 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clBuildProgram.html> |
1820 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clBuildProgram.html> |
1779 | |
1821 | |
1780 | =item $program->build_async (\@devices = undef, $options = "", $cb->($program) = undef) |
1822 | =item $program->build_async (\@devices = undef, $options = "", $cb->($program) = undef) |
1781 | |
1823 | |
1782 | Similar to C<< ->build >>, except it starts a thread, and never fails (you |
1824 | Similar to C<< ->build >>, except it starts a thread, and never fails (you |
1783 | need to check the compilation status form the callback, or by polling). |
1825 | need to check the compilation status form the callback, or by polling). |
1784 | |
1826 | |
1785 | build_status: OpenCL::BUILD_SUCCESS, OpenCL::BUILD_NONE, |
1827 | =item $program->compile (\@devices = undef, $options = "", \%headers = undef, $cb->($program) = undef) |
1786 | OpenCL::BUILD_ERROR, OpenCL::BUILD_IN_PROGRESS. |
1828 | |
|
|
1829 | Compiles the given program for the given devices (or all devices if |
|
|
1830 | undef). If C<$headers> is given, it must be a hashref with include name => |
|
|
1831 | OpenCL::Program pairs. |
|
|
1832 | |
|
|
1833 | L<http://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clCompileProgram.html> |
1787 | |
1834 | |
1788 | =item $packed_value = $program->build_info ($device, $name) |
1835 | =item $packed_value = $program->build_info ($device, $name) |
1789 | |
1836 | |
1790 | Similar to C<< $platform->info >>, but returns build info for a previous |
1837 | Similar to C<< $platform->info >>, but returns build info for a previous |
1791 | build attempt for the given device. |
1838 | build attempt for the given device. |