… | |
… | |
27 | OpenCL::Program objects, which store source code and, after building for a |
27 | OpenCL::Program objects, which store source code and, after building for a |
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::Buffers 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. |
… | |
… | |
226 | |
226 | |
227 | =item * Object lifetime managament is automatic - there is no need |
227 | =item * Object lifetime managament is automatic - there is no need |
228 | to free objects explicitly (C<clReleaseXXX>), the release function |
228 | to free objects explicitly (C<clReleaseXXX>), the release function |
229 | is called automatically once all Perl references to it go away. |
229 | is called automatically once all Perl references to it go away. |
230 | |
230 | |
231 | =item * OpenCL uses CamelCase for function names (C<clGetPlatformInfo>), |
231 | =item * OpenCL uses CamelCase for function names |
|
|
232 | (e.g. C<clGetPlatformIDs>, C<clGetPlatformInfo>), while this module |
232 | while this module uses underscores as word separator and often leaves out |
233 | uses underscores as word separator and often leaves out prefixes |
233 | prefixes (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 |
236 | arrays (C<$origin[3]>), while this module explicitly expects the |
237 | arrays (C<size_t origin[3]>), while this module explicitly expects the |
237 | components as separate arguments- |
238 | components as separate arguments (C<$orig_x, $orig_y, $orig_z>) in |
|
|
239 | function calls. |
238 | |
240 | |
239 | =item * Structures are often specified with their components, and returned |
241 | =item * Structures are often specified by flattening out their components |
240 | as arrayrefs. |
242 | as with short vectors, and returned as arrayrefs. |
241 | |
|
|
242 | =item * Where possible, one of the pitch values is calculated from the |
|
|
243 | perl scalar length and need not be specified. |
|
|
244 | |
243 | |
245 | =item * When enqueuing commands, the wait list is specified by adding |
244 | =item * When enqueuing commands, the wait list is specified by adding |
246 | extra arguments to the function - anywhere a C<$wait_events...> argument |
245 | extra arguments to the function - anywhere a C<$wait_events...> argument |
247 | is documented this can be any number of event objects. |
246 | is documented this can be any number of event objects. |
248 | |
247 | |
… | |
… | |
317 | |
316 | |
318 | =head2 THE OpenCL::Platform CLASS |
317 | =head2 THE OpenCL::Platform CLASS |
319 | |
318 | |
320 | =over 4 |
319 | =over 4 |
321 | |
320 | |
|
|
321 | =item @devices = $platform->devices ($type = OpenCL::DEVICE_TYPE_ALL) |
|
|
322 | |
|
|
323 | Returns a list of matching OpenCL::Device objects. |
|
|
324 | |
|
|
325 | =item $ctx = $platform->context_from_type ($properties, $type = OpenCL::DEVICE_TYPE_DEFAULT, $notify = undef) |
|
|
326 | |
|
|
327 | Tries to create a context. Never worked for me, and you need devices explitly anyway. |
|
|
328 | |
|
|
329 | L<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 | |
|
|
333 | Create a new OpenCL::Context object using the given device object(s)- a |
|
|
334 | CL_CONTEXT_PLATFORM property is supplied automatically. |
|
|
335 | |
|
|
336 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateContext.html> |
|
|
337 | |
322 | =item $packed_value = $platform->info ($name) |
338 | =item $packed_value = $platform->info ($name) |
323 | |
339 | |
324 | Calls C<clGetPlatformInfo> and returns the packed, raw value - for |
340 | Calls C<clGetPlatformInfo> and returns the packed, raw value - for |
325 | strings, this will be the string, for other values you probably need to |
341 | strings, this will be the string, for other values you probably need to |
326 | use the correct C<unpack>. This might get improved in the future. Hopefully. |
342 | use the correct C<unpack>. |
|
|
343 | |
|
|
344 | It's best to avoid this method and use one of the predefined C<get_*> |
|
|
345 | methods. |
327 | |
346 | |
328 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetPlatformInfo.html> |
347 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetPlatformInfo.html> |
329 | |
348 | |
330 | =item @devices = $platform->devices ($type = OpenCL::DEVICE_TYPE_ALL) |
349 | =for gengetinfo begin platform |
331 | |
350 | |
332 | Returns a list of matching OpenCL::Device objects. |
|
|
333 | |
351 | |
334 | =item $ctx = $platform->context_from_type ($properties, $type = OpenCL::DEVICE_TYPE_DEFAULT, $notify = undef) |
352 | =item $string = $platform->profile |
335 | |
353 | |
336 | Tries to create a context. Never worked for me, and you need devices explitly anyway. |
354 | Calls C<clGetPlatformInfo> with C<CL_PLATFORM_PROFILE> and returns the result(s). |
337 | |
355 | |
338 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateContextFromType.html> |
356 | =item $string = $platform->version |
339 | |
357 | |
340 | =item $ctx = $device->context ($properties = undef, @$devices, $notify = undef) |
358 | Calls C<clGetPlatformInfo> with C<CL_PLATFORM_VERSION> and returns the result(s). |
341 | |
359 | |
342 | Create a new OpenCL::Context object using the given device object(s)- a |
360 | =item $string = $platform->name |
343 | CL_CONTEXT_PLATFORM property is supplied automatically. |
|
|
344 | |
361 | |
345 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateContext.html> |
362 | Calls C<clGetPlatformInfo> with C<CL_PLATFORM_NAME> and returns the result(s). |
|
|
363 | |
|
|
364 | =item $string = $platform->vendor |
|
|
365 | |
|
|
366 | Calls C<clGetPlatformInfo> with C<CL_PLATFORM_VENDOR> and returns the result(s). |
|
|
367 | |
|
|
368 | =item $string = $platform->extensions |
|
|
369 | |
|
|
370 | Calls C<clGetPlatformInfo> with C<CL_PLATFORM_EXTENSIONS> and returns the result(s). |
|
|
371 | =for gengetinfo end platform |
346 | |
372 | |
347 | =back |
373 | =back |
348 | |
374 | |
349 | =head2 THE OpenCL::Device CLASS |
375 | =head2 THE OpenCL::Device CLASS |
350 | |
376 | |
… | |
… | |
359 | =back |
385 | =back |
360 | |
386 | |
361 | =head2 THE OpenCL::Context CLASS |
387 | =head2 THE OpenCL::Context CLASS |
362 | |
388 | |
363 | =over 4 |
389 | =over 4 |
364 | |
|
|
365 | =item $packed_value = $ctx->info ($name) |
|
|
366 | |
|
|
367 | See C<< $platform->info >> for details. |
|
|
368 | |
|
|
369 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetContextInfo.html> |
|
|
370 | |
390 | |
371 | =item $queue = $ctx->queue ($device, $properties) |
391 | =item $queue = $ctx->queue ($device, $properties) |
372 | |
392 | |
373 | Create a new OpenCL::Queue object from the context and the given device. |
393 | Create a new OpenCL::Queue object from the context and the given device. |
374 | |
394 | |
… | |
… | |
418 | =item $program = $ctx->program_with_source ($string) |
438 | =item $program = $ctx->program_with_source ($string) |
419 | |
439 | |
420 | Creates a new OpenCL::Program object from the given source code. |
440 | Creates a new OpenCL::Program object from the given source code. |
421 | |
441 | |
422 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateProgramWithSource.html> |
442 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateProgramWithSource.html> |
|
|
443 | |
|
|
444 | =item $packed_value = $ctx->info ($name) |
|
|
445 | |
|
|
446 | See C<< $platform->info >> for details. |
|
|
447 | |
|
|
448 | L<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 |
423 | |
453 | |
424 | =back |
454 | =back |
425 | |
455 | |
426 | =head2 THE OpenCL::Queue CLASS |
456 | =head2 THE OpenCL::Queue CLASS |
427 | |
457 | |
… | |
… | |
549 | |
579 | |
550 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetMemObjectInfo.html> |
580 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetMemObjectInfo.html> |
551 | |
581 | |
552 | =back |
582 | =back |
553 | |
583 | |
|
|
584 | =head2 THE OpenCL::Image CLASS |
|
|
585 | |
|
|
586 | This 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 | |
|
|
592 | See C<< $platform->info >> for details. |
|
|
593 | |
|
|
594 | The reason this method is not called C<info> is that there already is an |
|
|
595 | C<< ->info >> method inherited from C<OpenCL::Memory>. |
|
|
596 | |
|
|
597 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetImageInfo.html> |
|
|
598 | |
|
|
599 | =back |
|
|
600 | |
554 | =head2 THE OpenCL::Sampler CLASS |
601 | =head2 THE OpenCL::Sampler CLASS |
555 | |
602 | |
556 | =over 4 |
603 | =over 4 |
557 | |
604 | |
558 | =item $packed_value = $sampler->info ($name) |
605 | =item $packed_value = $sampler->info ($name) |
… | |
… | |
602 | =item $packed_value = $kernel->info ($name) |
649 | =item $packed_value = $kernel->info ($name) |
603 | |
650 | |
604 | See C<< $platform->info >> for details. |
651 | See C<< $platform->info >> for details. |
605 | |
652 | |
606 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetKernelInfo.html> |
653 | L<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 | |
|
|
657 | See C<< $platform->info >> for details. |
|
|
658 | |
|
|
659 | The reason this method is not called C<info> is that there already is an |
|
|
660 | C<< ->info >> method. |
|
|
661 | |
|
|
662 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetKernelWorkGroupInfo.html> |
607 | |
663 | |
608 | =item $kernel->set_TYPE ($index, $value) |
664 | =item $kernel->set_TYPE ($index, $value) |
609 | |
665 | |
610 | This is a family of methods to set the kernel argument with the number C<$index> to the give C<$value>. |
666 | This is a family of methods to set the kernel argument with the number C<$index> to the give C<$value>. |
611 | |
667 | |
… | |
… | |
633 | |
689 | |
634 | See C<< $platform->info >> for details. |
690 | See C<< $platform->info >> for details. |
635 | |
691 | |
636 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetEventInfo.html> |
692 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetEventInfo.html> |
637 | |
693 | |
|
|
694 | =item $packed_value = $ev->profiling_info ($name) |
|
|
695 | |
|
|
696 | See C<< $platform->info >> for details. |
|
|
697 | |
|
|
698 | The reason this method is not called C<info> is that there already is an |
|
|
699 | C<< ->info >> method. |
|
|
700 | |
|
|
701 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetProfilingInfo.html> |
|
|
702 | |
638 | =item $ev->wait |
703 | =item $ev->wait |
639 | |
704 | |
640 | Waits for the event to complete. |
705 | Waits for the event to complete. |
641 | |
706 | |
642 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clWaitForEvents.html> |
707 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clWaitForEvents.html> |