ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/OpenCL/OpenCL.pm
Revision: 1.10
Committed: Thu Nov 17 02:10:39 2011 UTC (12 years, 6 months ago) by root
Branch: MAIN
Changes since 1.9: +13 -13 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.1 =head1 NAME
2    
3 root 1.5 OpenCL - Open Computing Language Bindings
4 root 1.1
5     =head1 SYNOPSIS
6    
7     use OpenCL;
8    
9     =head1 DESCRIPTION
10    
11 root 1.7 This is an early release which might be useful, but hasn't seen much testing.
12 root 1.1
13 root 1.9 =head2 OpenCL FROM 10000 FEET HEIGHT
14    
15     Here is a high level overview of OpenCL:
16    
17     First you need to find one or more OpenCL::Platforms (kind of like
18     vendors) - usually there is only one.
19    
20     Each platform gives you access to a number of OpenCL::Device objects, e.g.
21     your graphics card.
22    
23     From a platform and some devices, you create an OpenCL::Context, which is
24     a very central object in OpenCL: Once you have a context you can create
25     most other objects:
26    
27     OpenCL::Program objects, which store source code and, after building
28     ("compiling and linking"), also binary programs. For each kernel function
29     in a program you can then create an OpenCL::Kernel object which represents
30     basically a function call with argument values.
31    
32     OpenCL::Memory objects of various flavours: OpenCL::Buffers objects (flat
33     memory areas, think array) and OpenCL::Image objects (think 2d or 3d
34     array) for bulk data and input and output for kernels.
35    
36     OpenCL::Sampler objects, which are kind of like texture filter modes in
37     OpenGL.
38    
39     OpenCL::Queue objects - command queues, which allow you to submit memory
40     reads, writes and copies, as well as kernel calls to your devices. They
41     also offer a variety of methods to synchronise request execution, for
42     example with barriers or OpenCL::Event objects.
43    
44     OpenCL::Event objects are used to signal when something is complete.
45    
46     =head2 HELPFUL RESOURCES
47 root 1.3
48 root 1.5 The OpenCL spec used to develop this module (1.2 spec was available, but
49 root 1.3 no implementation was available to me :).
50    
51     http://www.khronos.org/registry/cl/specs/opencl-1.1.pdf
52    
53     OpenCL manpages:
54    
55     http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/
56    
57 root 1.9 =head1 BASIC WORKFLOW
58    
59     To get something done, you basically have to do this once:
60    
61     Find some platform (e.g. the first one) and some device (e.g. the first
62     device you can find), and create a context from those.
63    
64     Create a command queue from your context, and program objects from your
65     OpenCL source code, build the programs.
66    
67     Create kernel objects for all kernels you want to use.
68    
69     Then, to execute stuff, you repeat this:
70    
71     Create some input and output buffers from your context. Initialise the
72     input buffers with data. Set these as arguments to your kernel.
73    
74     Enqueue the kernel execution.
75    
76     Enqueue buffer reads for your output buffer to read results.
77    
78     The next section shows how this can be done.
79    
80 root 1.3 =head1 EXAMPLES
81    
82 root 1.5 =head2 Enumerate all devices and get contexts for them.
83 root 1.1
84     for my $platform (OpenCL::platforms) {
85 root 1.10 printf "platform: %s\n", $platform->info (OpenCL::PLATFORM_NAME);
86     printf "extensions: %s\n", $platform->info (OpenCL::PLATFORM_EXTENSIONS);
87 root 1.1 for my $device ($platform->devices) {
88 root 1.10 printf "+ device: %s\n", $device->info (OpenCL::DEVICE_NAME);
89     my $ctx = $device->context;
90 root 1.1 # do stuff
91     }
92     }
93    
94 root 1.5 =head2 Get a useful context and a command queue.
95 root 1.1
96     my $dev = ((OpenCL::platforms)[0]->devices)[0];
97 root 1.10 my $ctx = $dev->context;
98 root 1.9 my $queue = $ctx->queue ($dev);
99 root 1.1
100 root 1.5 =head2 Print all supported image formats of a context.
101    
102     for my $type (OpenCL::MEM_OBJECT_IMAGE2D, OpenCL::MEM_OBJECT_IMAGE3D) {
103 root 1.10 print "supported image formats for ", OpenCL::enum2str $type, "\n";
104 root 1.5
105     for my $f ($ctx->supported_image_formats (0, $type)) {
106     printf " %-10s %-20s\n", OpenCL::enum2str $f->[0], OpenCL::enum2str $f->[1];
107     }
108     }
109    
110     =head2 Create a buffer with some predefined data, read it back synchronously,
111     then asynchronously.
112 root 1.3
113     my $buf = $ctx->buffer_sv (OpenCL::MEM_COPY_HOST_PTR, "helmut");
114    
115     $queue->enqueue_read_buffer ($buf, 1, 1, 3, my $data);
116 root 1.10 print "$data\n";
117 root 1.3
118     my $ev = $queue->enqueue_read_buffer ($buf, 0, 1, 3, my $data);
119     $ev->wait;
120 root 1.10 print "$data\n"; # prints "elm"
121 root 1.3
122 root 1.5 =head2 Create and build a program, then create a kernel out of one of its
123     functions.
124 root 1.3
125     my $src = '
126     __kernel void
127     squareit (__global float *input, __global float *output)
128     {
129     size_t id = get_global_id (0);
130     output [id] = input [id] * input [id];
131     }
132     ';
133    
134     my $prog = $ctx->program_with_source ($src);
135    
136     eval { $prog->build ($dev); 1 }
137     or die $prog->build_info ($dev, OpenCL::PROGRAM_BUILD_LOG);
138    
139     my $kernel = $prog->kernel ("squareit");
140    
141 root 1.5 =head2 Create some input and output float buffers, then call squareit on them.
142 root 1.4
143     my $input = $ctx->buffer_sv (OpenCL::MEM_COPY_HOST_PTR, pack "f*", 1, 2, 3, 4.5);
144     my $output = $ctx->buffer (0, OpenCL::SIZEOF_FLOAT * 5);
145    
146     # set buffer
147     $kernel->set_buffer (0, $input);
148     $kernel->set_buffer (1, $output);
149    
150     # execute it for all 4 numbers
151     $queue->enqueue_nd_range_kernel ($kernel, undef, [4], undef);
152    
153 root 1.5 # enqueue a synchronous read
154     $queue->enqueue_read_buffer ($output, 1, 0, OpenCL::SIZEOF_FLOAT * 4, my $data);
155    
156     # print the results:
157 root 1.10 printf "%s\n", join ", ", unpack "f*", $data;
158 root 1.5
159     =head2 The same enqueue operations as before, but assuming an out-of-order queue,
160     showing off barriers.
161    
162     # execute it for all 4 numbers
163     $queue->enqueue_nd_range_kernel ($kernel, undef, [4], undef);
164    
165     # enqueue a barrier to ensure in-order execution
166 root 1.4 $queue->enqueue_barrier;
167    
168 root 1.5 # enqueue an async read
169     $queue->enqueue_read_buffer ($output, 0, 0, OpenCL::SIZEOF_FLOAT * 4, my $data);
170    
171     # wait for all requests to finish
172     $queue->finish;
173    
174     =head2 The same enqueue operations as before, but assuming an out-of-order queue,
175     showing off event objects and wait lists.
176    
177     # execute it for all 4 numbers
178     my $ev = $queue->enqueue_nd_range_kernel ($kernel, undef, [4], undef);
179    
180     # enqueue an async read
181     $ev = $queue->enqueue_read_buffer ($output, 0, 0, OpenCL::SIZEOF_FLOAT * 4, my $data, $ev);
182    
183     # wait for the last event to complete
184 root 1.4 $ev->wait;
185    
186 root 1.5 =head1 DOCUMENTATION
187    
188     =head2 BASIC CONVENTIONS
189    
190     This is not a 1:1 C-style translation of OpenCL to Perl - instead I
191     attempted to make the interface as type-safe as possible and introducing
192     object syntax where it makes sense. There are a number of important
193     differences between the OpenCL C API and this module:
194    
195     =over 4
196    
197     =item * Object lifetime managament is automatic - there is no need
198     to free objects explicitly (C<clReleaseXXX>), the release function
199     is called automatically once all Perl references to it go away.
200    
201     =item * OpenCL uses CamelCase for function names (C<clGetPlatformInfo>),
202     while this module uses underscores as word separator and often leaves out
203     prefixes (C<< $platform->info >>).
204    
205     =item * OpenCL often specifies fixed vector function arguments as short
206     arrays (C<size_t origin[3]>), while this module explicitly expects the
207     components as separate arguments-
208    
209 root 1.9 =item * Where possible, one of the pitch values is calculated from the
210     perl scalar length and need not be specified.
211 root 1.5
212     =item * When enqueuing commands, the wait list is specified by adding
213 root 1.9 extra arguments to the function - anywhere a C<$wait_events...> argument
214 root 1.5 is documented this can be any number of event objects.
215    
216     =item * When enqueuing commands, if the enqueue method is called in void
217     context, no event is created. In all other contexts an event is returned
218     by the method.
219    
220     =item * This module expects all functions to return C<CL_SUCCESS>. If any
221     other status is returned the function will throw an exception, so you
222     don't normally have to to any error checking.
223    
224     =back
225    
226 root 1.7 =head2 PERL AND OPENCL TYPES
227    
228 root 1.8 This handy(?) table lists OpenCL types and their perl, PDL and pack/unpack
229 root 1.7 format equivalents:
230    
231 root 1.8 OpenCL perl PDL pack/unpack
232     char IV - c
233     uchar IV byte C
234     short IV short s
235     ushort IV ushort S
236     int IV long? l
237     uint IV - L
238     long IV longlong q
239     ulong IV - Q
240     float NV float f
241     half IV ushort S
242     double NV double d
243 root 1.7
244 root 1.5 =head2 THE OpenCL PACKAGE
245    
246     =over 4
247    
248     =item $int = OpenCL::errno
249    
250     The last error returned by a function - it's only changed on errors.
251    
252     =item $str = OpenCL::err2str $errval
253    
254     Comverts an error value into a human readable string.
255    
256 root 1.9 =item $str = OpenCL::enum2str $enum
257 root 1.5
258     Converts most enum values (inof parameter names, image format constants,
259     object types, addressing and filter modes, command types etc.) into a
260     human readbale string. When confronted with some random integer it can be
261     very helpful to pass it through this function to maybe get some readable
262     string out of it.
263    
264     =item @platforms = OpenCL::platforms
265    
266     Returns all available OpenCL::Platform objects.
267    
268     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetPlatformIDs.html>
269    
270 root 1.10 =item $ctx = OpenCL::context_from_type $properties, $type = OpenCL::DEVICE_TYPE_DEFAULT, $notify = undef
271 root 1.5
272     Tries to create a context from a default device and platform - never worked for me.
273    
274     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateContextFromType.html>
275    
276     =item OpenCL::wait_for_events $wait_events...
277    
278     Waits for all events to complete.
279    
280     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clWaitForEvents.html>
281    
282     =back
283    
284     =head2 THE OpenCL::Platform CLASS
285    
286     =over 4
287    
288     =item $packed_value = $platform->info ($name)
289    
290     Calls C<clGetPlatformInfo> and returns the packed, raw value - for
291     strings, this will be the string, for other values you probably need to
292     use the correct C<unpack>. This might get improved in the future. Hopefully.
293    
294     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetPlatformInfo.html>
295    
296     =item @devices = $platform->devices ($type = OpenCL::DEVICE_TYPE_ALL)
297    
298     Returns a list of matching OpenCL::Device objects.
299    
300 root 1.10 =item $ctx = $platform->context_from_type ($properties, $type = OpenCL::DEVICE_TYPE_DEFAULT, $notify = undef)
301 root 1.5
302     Tries to create a context. Never worked for me.
303    
304     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateContextFromType.html>
305    
306     =back
307    
308     =head2 THE OpenCL::Device CLASS
309    
310     =over 4
311    
312     =item $packed_value = $device->info ($name)
313    
314     See C<< $platform->info >> for details.
315    
316     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetDeviceInfo.html>
317    
318 root 1.10 =item $ctx = $device->context ($properties = undef, $notify = undef)
319 root 1.5
320 root 1.10 Create a new OpenCL::Context object.
321 root 1.5
322     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateContext.html>
323    
324     =back
325    
326     =head2 THE OpenCL::Context CLASS
327    
328     =over 4
329    
330     =item $packed_value = $ctx->info ($name)
331    
332     See C<< $platform->info >> for details.
333    
334     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetContextInfo.html>
335    
336 root 1.9 =item $queue = $ctx->queue ($device, $properties)
337 root 1.5
338 root 1.9 Create a new OpenCL::Queue object from the context and the given device.
339 root 1.5
340     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateCommandQueue.html>
341    
342     =item $ev = $ctx->user_event
343    
344     Creates a new OpenCL::UserEvent object.
345    
346     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateUserEvent.html>
347    
348     =item $buf = $ctx->buffer ($flags, $len)
349    
350     Creates a new OpenCL::Buffer object with the given flags and octet-size.
351    
352     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateBuffer.html>
353    
354     =item $buf = $ctx->buffer_sv ($flags, $data)
355    
356     Creates a new OpenCL::Buffer object and initialise it with the given data values.
357    
358     =item $img = $ctx->image2d ($flags, $channel_order, $channel_type, $width, $height, $data)
359    
360     Creates a new OpenCL::Image2D object and optionally initialises it with the given data values.
361    
362     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateImage2D.html>
363    
364     =item $img = $ctx->image3d ($flags, $channel_order, $channel_type, $width, $height, $depth, $slice_pitch, $data)
365    
366     Creates a new OpenCL::Image3D object and optionally initialises it with the given data values.
367    
368     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateImage3D.html>
369    
370     =item @formats = $ctx->supported_image_formats ($flags, $image_type)
371    
372     Returns a list of matching image formats - each format is an arrayref with
373     two values, $channel_order and $channel_type, in it.
374    
375     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetSupportedImageFormats.html>
376    
377     =item $sampler = $ctx->sampler ($normalized_coords, $addressing_mode, $filter_mode)
378    
379     Creates a new OpenCL::Sampler object.
380    
381     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateSampler.html>
382    
383     =item $program = $ctx->program_with_source ($string)
384    
385     Creates a new OpenCL::Program object from the given source code.
386    
387     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateProgramWithSource.html>
388    
389     =back
390    
391     =head2 THE OpenCL::Queue CLASS
392    
393     An OpenCL::Queue represents an execution queue for OpenCL. You execute
394     requests by calling their respective C<enqueue_xxx> method and waitinf for
395     it to complete in some way.
396    
397     All the enqueue methods return an event object that can be used to wait
398     for completion, unless the method is called in void context, in which case
399     no event object is created.
400    
401     They also allow you to specify any number of other event objects that this
402     request has to wait for before it starts executing, by simply passing the
403     event objects as extra parameters to the enqueue methods.
404    
405     Queues execute in-order by default, without any parallelism, so in most
406 root 1.6 cases (i.e. you use only one queue) it's not necessary to wait for or
407     create event objects.
408 root 1.5
409     =over 4
410    
411     =item $packed_value = $ctx->info ($name)
412    
413     See C<< $platform->info >> for details.
414    
415     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetCommandQueueInfo.html>
416    
417     =item $ev = $queue->enqueue_read_buffer ($buffer, $blocking, $offset, $len, $data, $wait_events...)
418    
419     Reads data from buffer into the given string.
420    
421     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueReadBuffer.html>
422    
423     =item $ev = $queue->enqueue_write_buffer ($buffer, $blocking, $offset, $data, $wait_events...)
424    
425     Writes data to buffer from the given string.
426    
427     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueWriteBuffer.html>
428    
429     =item $ev = $queue->enqueue_copy_buffer ($src, $dst, $src_offset, $dst_offset, $len, $wait_events...)
430    
431     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueCopyBuffer.html>
432    
433     =item $ev = $queue->enqueue_read_image ($src, $blocking, $x, $y, $z, $width, $height, $depth, $row_pitch, $slice_pitch, $data, $wait_events...)
434    
435     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueReadImage.html>
436    
437     =item $ev = $queue->enqueue_write_image ($src, $blocking, $x, $y, $z, $width, $height, $depth, $row_pitch, $data, $wait_events...)
438    
439     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueWriteImage.html>
440    
441     =item $ev = $queue->enqueue_copy_buffer_rect ($src, $dst, $src_x, $src_y, $src_z, $dst_x, $dst_y, $dst_z, $width, $height, $depth, $src_row_pitch, $src_slice_pitch, 4dst_row_pitch, $dst_slice_pitch, $ait_event...)
442    
443     Yeah.
444    
445     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueCopyBufferRect.html>
446    
447     =item $ev = $queue->enqueue_copy_buffer_to_image (OpenCL::Buffer src, OpenCL::Image dst, size_t src_offset, size_t dst_x, size_t dst_y, size_t dst_z, size_t width, size_t height, size_t depth, ...)
448    
449     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueCopyBufferToImage.html>.
450    
451     =item $ev = $queue->enqueue_copy_image (OpenCL::Image src, OpenCL::Buffer dst, size_t src_x, size_t src_y, size_t src_z, size_t dst_x, size_t dst_y, size_t dst_z, size_t width, size_t height, size_t depth, ...)
452    
453     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueCopyImage.html>
454    
455     =item $ev = $queue->enqueue_copy_image_to_buffer (OpenCL::Image src, OpenCL::Buffer dst, size_t src_x, size_t src_y, size_t src_z, size_t width, size_t height, size_t depth, size_t dst_offset, ...)
456    
457     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueCopyImageToBuffer.html>
458    
459     =item $ev = $queue->enqueue_task ($kernel, $wait_events...)
460    
461     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueTask.html>
462    
463     =item $ev = $queue->enqueue_nd_range_kernel ($kernel, @$global_work_offset, @$global_work_size, @$local_work_size, $wait_events...)
464    
465     Enqueues a kernel execution.
466    
467     @$global_work_size must be specified as a reference to an array of
468     integers specifying the work sizes (element counts).
469    
470     @$global_work_offset must be either C<undef> (in which case all offsets
471     are C<0>), or a reference to an array of work offsets, with the same number
472     of elements as @$global_work_size.
473    
474     @$local_work_size must be either C<undef> (in which case the
475     implementation is supposed to choose good local work sizes), or a
476     reference to an array of local work sizes, with the same number of
477     elements as @$global_work_size.
478    
479     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueNDRangeKernel.html>
480    
481     =item $ev = $queue->enqueue_marker
482    
483     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueMarker.html>
484    
485     =item $ev = $queue->enqueue_wait_for_events ($wait_events...)
486    
487     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueWaitForEvents.html>
488    
489     =item $queue->enqueue_barrier
490    
491     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueBarrier.html>
492    
493     =item $queue->flush
494    
495     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clFlush.html>
496    
497     =item $queue->finish
498    
499     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clFinish.html>
500    
501     =back
502    
503     =head2 THE OpenCL::Memory CLASS
504    
505     This the superclass of all memory objects - OpenCL::Buffer, OpenCL::Image,
506     OpenCL::Image2D and OpenCL::Image3D. The subclasses of this class
507     currently only exist to allow type-checking.
508    
509     =over 4
510    
511     =item $packed_value = $memory->info ($name)
512    
513     See C<< $platform->info >> for details.
514    
515     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetMemObjectInfo.html>
516    
517     =back
518    
519     =head2 THE OpenCL::Sampler CLASS
520    
521     =over 4
522    
523     =item $packed_value = $sampler->info ($name)
524    
525     See C<< $platform->info >> for details.
526    
527     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetSamplerInfo.html>
528    
529     =back
530    
531     =head2 THE OpenCL::Program CLASS
532    
533     =over 4
534    
535     =item $packed_value = $program->info ($name)
536    
537     See C<< $platform->info >> for details.
538    
539     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetProgramInfo.html>
540    
541     =item $program->build ($device, $options = "")
542    
543     Tries to build the program with the givne options.
544    
545     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clBuildProgram.html>
546    
547     =item $packed_value = $program->build_info ($device, $name)
548    
549     Similar to C<< $platform->info >>, but returns build info for a previous
550     build attempt for the given device.
551    
552     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetBuildInfo.html>
553    
554     =item $kernel = $program->kernel ($function_name)
555    
556     Creates an OpenCL::Kernel object out of the named C<__kernel> function in
557     the program.
558    
559     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateKernel.html>
560    
561     =back
562    
563     =head2 THE OpenCL::Kernel CLASS
564    
565     =over 4
566    
567     =item $packed_value = $kernel->info ($name)
568    
569     See C<< $platform->info >> for details.
570    
571     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetKernelInfo.html>
572    
573     =item $kernel->set_TYPE ($index, $value)
574    
575     This is a family of methods to set the kernel argument with the number C<$index> to the give C<$value>.
576    
577     TYPE is one of C<char>, C<uchar>, C<short>, C<ushort>, C<int>, C<uint>,
578     C<long>, C<ulong>, C<half>, C<float>, C<double>, C<memory>, C<buffer>,
579     C<image2d>, C<image3d>, C<sampler> or C<event>.
580    
581     Chars and integers (including the half type) are specified as integers,
582     float and double as floating point values, memory/buffer/image2d/image3d
583     must be an object of that type or C<undef>, and sampler and event must be
584     objects of that type.
585    
586     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clSetKernelArg.html>
587    
588     =back
589    
590     =head2 THE OpenCL::Event CLASS
591    
592     This is the superclass for all event objects (including OpenCL::UserEvent
593     objects).
594    
595     =over 4
596    
597     =item $packed_value = $ev->info ($name)
598    
599     See C<< $platform->info >> for details.
600    
601     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetEventInfo.html>
602    
603     =item $ev->wait
604    
605     Waits for the event to complete.
606    
607     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clWaitForEvents.html>
608    
609     =back
610    
611     =head2 THE OpenCL::UserEvent CLASS
612    
613     This is a subclass of OpenCL::Event.
614 root 1.4
615 root 1.1 =over 4
616    
617 root 1.5 =item $ev->set_status ($execution_status)
618    
619     L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clSetUserEventStatus.html>
620    
621     =back
622    
623 root 1.1 =cut
624    
625     package OpenCL;
626    
627 root 1.2 use common::sense;
628    
629 root 1.1 BEGIN {
630 root 1.5 our $VERSION = '0.03';
631 root 1.1
632     require XSLoader;
633     XSLoader::load (__PACKAGE__, $VERSION);
634 root 1.3
635 root 1.5 @OpenCL::Buffer::ISA =
636     @OpenCL::Image::ISA = OpenCL::Memory::;
637 root 1.3
638 root 1.5 @OpenCL::Image2D::ISA =
639     @OpenCL::Image3D::ISA = OpenCL::Image::;
640    
641     @OpenCL::UserEvent::ISA = OpenCL::Event::;
642 root 1.1 }
643    
644     1;
645    
646     =head1 AUTHOR
647    
648     Marc Lehmann <schmorp@schmorp.de>
649     http://home.schmorp.de/
650    
651     =cut
652