ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/OpenCL/OpenCL.pm
Revision: 1.17
Committed: Thu Nov 17 03:56:07 2011 UTC (12 years, 6 months ago) by root
Branch: MAIN
Changes since 1.16: +2 -2 lines
Log Message:
*** empty log message ***

File Contents

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