ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/OpenCL/OpenCL.pm
(Generate patch)

Comparing OpenCL/OpenCL.pm (file contents):
Revision 1.1 by root, Tue Nov 15 06:50:30 2011 UTC vs.
Revision 1.13 by root, Thu Nov 17 03:01:35 2011 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines