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

Comparing OpenCL/OpenCL.pm (file contents):
Revision 1.60 by root, Wed Apr 25 21:48:44 2012 UTC vs.
Revision 1.62 by root, Sat Apr 28 13:33:04 2012 UTC

493=cut 493=cut
494 494
495package OpenCL; 495package OpenCL;
496 496
497use common::sense; 497use common::sense;
498use Carp ();
498use Async::Interrupt (); 499use Async::Interrupt ();
499 500
500our $POLL_FUNC; # set by XS 501our $POLL_FUNC; # set by XS
501 502
502BEGIN { 503BEGIN {
503 our $VERSION = '0.97'; 504 our $VERSION = '0.98';
504 505
505 require XSLoader; 506 require XSLoader;
506 XSLoader::load (__PACKAGE__, $VERSION); 507 XSLoader::load (__PACKAGE__, $VERSION);
507 508
508 @OpenCL::Platform::ISA = 509 @OpenCL::Platform::ISA =
537=item $int = OpenCL::errno 538=item $int = OpenCL::errno
538 539
539The last error returned by a function - it's only valid after an error occured 540The last error returned by a function - it's only valid after an error occured
540and before calling another OpenCL function. 541and before calling another OpenCL function.
541 542
542=item $str = OpenCL::err2str $errval 543=item $str = OpenCL::err2str [$errval]
543 544
544Comverts an error value into a human readable string. 545Converts an error value into a human readable string. IF no error value is
546given, then the last error will be used (as returned by OpenCL::errno).
545 547
546=item $str = OpenCL::enum2str $enum 548=item $str = OpenCL::enum2str $enum
547 549
548Converts most enum values (of parameter names, image format constants, 550Converts most enum values (of parameter names, image format constants,
549object types, addressing and filter modes, command types etc.) into a 551object types, addressing and filter modes, command types etc.) into a
1002=cut 1004=cut
1003 1005
1004sub OpenCL::Context::build_program { 1006sub OpenCL::Context::build_program {
1005 my ($self, $prog, $options) = @_; 1007 my ($self, $prog, $options) = @_;
1006 1008
1007 require Carp;
1008
1009 $prog = $self->program_with_source ($prog) 1009 $prog = $self->program_with_source ($prog)
1010 unless ref $prog; 1010 unless ref $prog;
1011 1011
1012 # we build separately per device so we instantly know which one failed 1012 eval { $prog->build (undef, $options); 1 }
1013 or errno == BUILD_PROGRAM_FAILURE
1014 or Carp::croak "OpenCL::Context->build_program: " . err2str;
1015
1016 # we check status for all devices
1013 for my $dev ($self->devices) { 1017 for my $dev ($self->devices) {
1014 eval { $prog->build ([$dev], $options); 1 } 1018 $prog->build_status ($dev) == BUILD_SUCCESS
1015 or Carp::croak ("Building OpenCL program for device '" . $dev->name . "' failed:\n" 1019 or Carp::croak "Building OpenCL program for device '" . $dev->name . "' failed:\n"
1016 . $prog->build_log ($dev)); 1020 . $prog->build_log ($dev);
1017 } 1021 }
1018 1022
1019 $prog 1023 $prog
1020} 1024}
1021 1025

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines