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

Comparing OpenCL/OpenCL.pm (file contents):
Revision 1.19 by root, Sat Nov 19 19:54:04 2011 UTC vs.
Revision 1.20 by root, Sun Nov 20 01:09:48 2011 UTC

27OpenCL::Program objects, which store source code and, after building for a 27OpenCL::Program objects, which store source code and, after building for a
28specific device ("compiling and linking"), also binary programs. For each 28specific device ("compiling and linking"), also binary programs. For each
29kernel function in a program you can then create an OpenCL::Kernel object 29kernel function in a program you can then create an OpenCL::Kernel object
30which represents basically a function call with argument values. 30which represents basically a function call with argument values.
31 31
32OpenCL::Memory objects of various flavours: OpenCL::Buffers objects (flat 32OpenCL::Memory objects of various flavours: OpenCL::Buffer objects (flat
33memory areas, think arrays or structs) and OpenCL::Image objects (think 2d 33memory areas, think arrays or structs) and OpenCL::Image objects (think 2d
34or 3d array) for bulk data and input and output for kernels. 34or 3d array) for bulk data and input and output for kernels.
35 35
36OpenCL::Sampler objects, which are kind of like texture filter modes in 36OpenCL::Sampler objects, which are kind of like texture filter modes in
37OpenGL. 37OpenGL.
226 226
227=item * Object lifetime managament is automatic - there is no need 227=item * Object lifetime managament is automatic - there is no need
228to free objects explicitly (C<clReleaseXXX>), the release function 228to free objects explicitly (C<clReleaseXXX>), the release function
229is called automatically once all Perl references to it go away. 229is called automatically once all Perl references to it go away.
230 230
231=item * OpenCL uses CamelCase for function names (e.g. C<clGetPlatformIDs>, C<clGetPlatformInfo>), 231=item * OpenCL uses CamelCase for function names
232(e.g. C<clGetPlatformIDs>, C<clGetPlatformInfo>), while this module
232while this module uses underscores as word separator and often leaves out 233uses underscores as word separator and often leaves out prefixes
233prefixes (C<OpenCL::platforms>, C<< $platform->info >>). 234(C<OpenCL::platforms>, C<< $platform->info >>).
234 235
235=item * OpenCL often specifies fixed vector function arguments as short 236=item * OpenCL often specifies fixed vector function arguments as short
236arrays (C<size_t origin[3]>), while this module explicitly expects the 237arrays (C<size_t origin[3]>), while this module explicitly expects the
237components as separate arguments (C<$orig_x, $orig_y, $orig_z>) in 238components as separate arguments (C<$orig_x, $orig_y, $orig_z>) in
238function calls. 239function calls.
315 316
316=head2 THE OpenCL::Platform CLASS 317=head2 THE OpenCL::Platform CLASS
317 318
318=over 4 319=over 4
319 320
321=item @devices = $platform->devices ($type = OpenCL::DEVICE_TYPE_ALL)
322
323Returns a list of matching OpenCL::Device objects.
324
325=item $ctx = $platform->context_from_type ($properties, $type = OpenCL::DEVICE_TYPE_DEFAULT, $notify = undef)
326
327Tries to create a context. Never worked for me, and you need devices explitly anyway.
328
329L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateContextFromType.html>
330
331=item $ctx = $device->context ($properties = undef, @$devices, $notify = undef)
332
333Create a new OpenCL::Context object using the given device object(s)- a
334CL_CONTEXT_PLATFORM property is supplied automatically.
335
336L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateContext.html>
337
320=item $packed_value = $platform->info ($name) 338=item $packed_value = $platform->info ($name)
321 339
322Calls C<clGetPlatformInfo> and returns the packed, raw value - for 340Calls C<clGetPlatformInfo> and returns the packed, raw value - for
323strings, this will be the string, for other values you probably need to 341strings, this will be the string, for other values you probably need to
324use the correct C<unpack>. This might get improved in the future. Hopefully. 342use the correct C<unpack>.
343
344It's best to avoid this method and use one of the predefined C<get_*>
345methods.
325 346
326L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetPlatformInfo.html> 347L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetPlatformInfo.html>
327 348
328=item @devices = $platform->devices ($type = OpenCL::DEVICE_TYPE_ALL) 349=for gengetinfo begin platform
329 350
330Returns a list of matching OpenCL::Device objects.
331 351
332=item $ctx = $platform->context_from_type ($properties, $type = OpenCL::DEVICE_TYPE_DEFAULT, $notify = undef) 352=item $string = $platform->profile
333 353
334Tries to create a context. Never worked for me, and you need devices explitly anyway. 354Calls C<clGetPlatformInfo> with C<CL_PLATFORM_PROFILE> and returns the result(s).
335 355
336L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateContextFromType.html> 356=item $string = $platform->version
337 357
338=item $ctx = $device->context ($properties = undef, @$devices, $notify = undef) 358Calls C<clGetPlatformInfo> with C<CL_PLATFORM_VERSION> and returns the result(s).
339 359
340Create a new OpenCL::Context object using the given device object(s)- a 360=item $string = $platform->name
341CL_CONTEXT_PLATFORM property is supplied automatically.
342 361
343L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateContext.html> 362Calls C<clGetPlatformInfo> with C<CL_PLATFORM_NAME> and returns the result(s).
363
364=item $string = $platform->vendor
365
366Calls C<clGetPlatformInfo> with C<CL_PLATFORM_VENDOR> and returns the result(s).
367
368=item $string = $platform->extensions
369
370Calls C<clGetPlatformInfo> with C<CL_PLATFORM_EXTENSIONS> and returns the result(s).
371=for gengetinfo end platform
344 372
345=back 373=back
346 374
347=head2 THE OpenCL::Device CLASS 375=head2 THE OpenCL::Device CLASS
348 376
357=back 385=back
358 386
359=head2 THE OpenCL::Context CLASS 387=head2 THE OpenCL::Context CLASS
360 388
361=over 4 389=over 4
362
363=item $packed_value = $ctx->info ($name)
364
365See C<< $platform->info >> for details.
366
367L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetContextInfo.html>
368 390
369=item $queue = $ctx->queue ($device, $properties) 391=item $queue = $ctx->queue ($device, $properties)
370 392
371Create a new OpenCL::Queue object from the context and the given device. 393Create a new OpenCL::Queue object from the context and the given device.
372 394
416=item $program = $ctx->program_with_source ($string) 438=item $program = $ctx->program_with_source ($string)
417 439
418Creates a new OpenCL::Program object from the given source code. 440Creates a new OpenCL::Program object from the given source code.
419 441
420L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateProgramWithSource.html> 442L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateProgramWithSource.html>
443
444=item $packed_value = $ctx->info ($name)
445
446See C<< $platform->info >> for details.
447
448L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetContextInfo.html>
449
450=for gengetinfo begin context
451
452=for gengetinfo end context
421 453
422=back 454=back
423 455
424=head2 THE OpenCL::Queue CLASS 456=head2 THE OpenCL::Queue CLASS
425 457
547 579
548L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetMemObjectInfo.html> 580L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetMemObjectInfo.html>
549 581
550=back 582=back
551 583
584=head2 THE OpenCL::Image CLASS
585
586This is the superclass of all image objects - OpenCL::Image2D and OpenCL::Image3D.
587
588=over 4
589
590=item $packed_value = $ev->image_info ($name)
591
592See C<< $platform->info >> for details.
593
594The reason this method is not called C<info> is that there already is an
595C<< ->info >> method inherited from C<OpenCL::Memory>.
596
597L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetImageInfo.html>
598
599=back
600
552=head2 THE OpenCL::Sampler CLASS 601=head2 THE OpenCL::Sampler CLASS
553 602
554=over 4 603=over 4
555 604
556=item $packed_value = $sampler->info ($name) 605=item $packed_value = $sampler->info ($name)
600=item $packed_value = $kernel->info ($name) 649=item $packed_value = $kernel->info ($name)
601 650
602See C<< $platform->info >> for details. 651See C<< $platform->info >> for details.
603 652
604L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetKernelInfo.html> 653L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetKernelInfo.html>
654
655=item $packed_value = $kernel->work_group_info ($device, $name)
656
657See C<< $platform->info >> for details.
658
659The reason this method is not called C<info> is that there already is an
660C<< ->info >> method.
661
662L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetKernelWorkGroupInfo.html>
605 663
606=item $kernel->set_TYPE ($index, $value) 664=item $kernel->set_TYPE ($index, $value)
607 665
608This is a family of methods to set the kernel argument with the number C<$index> to the give C<$value>. 666This is a family of methods to set the kernel argument with the number C<$index> to the give C<$value>.
609 667
631 689
632See C<< $platform->info >> for details. 690See C<< $platform->info >> for details.
633 691
634L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetEventInfo.html> 692L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetEventInfo.html>
635 693
694=item $packed_value = $ev->profiling_info ($name)
695
696See C<< $platform->info >> for details.
697
698The reason this method is not called C<info> is that there already is an
699C<< ->info >> method.
700
701L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetProfilingInfo.html>
702
636=item $ev->wait 703=item $ev->wait
637 704
638Waits for the event to complete. 705Waits for the event to complete.
639 706
640L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clWaitForEvents.html> 707L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clWaitForEvents.html>

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines