… | |
… | |
160 | '; |
160 | '; |
161 | |
161 | |
162 | my $prog = $ctx->program_with_source ($src); |
162 | my $prog = $ctx->program_with_source ($src); |
163 | |
163 | |
164 | # build croaks on compile errors, so catch it and print the compile errors |
164 | # build croaks on compile errors, so catch it and print the compile errors |
165 | eval { $prog->build ($dev); 1 } |
165 | eval { $prog->build ($dev, "-cl-fast-relaxed-math"); 1 } |
166 | or die $prog->build_log; |
166 | or die $prog->build_log; |
167 | |
167 | |
168 | my $kernel = $prog->kernel ("squareit"); |
168 | my $kernel = $prog->kernel ("squareit"); |
169 | |
169 | |
170 | =head2 Create some input and output float buffers, then call the |
170 | =head2 Create some input and output float buffers, then call the |
… | |
… | |
336 | =item * Structures are often specified by flattening out their components |
336 | =item * Structures are often specified by flattening out their components |
337 | as with short vectors, and returned as arrayrefs. |
337 | as with short vectors, and returned as arrayrefs. |
338 | |
338 | |
339 | =item * When enqueuing commands, the wait list is specified by adding |
339 | =item * When enqueuing commands, the wait list is specified by adding |
340 | extra arguments to the function - anywhere a C<$wait_events...> argument |
340 | extra arguments to the function - anywhere a C<$wait_events...> argument |
341 | is documented this can be any number of event objects. |
341 | is documented this can be any number of event objects. As an extsnion |
|
|
342 | implemented by this module, C<undef> values will be ignored in the event |
|
|
343 | list. |
342 | |
344 | |
343 | =item * When enqueuing commands, if the enqueue method is called in void |
345 | =item * When enqueuing commands, if the enqueue method is called in void |
344 | context, no event is created. In all other contexts an event is returned |
346 | context, no event is created. In all other contexts an event is returned |
345 | by the method. |
347 | by the method. |
346 | |
348 | |
… | |
… | |
748 | |
750 | |
749 | =item @device_partition_property_exts = $device->affinity_domains_ext |
751 | =item @device_partition_property_exts = $device->affinity_domains_ext |
750 | |
752 | |
751 | Calls C<clGetDeviceInfo> with C<CL_DEVICE_AFFINITY_DOMAINS_EXT> and returns the result. |
753 | Calls C<clGetDeviceInfo> with C<CL_DEVICE_AFFINITY_DOMAINS_EXT> and returns the result. |
752 | |
754 | |
753 | =item $uint = $device->reference_count_ext |
755 | =item $uint = $device->reference_count_ext |
754 | |
756 | |
755 | Calls C<clGetDeviceInfo> with C<CL_DEVICE_REFERENCE_COUNT_EXT > and returns the result. |
757 | Calls C<clGetDeviceInfo> with C<CL_DEVICE_REFERENCE_COUNT_EXT > and returns the result. |
756 | |
758 | |
757 | =item @device_partition_property_exts = $device->partition_style_ext |
759 | =item @device_partition_property_exts = $device->partition_style_ext |
758 | |
760 | |
… | |
… | |
769 | =item $queue = $ctx->queue ($device, $properties) |
771 | =item $queue = $ctx->queue ($device, $properties) |
770 | |
772 | |
771 | Create a new OpenCL::Queue object from the context and the given device. |
773 | Create a new OpenCL::Queue object from the context and the given device. |
772 | |
774 | |
773 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateCommandQueue.html> |
775 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateCommandQueue.html> |
|
|
776 | |
|
|
777 | Example: create an out-of-order queue. |
|
|
778 | |
|
|
779 | $queue = $ctx->queue ($device, OpenCL::QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE); |
774 | |
780 | |
775 | =item $ev = $ctx->user_event |
781 | =item $ev = $ctx->user_event |
776 | |
782 | |
777 | Creates a new OpenCL::UserEvent object. |
783 | Creates a new OpenCL::UserEvent object. |
778 | |
784 | |
… | |
… | |
889 | for completion, unless the method is called in void context, in which case |
895 | for completion, unless the method is called in void context, in which case |
890 | no event object is created. |
896 | no event object is created. |
891 | |
897 | |
892 | They also allow you to specify any number of other event objects that this |
898 | They also allow you to specify any number of other event objects that this |
893 | request has to wait for before it starts executing, by simply passing the |
899 | request has to wait for before it starts executing, by simply passing the |
894 | event objects as extra parameters to the enqueue methods. |
900 | event objects as extra parameters to the enqueue methods. To simplify |
|
|
901 | program design, this module ignores any C<undef> values in the list of |
|
|
902 | events. This makes it possible to code operations such as this, without |
|
|
903 | having to put a valid event object into C<$event> first: |
|
|
904 | |
|
|
905 | $event = $queue->enqueue_xxx (..., $event); |
895 | |
906 | |
896 | Queues execute in-order by default, without any parallelism, so in most |
907 | Queues execute in-order by default, without any parallelism, so in most |
897 | cases (i.e. you use only one queue) it's not necessary to wait for or |
908 | cases (i.e. you use only one queue) it's not necessary to wait for or |
898 | create event objects. |
909 | create event objects, althoguh an our of order queue is often a bit |
|
|
910 | faster. |
899 | |
911 | |
900 | =over 4 |
912 | =over 4 |
901 | |
913 | |
902 | =item $ev = $queue->enqueue_read_buffer ($buffer, $blocking, $offset, $len, $data, $wait_events...) |
914 | =item $ev = $queue->enqueue_read_buffer ($buffer, $blocking, $offset, $len, $data, $wait_events...) |
903 | |
915 | |
… | |
… | |
1474 | package OpenCL; |
1486 | package OpenCL; |
1475 | |
1487 | |
1476 | use common::sense; |
1488 | use common::sense; |
1477 | |
1489 | |
1478 | BEGIN { |
1490 | BEGIN { |
1479 | our $VERSION = '0.95'; |
1491 | our $VERSION = '0.96'; |
1480 | |
1492 | |
1481 | require XSLoader; |
1493 | require XSLoader; |
1482 | XSLoader::load (__PACKAGE__, $VERSION); |
1494 | XSLoader::load (__PACKAGE__, $VERSION); |
1483 | |
1495 | |
1484 | @OpenCL::Buffer::ISA = |
1496 | @OpenCL::Buffer::ISA = |