… | |
… | |
28 | specific device ("compiling and linking"), also binary programs. For each |
28 | specific device ("compiling and linking"), also binary programs. For each |
29 | kernel function in a program you can then create an OpenCL::Kernel object |
29 | kernel function in a program you can then create an OpenCL::Kernel object |
30 | which represents basically a function call with argument values. |
30 | which represents basically a function call with argument values. |
31 | |
31 | |
32 | OpenCL::Memory objects of various flavours: OpenCL::Buffer objects (flat |
32 | OpenCL::Memory objects of various flavours: OpenCL::Buffer objects (flat |
33 | memory areas, think arrays or structs) and OpenCL::Image objects (think 2d |
33 | memory areas, think arrays or structs) and OpenCL::Image objects (think 2D |
34 | or 3d array) for bulk data and input and output for kernels. |
34 | or 3D array) for bulk data and input and output for kernels. |
35 | |
35 | |
36 | OpenCL::Sampler objects, which are kind of like texture filter modes in |
36 | OpenCL::Sampler objects, which are kind of like texture filter modes in |
37 | OpenGL. |
37 | OpenGL. |
38 | |
38 | |
39 | OpenCL::Queue objects - command queues, which allow you to submit memory |
39 | OpenCL::Queue objects - command queues, which allow you to submit memory |
… | |
… | |
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. |
|
|
132 | |
101 | |
133 | =head1 EXAMPLES |
102 | =head1 EXAMPLES |
134 | |
103 | |
135 | =head2 Enumerate all devices and get contexts for them. |
104 | =head2 Enumerate all devices and get contexts for them. |
136 | |
105 | |
… | |
… | |
424 | =item * This module expects all functions to return C<OpenCL::SUCCESS>. If any |
393 | =item * This module expects all functions to return C<OpenCL::SUCCESS>. If any |
425 | other status is returned the function will throw an exception, so you |
394 | other status is returned the function will throw an exception, so you |
426 | don't normally have to to any error checking. |
395 | don't normally have to to any error checking. |
427 | |
396 | |
428 | =back |
397 | =back |
|
|
398 | |
|
|
399 | =head2 CONSTANTS |
|
|
400 | |
|
|
401 | All C<CL_xxx> constants that this module supports are always available |
|
|
402 | in the C<OpenCL> namespace as C<OpenCL::xxx> (i.e. without the C<CL_> |
|
|
403 | prefix). Constants which are not defined in the heaer files used during |
|
|
404 | compilation, or otherwise are not available, will have the value C<-1>. |
|
|
405 | |
|
|
406 | =head2 OPENCL 1.1 VS. OPENCL 1.2 |
|
|
407 | |
|
|
408 | This module supports both OpenCL version 1.1 and 1.2, although the OpenCL |
|
|
409 | 1.2 interface hasn't been tested much for lack of availability of an |
|
|
410 | actual implementation. |
|
|
411 | |
|
|
412 | Every function or method in this manual page that interfaces to a |
|
|
413 | particular OpenCL function has a link to the its C manual page. |
|
|
414 | |
|
|
415 | If the link contains a F<1.1>, then this function is an OpenCL 1.1 |
|
|
416 | function. Most but not all also exist in OpenCL 1.2, and this module |
|
|
417 | tries to emulate the missing ones for you, when told to do so at |
|
|
418 | compiletime. You cna check whether a function was removed in OpenCL 1.2 by |
|
|
419 | replacing the F<1.1> component in the URL by F<1.2>. |
|
|
420 | |
|
|
421 | If the link contains a F<1.2>, then this is a OpenCL 1.2-only |
|
|
422 | function. Even if the module was compiled with OpenCL 1.2 header files |
|
|
423 | and has an 1.2 OpenCL library, calling such a function on a platform that |
|
|
424 | doesn't implement 1.2 causes undefined behaviour, usually a crash (But |
|
|
425 | this is not guaranteed). |
|
|
426 | |
|
|
427 | You can find out whether this module was compiled to prefer 1.1 |
|
|
428 | functionality by ooking at C<OpenCL::PREFER_1_1> - if it is true, then |
|
|
429 | 1.1 functions generally are implemented using 1.1 OpenCL functions. If it |
|
|
430 | is false, then 1.1 functions missing from 1.2 are emulated by calling 1.2 |
|
|
431 | fucntions. |
|
|
432 | |
|
|
433 | This is a somewhat sorry state of affairs, but the Khronos group choose to |
|
|
434 | make every release of OpenCL source and binary incompatible with previous |
|
|
435 | releases. |
429 | |
436 | |
430 | =head2 PERL AND OPENCL TYPES |
437 | =head2 PERL AND OPENCL TYPES |
431 | |
438 | |
432 | This handy(?) table lists OpenCL types and their perl, PDL and pack/unpack |
439 | This handy(?) table lists OpenCL types and their perl, PDL and pack/unpack |
433 | format equivalents: |
440 | format equivalents: |