… | |
… | |
537 | =item $int = OpenCL::errno |
537 | =item $int = OpenCL::errno |
538 | |
538 | |
539 | The last error returned by a function - it's only valid after an error occured |
539 | The last error returned by a function - it's only valid after an error occured |
540 | and before calling another OpenCL function. |
540 | and before calling another OpenCL function. |
541 | |
541 | |
542 | =item $str = OpenCL::err2str $errval |
542 | =item $str = OpenCL::err2str [$errval] |
543 | |
543 | |
544 | Comverts an error value into a human readable string. |
544 | Converts an error value into a human readable string. IF no error value is |
|
|
545 | given, then the last error will be used (as returned by OpenCL::errno). |
545 | |
546 | |
546 | =item $str = OpenCL::enum2str $enum |
547 | =item $str = OpenCL::enum2str $enum |
547 | |
548 | |
548 | Converts most enum values (of parameter names, image format constants, |
549 | Converts most enum values (of parameter names, image format constants, |
549 | object types, addressing and filter modes, command types etc.) into a |
550 | object types, addressing and filter modes, command types etc.) into a |
… | |
… | |
1007 | require Carp; |
1008 | require Carp; |
1008 | |
1009 | |
1009 | $prog = $self->program_with_source ($prog) |
1010 | $prog = $self->program_with_source ($prog) |
1010 | unless ref $prog; |
1011 | unless ref $prog; |
1011 | |
1012 | |
1012 | # we build separately per device so we instantly know which one failed |
1013 | eval { $prog->build (undef, $options); 1 } |
|
|
1014 | or errno == BUILD_PROGRAM_FAILURE |
|
|
1015 | or Carp::croak "OpenCL::Context->build_program: " . err2str; |
|
|
1016 | |
|
|
1017 | # we check status for all devices |
1013 | for my $dev ($self->devices) { |
1018 | for my $dev ($self->devices) { |
1014 | eval { $prog->build ([$dev], $options); 1 } |
1019 | $prog->build_status ($dev) == BUILD_SUCCESS |
1015 | or Carp::croak ("Building OpenCL program for device '" . $dev->name . "' failed:\n" |
1020 | or Carp::croak ("Building OpenCL program for device '" . $dev->name . "' failed:\n" |
1016 | . $prog->build_log ($dev)); |
1021 | . $prog->build_log ($dev)); |
1017 | } |
1022 | } |
1018 | |
1023 | |
1019 | $prog |
1024 | $prog |
… | |
… | |
1686 | |
1691 | |
1687 | Calls C<clGetKernelWorkGroupInfo> with C<CL_KERNEL_PRIVATE_MEM_SIZE> and returns the result. |
1692 | Calls C<clGetKernelWorkGroupInfo> with C<CL_KERNEL_PRIVATE_MEM_SIZE> and returns the result. |
1688 | |
1693 | |
1689 | =for gengetinfo end kernel_work_group |
1694 | =for gengetinfo end kernel_work_group |
1690 | |
1695 | |
|
|
1696 | =item $kernel->setf ($format, ...) |
|
|
1697 | |
|
|
1698 | Sets the arguments of a kernel. Since OpenCL 1.1 doesn't have a generic |
|
|
1699 | way to set arguments (and with OpenCL 1.2 it might be rather slow), you |
|
|
1700 | need to specify a format argument, much as with C<printf>, to tell OpenCL |
|
|
1701 | what type of argument it is. |
|
|
1702 | |
|
|
1703 | The format arguments are single letters: |
|
|
1704 | |
|
|
1705 | c char |
|
|
1706 | C unsigned char |
|
|
1707 | s short |
|
|
1708 | S unsigned short |
|
|
1709 | i int |
|
|
1710 | I unsigned int |
|
|
1711 | l long |
|
|
1712 | L unsigned long |
|
|
1713 | |
|
|
1714 | h half float (0..65535) |
|
|
1715 | f float |
|
|
1716 | d double |
|
|
1717 | |
|
|
1718 | z local (octet size) |
|
|
1719 | |
|
|
1720 | m memory object (buffer or image) |
|
|
1721 | a sampler |
|
|
1722 | e event |
|
|
1723 | |
|
|
1724 | Space characters in the format string are ignored. |
|
|
1725 | |
|
|
1726 | Example: set the arguments for a kernel that expects an int, two floats, a buffer and an image. |
|
|
1727 | |
|
|
1728 | $kernel->setf ("i ff mm", 5, 0.5, 3, $buffer, $image); |
|
|
1729 | |
1691 | =item $kernel->set_TYPE ($index, $value) |
1730 | =item $kernel->set_TYPE ($index, $value) |
1692 | |
1731 | |
1693 | =item $kernel->set_char ($index, $value) |
1732 | =item $kernel->set_char ($index, $value) |
1694 | |
1733 | |
1695 | =item $kernel->set_uchar ($index, $value) |
1734 | =item $kernel->set_uchar ($index, $value) |