… | |
… | |
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 | eval { $prog->build (undef, $options); 1 } |
1012 | eval { $prog->build (undef, $options); 1 } |
1013 | or errno == BUILD_PROGRAM_FAILURE |
1013 | or errno == BUILD_PROGRAM_FAILURE |
|
|
1014 | or errno == INVALID_BINARY # workaround nvidia bug |
1014 | or Carp::croak "OpenCL::Context->build_program: " . err2str; |
1015 | or Carp::croak "OpenCL::Context->build_program: " . err2str; |
1015 | |
1016 | |
1016 | # we check status for all devices |
1017 | # we check status for all devices |
1017 | for my $dev ($self->devices) { |
1018 | for my $dev ($self->devices) { |
1018 | $prog->build_status ($dev) == BUILD_SUCCESS |
1019 | $prog->build_status ($dev) == BUILD_SUCCESS |
… | |
… | |
1528 | If a callback is specified, then it will be called when compilation is |
1529 | If a callback is specified, then it will be called when compilation is |
1529 | finished. Note that many OpenCL implementations block your program while |
1530 | finished. Note that many OpenCL implementations block your program while |
1530 | compiling whether you use a callback or not. See C<build_async> if you |
1531 | compiling whether you use a callback or not. See C<build_async> if you |
1531 | want to make sure the build is done in the background. |
1532 | want to make sure the build is done in the background. |
1532 | |
1533 | |
1533 | Note that some OpenCL implementations atc up badly, and don't call the |
1534 | Note that some OpenCL implementations act up badly, and don't call the |
1534 | callback in some error cases (but call it in others). This implementation |
1535 | callback in some error cases (but call it in others). This implementation |
1535 | assumes the callback will always be called, and leaks memory if this is |
1536 | assumes the callback will always be called, and leaks memory if this is |
1536 | not so. So best make sure you don't pass in invalid values. |
1537 | not so. So best make sure you don't pass in invalid values. |
|
|
1538 | |
|
|
1539 | Some implementations fail with C<OpenCL::INVALID_BINARY> when the |
|
|
1540 | compilation state is successful but some later stage fails. |
1537 | |
1541 | |
1538 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clBuildProgram.html> |
1542 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clBuildProgram.html> |
1539 | |
1543 | |
1540 | =item $program->build_async (\@devices = undef, $options = "", $cb->($program) = undef) |
1544 | =item $program->build_async (\@devices = undef, $options = "", $cb->($program) = undef) |
1541 | |
1545 | |