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

Comparing OpenCL/OpenCL.pm (file contents):
Revision 1.28 by root, Sat Dec 10 23:07:38 2011 UTC vs.
Revision 1.32 by root, Thu Apr 19 12:12:03 2012 UTC

105 for my $platform (OpenCL::platforms) { 105 for my $platform (OpenCL::platforms) {
106 printf "platform: %s\n", $platform->name; 106 printf "platform: %s\n", $platform->name;
107 printf "extensions: %s\n", $platform->extensions; 107 printf "extensions: %s\n", $platform->extensions;
108 for my $device ($platform->devices) { 108 for my $device ($platform->devices) {
109 printf "+ device: %s\n", $device->name; 109 printf "+ device: %s\n", $device->name;
110 my $ctx = $device->context; 110 my $ctx = $platform->context (undef, [$device]);
111 # do stuff 111 # do stuff
112 } 112 }
113 } 113 }
114 114
115=head2 Get a useful context and a command queue. 115=head2 Get a useful context and a command queue.
149 149
150=head2 Create and build a program, then create a kernel out of one of its 150=head2 Create and build a program, then create a kernel out of one of its
151functions. 151functions.
152 152
153 my $src = ' 153 my $src = '
154 __kernel void 154 kernel void
155 squareit (__global float *input, __global float *output) 155 squareit (global float *input, global float *output)
156 { 156 {
157 $id = get_global_id (0); 157 $id = get_global_id (0);
158 output [id] = input [id] * input [id]; 158 output [id] = input [id] * input [id];
159 } 159 }
160 '; 160 ';
271 ulong IV - Q 271 ulong IV - Q
272 float NV float f 272 float NV float f
273 half IV ushort S 273 half IV ushort S
274 double NV double d 274 double NV double d
275 275
276=head2 OpenGL sharing
277
278This module can be optionally compiled with support for
279OpenGL sharing. The sharing functions are only available when
280C<OpenCL::HAVE_OPENGL> returns true, otherwise they are absent and cannot
281be called.
282
276=head2 THE OpenCL PACKAGE 283=head2 THE OpenCL PACKAGE
277 284
278=over 4 285=over 4
279 286
280=item $int = OpenCL::errno 287=item $int = OpenCL::errno
286 293
287Comverts an error value into a human readable string. 294Comverts an error value into a human readable string.
288 295
289=item $str = OpenCL::enum2str $enum 296=item $str = OpenCL::enum2str $enum
290 297
291Converts most enum values (inof parameter names, image format constants, 298Converts most enum values (of parameter names, image format constants,
292object types, addressing and filter modes, command types etc.) into a 299object types, addressing and filter modes, command types etc.) into a
293human readbale string. When confronted with some random integer it can be 300human readable string. When confronted with some random integer it can be
294very helpful to pass it through this function to maybe get some readable 301very helpful to pass it through this function to maybe get some readable
295string out of it. 302string out of it.
296 303
297=item @platforms = OpenCL::platforms 304=item @platforms = OpenCL::platforms
298 305
326 333
327Tries to create a context. Never worked for me, and you need devices explicitly anyway. 334Tries to create a context. Never worked for me, and you need devices explicitly anyway.
328 335
329L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateContextFromType.html> 336L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateContextFromType.html>
330 337
331=item $ctx = $device->context ($properties = undef, @$devices, $notify = undef) 338=item $ctx = $platform->context ($properties = undef, @$devices, $notify = undef)
332 339
333Create a new OpenCL::Context object using the given device object(s)- a 340Create a new OpenCL::Context object using the given device object(s)- a
334CL_CONTEXT_PLATFORM property is supplied automatically. 341CL_CONTEXT_PLATFORM property is supplied automatically.
335 342
336L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateContext.html> 343L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateContext.html>
1302package OpenCL; 1309package OpenCL;
1303 1310
1304use common::sense; 1311use common::sense;
1305 1312
1306BEGIN { 1313BEGIN {
1307 our $VERSION = '0.91'; 1314 our $VERSION = '0.92';
1308 1315
1309 require XSLoader; 1316 require XSLoader;
1310 XSLoader::load (__PACKAGE__, $VERSION); 1317 XSLoader::load (__PACKAGE__, $VERSION);
1311 1318
1312 @OpenCL::Buffer::ISA = 1319 @OpenCL::Buffer::ISA =

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines