| 1 |
root |
1.1 |
=head1 NAME |
| 2 |
|
|
|
| 3 |
|
|
OpenCL - bindings to, well, OpenCL |
| 4 |
|
|
|
| 5 |
|
|
=head1 SYNOPSIS |
| 6 |
|
|
|
| 7 |
|
|
use OpenCL; |
| 8 |
|
|
|
| 9 |
|
|
=head1 DESCRIPTION |
| 10 |
|
|
|
| 11 |
|
|
This is an early release which is not useful yet. |
| 12 |
|
|
|
| 13 |
|
|
Enumerate all devices and get contexts for them; |
| 14 |
|
|
|
| 15 |
|
|
for my $platform (OpenCL::platforms) { |
| 16 |
|
|
warn $platform->info (OpenCL::PLATFORM_NAME); |
| 17 |
|
|
warn $platform->info (OpenCL::PLATFORM_EXTENSIONS); |
| 18 |
|
|
for my $device ($platform->devices) { |
| 19 |
|
|
warn $device->info (OpenCL::DEVICE_NAME); |
| 20 |
|
|
my $ctx = $device->context_simple; |
| 21 |
|
|
# do stuff |
| 22 |
|
|
} |
| 23 |
|
|
} |
| 24 |
|
|
|
| 25 |
|
|
Get a useful context and a command queue: |
| 26 |
|
|
|
| 27 |
|
|
my $dev = ((OpenCL::platforms)[0]->devices)[0]; |
| 28 |
|
|
my $ctx = $dev->context_simple; |
| 29 |
|
|
my $queue = $ctx->command_queue_simple ($dev); |
| 30 |
|
|
|
| 31 |
|
|
=over 4 |
| 32 |
|
|
|
| 33 |
|
|
=cut |
| 34 |
|
|
|
| 35 |
|
|
package OpenCL; |
| 36 |
|
|
|
| 37 |
|
|
BEGIN { |
| 38 |
|
|
$VERSION = '0.01'; |
| 39 |
|
|
|
| 40 |
|
|
require XSLoader; |
| 41 |
|
|
XSLoader::load (__PACKAGE__, $VERSION); |
| 42 |
|
|
} |
| 43 |
|
|
|
| 44 |
|
|
1; |
| 45 |
|
|
|
| 46 |
|
|
=back |
| 47 |
|
|
|
| 48 |
|
|
=head1 AUTHOR |
| 49 |
|
|
|
| 50 |
|
|
Marc Lehmann <schmorp@schmorp.de> |
| 51 |
|
|
http://home.schmorp.de/ |
| 52 |
|
|
|
| 53 |
|
|
=cut |
| 54 |
|
|
|