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

Comparing OpenCL/OpenCL.pm (file contents):
Revision 1.59 by root, Wed Apr 25 20:49:13 2012 UTC vs.
Revision 1.61 by root, Sat Apr 28 13:31:40 2012 UTC

537=item $int = OpenCL::errno 537=item $int = OpenCL::errno
538 538
539The last error returned by a function - it's only valid after an error occured 539The last error returned by a function - it's only valid after an error occured
540and before calling another OpenCL function. 540and before calling another OpenCL function.
541 541
542=item $str = OpenCL::err2str $errval 542=item $str = OpenCL::err2str [$errval]
543 543
544Comverts an error value into a human readable string. 544Converts an error value into a human readable string. IF no error value is
545given, 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
548Converts most enum values (of parameter names, image format constants, 549Converts most enum values (of parameter names, image format constants,
549object types, addressing and filter modes, command types etc.) into a 550object 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
1687Calls C<clGetKernelWorkGroupInfo> with C<CL_KERNEL_PRIVATE_MEM_SIZE> and returns the result. 1692Calls 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
1698Sets the arguments of a kernel. Since OpenCL 1.1 doesn't have a generic
1699way to set arguments (and with OpenCL 1.2 it might be rather slow), you
1700need to specify a format argument, much as with C<printf>, to tell OpenCL
1701what type of argument it is.
1702
1703The 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
1724Space characters in the format string are ignored.
1725
1726Example: 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)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines