opencl_ruby_ffi 0.2 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -61,7 +61,7 @@ module OpenCL
|
|
61
61
|
event = FFI::MemoryPointer.new( Event )
|
62
62
|
error = OpenCL.clEnqueueMigrateMemObjects( command_queue, num_mem_objects, mem_list, flags, num_events, events, event )
|
63
63
|
OpenCL.error_check( error )
|
64
|
-
return OpenCL::Event::new( event.read_ptr )
|
64
|
+
return OpenCL::Event::new( event.read_ptr, false )
|
65
65
|
end
|
66
66
|
|
67
67
|
# Enqueues a command to map an Image into host memory
|
@@ -101,7 +101,7 @@ module OpenCL
|
|
101
101
|
error = FFI::MemoryPointer.new( :cl_int )
|
102
102
|
OpenCL.clEnqueueMapImage( command_queue, image, blocking, map_flags, origin, region, image_row_pitch, image_slice_pitch, num_events, events, event, error )
|
103
103
|
OpenCL.error_check( error.read_cl_int )
|
104
|
-
ev = OpenCL::Event::new( event.read_ptr )
|
104
|
+
ev = OpenCL::Event::new( event.read_ptr, false )
|
105
105
|
return [ev, ptr, image_row_pitch.read_size_t, image_slice_pitch.read_size_t]
|
106
106
|
end
|
107
107
|
|
@@ -139,7 +139,7 @@ module OpenCL
|
|
139
139
|
error = FFI::MemoryPointer.new( :cl_int )
|
140
140
|
ptr = OpenCL.clEnqueueMapBuffer( command_queue, buffer, blocking, map_flags, offset, size, num_events, events, error )
|
141
141
|
OpenCL.error_check( error.read_cl_int )
|
142
|
-
ev = OpenCL::Event::new( event.read_ptr )
|
142
|
+
ev = OpenCL::Event::new( event.read_ptr, false )
|
143
143
|
return [ev, ptr]
|
144
144
|
end
|
145
145
|
|
@@ -164,7 +164,7 @@ module OpenCL
|
|
164
164
|
event = FFI::MemoryPointer.new( Event )
|
165
165
|
error = OpenCL.clEnqueueUnmapMemObject( command_queue, mem_obj, mapped_ptr, num_events, events, event )
|
166
166
|
OpenCL.error_check( error )
|
167
|
-
return OpenCL::Event::new( event.read_ptr )
|
167
|
+
return OpenCL::Event::new( event.read_ptr, false )
|
168
168
|
end
|
169
169
|
|
170
170
|
# Enqueues a command to read from a rectangular region from a Buffer object to host memory
|
@@ -241,7 +241,7 @@ module OpenCL
|
|
241
241
|
event = FFI::MemoryPointer.new( Event )
|
242
242
|
error = OpenCL.clEnqueueReadBufferRect(command_queue, buffer, blocking, buffer_origin, host_origin, r, buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch, ptr, num_events, events, event)
|
243
243
|
OpenCL.error_check(error)
|
244
|
-
return OpenCL::Event::new(event.read_pointer)
|
244
|
+
return OpenCL::Event::new(event.read_pointer, false)
|
245
245
|
end
|
246
246
|
|
247
247
|
# Enqueues a command to write to a rectangular region in a Buffer object from host memory
|
@@ -318,7 +318,7 @@ module OpenCL
|
|
318
318
|
event = FFI::MemoryPointer.new( Event )
|
319
319
|
error = OpenCL.clEnqueueWriteBufferRect(command_queue, buffer, blocking, buffer_origin, host_origin, r, buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch, ptr, num_events, events, event)
|
320
320
|
OpenCL.error_check(error)
|
321
|
-
return OpenCL::Event::new(event.read_pointer)
|
321
|
+
return OpenCL::Event::new(event.read_pointer, false)
|
322
322
|
end
|
323
323
|
|
324
324
|
# Enqueues a command to copy a rectangular region into a Buffer object from another Buffer object
|
@@ -389,7 +389,7 @@ module OpenCL
|
|
389
389
|
event = FFI::MemoryPointer.new( Event )
|
390
390
|
error = OpenCL.clEnqueueCopyBufferRect(command_queue, src_buffer, dst_buffer, src_origin, dst_origin, r, src_row_pitch, src_slice_pitch, dst_row_pitch, dst_slice_pitch, num_events, events, event)
|
391
391
|
OpenCL.error_check(error)
|
392
|
-
return OpenCL::Event::new(event.read_pointer)
|
392
|
+
return OpenCL::Event::new(event.read_pointer, false)
|
393
393
|
end
|
394
394
|
|
395
395
|
# Enqueues a command to copy data from a Buffer object into another Buffer object
|
@@ -422,7 +422,7 @@ module OpenCL
|
|
422
422
|
event = FFI::MemoryPointer.new( Event )
|
423
423
|
error = OpenCL.clEnqueueCopyBuffer(command_queue, src_buffer, dst_buffer, src_offset, dst_offset, size, num_events, events, event)
|
424
424
|
OpenCL.error_check(error)
|
425
|
-
return OpenCL::Event::new(event.read_pointer)
|
425
|
+
return OpenCL::Event::new(event.read_pointer, false)
|
426
426
|
end
|
427
427
|
|
428
428
|
|
@@ -457,7 +457,7 @@ module OpenCL
|
|
457
457
|
event = FFI::MemoryPointer.new( Event )
|
458
458
|
error = OpenCL.clEnqueueWriteBuffer(command_queue, buffer, blocking, offset, size, ptr, num_events, events, event)
|
459
459
|
OpenCL.error_check(error)
|
460
|
-
return OpenCL::Event::new(event.read_pointer)
|
460
|
+
return OpenCL::Event::new(event.read_pointer, false)
|
461
461
|
end
|
462
462
|
|
463
463
|
# Enqueues a command to read from a Buffer object to host memory
|
@@ -491,7 +491,7 @@ module OpenCL
|
|
491
491
|
event = FFI::MemoryPointer.new( Event )
|
492
492
|
error = OpenCL.clEnqueueReadBuffer(command_queue, buffer, blocking, offset, size, ptr, num_events, events, event)
|
493
493
|
OpenCL.error_check(error)
|
494
|
-
return OpenCL::Event::new(event.read_pointer)
|
494
|
+
return OpenCL::Event::new(event.read_pointer, false)
|
495
495
|
end
|
496
496
|
|
497
497
|
# Acquire OpenCL Mem objects that have been created from OpenGL objects
|
@@ -522,7 +522,7 @@ module OpenCL
|
|
522
522
|
event = FFI::MemoryPointer.new( Event )
|
523
523
|
error = OpenCL.clEnqueueAcquireGLObject( command_queue, num_objs, objs, num_events, events, event )
|
524
524
|
OpenCL.error_check(error)
|
525
|
-
return OpenCL::Event::new(event.read_pointer)
|
525
|
+
return OpenCL::Event::new(event.read_pointer, false)
|
526
526
|
end
|
527
527
|
|
528
528
|
# Release OpenCL Mem objects that have been created from OpenGL objects and previously acquired
|
@@ -553,7 +553,7 @@ module OpenCL
|
|
553
553
|
event = FFI::MemoryPointer.new( Event )
|
554
554
|
error = OpenCL.clEnqueueReleaseGLObject( command_queue, num_objs, objs, num_events, events, event )
|
555
555
|
OpenCL.error_check(error)
|
556
|
-
return OpenCL::Event::new(event.read_pointer)
|
556
|
+
return OpenCL::Event::new(event.read_pointer, false)
|
557
557
|
end
|
558
558
|
|
559
559
|
# Enqueues a command to fill a Buffer with the given pattern
|
@@ -587,7 +587,7 @@ module OpenCL
|
|
587
587
|
event = FFI::MemoryPointer.new( Event )
|
588
588
|
error = OpenCL.clEnqueueFillBuffer( command_queue, buffer, pattern, pattern_size, offset, size, num_events, events, event )
|
589
589
|
OpenCL.error_check(error)
|
590
|
-
return OpenCL::Event::new(event.read_pointer)
|
590
|
+
return OpenCL::Event::new(event.read_pointer, false)
|
591
591
|
end
|
592
592
|
|
593
593
|
# Enqueues a command to fill an Image with the given color
|
@@ -615,7 +615,7 @@ module OpenCL
|
|
615
615
|
event = FFI::MemoryPointer.new( Event )
|
616
616
|
error = OpenCL.clEnqueueFillImage( command_queue, image, fill_color, origin, region, num_events, events, event )
|
617
617
|
OpenCL.error_check(error)
|
618
|
-
return OpenCL::Event::new(event.read_pointer)
|
618
|
+
return OpenCL::Event::new(event.read_pointer, false)
|
619
619
|
end
|
620
620
|
|
621
621
|
# Enqueues a command to copy an Image into a Buffer
|
@@ -645,7 +645,7 @@ module OpenCL
|
|
645
645
|
event = FFI::MemoryPointer.new( Event )
|
646
646
|
error = OpenCL.clEnqueueCopyImageToBuffer( command_queue, src_image, dst_buffer, src_origin, region, dst_offset, num_events, events, event )
|
647
647
|
OpenCL.error_check(error)
|
648
|
-
return OpenCL::Event::new(event.read_pointer)
|
648
|
+
return OpenCL::Event::new(event.read_pointer, false)
|
649
649
|
end
|
650
650
|
|
651
651
|
# Enqueues a command to copy a Buffer into an Image
|
@@ -675,7 +675,7 @@ module OpenCL
|
|
675
675
|
event = FFI::MemoryPointer.new( Event )
|
676
676
|
error = OpenCL.clEnqueueCopyBufferToImage( command_queue, src_buffer, dst_image, src_offset, dst_origin, region, num_events, events, event )
|
677
677
|
OpenCL.error_check(error)
|
678
|
-
return OpenCL::Event::new(event.read_pointer)
|
678
|
+
return OpenCL::Event::new(event.read_pointer, false)
|
679
679
|
end
|
680
680
|
|
681
681
|
# Enqueues a command to copy from host memory into an Image
|
@@ -714,7 +714,7 @@ module OpenCL
|
|
714
714
|
event = FFI::MemoryPointer.new( Event )
|
715
715
|
error = OpenCL.clEnqueueWriteImage( command_queue, image, blocking, origin, region, input_row_pitch, input_slice_pitch, ptr, num_events, events, event )
|
716
716
|
OpenCL.error_check(error)
|
717
|
-
return OpenCL::Event::new(event.read_pointer)
|
717
|
+
return OpenCL::Event::new(event.read_pointer, false)
|
718
718
|
end
|
719
719
|
|
720
720
|
# Enqueues a command to copy from an Image into an Image
|
@@ -747,7 +747,7 @@ module OpenCL
|
|
747
747
|
event = FFI::MemoryPointer.new( Event )
|
748
748
|
error = OpenCL.clEnqueueCopyImage( command_queue, src_image, dst_image, src_origin, dst_origin, region, num_events, events, event )
|
749
749
|
OpenCL.error_check(error)
|
750
|
-
return OpenCL::Event::new(event.read_pointer)
|
750
|
+
return OpenCL::Event::new(event.read_pointer, false)
|
751
751
|
end
|
752
752
|
|
753
753
|
# Enqueues a command to copy from an Image into host memory
|
@@ -785,7 +785,7 @@ module OpenCL
|
|
785
785
|
event = FFI::MemoryPointer.new( Event )
|
786
786
|
error = OpenCL.clEnqueueReadImage( command_queue, image, blocking, origin, region, row_pitch, slice_pitch, ptr, num_events, events, event )
|
787
787
|
OpenCL.error_check(error)
|
788
|
-
return OpenCL::Event::new(event.read_pointer)
|
788
|
+
return OpenCL::Event::new(event.read_pointer, false)
|
789
789
|
end
|
790
790
|
|
791
791
|
# Enqueues a native kernel
|
@@ -820,7 +820,7 @@ module OpenCL
|
|
820
820
|
event = FFI::MemoryPointer.new( Event )
|
821
821
|
error = OpenCL.clEnqueueNativeKernel( command_queue, func, nil, 0, 0, nil, nil, num_events, events, event )
|
822
822
|
OpenCL.error_check(error)
|
823
|
-
return OpenCL::Event::new(event.read_pointer)
|
823
|
+
return OpenCL::Event::new(event.read_pointer, false)
|
824
824
|
end
|
825
825
|
|
826
826
|
# Enqueues a kernel as a task
|
@@ -843,7 +843,7 @@ module OpenCL
|
|
843
843
|
event = FFI::MemoryPointer.new( Event )
|
844
844
|
error = OpenCL.clEnqueueTask( command_queue, kernel, num_events, events, event )
|
845
845
|
OpenCL.error_check(error)
|
846
|
-
return OpenCL::Event::new(event.read_pointer)
|
846
|
+
return OpenCL::Event::new(event.read_pointer, false)
|
847
847
|
end
|
848
848
|
|
849
849
|
# Enqueues a kernel as a NDrange
|
@@ -887,7 +887,7 @@ module OpenCL
|
|
887
887
|
event = FFI::MemoryPointer.new( Event )
|
888
888
|
error = OpenCL.clEnqueueNDRangeKernel(command_queue, kernel, global_work_size.length, gwo, gws, lws, num_events, events, event)
|
889
889
|
OpenCL.error_check(error)
|
890
|
-
return OpenCL::Event::new(event.read_pointer)
|
890
|
+
return OpenCL::Event::new(event.read_pointer, false)
|
891
891
|
end
|
892
892
|
|
893
893
|
# Enqueues a barrier on a list of envents
|
@@ -940,7 +940,7 @@ module OpenCL
|
|
940
940
|
event = FFI::MemoryPointer.new( Event )
|
941
941
|
error = OpenCL.clEnqueueBarrierWithWaitList( command_queue, num_events, evts, event )
|
942
942
|
OpenCL.error_check(error)
|
943
|
-
return OpenCL::Event::new(event.read_pointer)
|
943
|
+
return OpenCL::Event::new(event.read_pointer, false)
|
944
944
|
end
|
945
945
|
end
|
946
946
|
|
@@ -970,7 +970,7 @@ module OpenCL
|
|
970
970
|
error = OpenCL.clEnqueueMarkerWithWaitList( command_queue, num_events, evts, event )
|
971
971
|
end
|
972
972
|
OpenCL.error_check(error)
|
973
|
-
return OpenCL::Event::new(event.read_pointer)
|
973
|
+
return OpenCL::Event::new(event.read_pointer, false)
|
974
974
|
end
|
975
975
|
|
976
976
|
# Maps the cl_command_queue object of OpenCL
|
@@ -726,7 +726,6 @@ module OpenCL
|
|
726
726
|
|
727
727
|
# method called at Platform deletion, releases the object if aplicable
|
728
728
|
def self.release(ptr)
|
729
|
-
#STDERR.puts "Releasing Platform: #{ptr}"
|
730
729
|
end
|
731
730
|
end
|
732
731
|
|
@@ -859,7 +858,6 @@ module OpenCL
|
|
859
858
|
|
860
859
|
# method called at Device deletion, releases the object if aplicable
|
861
860
|
def self.release(ptr)
|
862
|
-
#STDERR.puts "Releasing Device: #{ptr}"
|
863
861
|
end
|
864
862
|
end
|
865
863
|
|
@@ -999,6 +997,9 @@ module OpenCL
|
|
999
997
|
# method called at Context deletion, releases the object if aplicable
|
1000
998
|
def self.release(ptr)
|
1001
999
|
#STDERR.puts "Releasing Context: #{ptr}"
|
1000
|
+
#ref_count = FFI::MemoryPointer.new( :cl_uint )
|
1001
|
+
#OpenCL.clGetContextInfo(ptr, OpenCL::Context::REFERENCE_COUNT, ref_count.size, ref_count, nil)
|
1002
|
+
#STDERR.puts "reference counter: #{ref_count.read_cl_uint}"
|
1002
1003
|
error = OpenCL.clReleaseContext(ptr)
|
1003
1004
|
#STDERR.puts "Object released! #{error}"
|
1004
1005
|
OpenCL.error_check( error )
|
@@ -1026,6 +1027,9 @@ module OpenCL
|
|
1026
1027
|
# method called at CommandQueue deletion, releases the object if aplicable
|
1027
1028
|
def self.release(ptr)
|
1028
1029
|
#STDERR.puts "Releasing CommandQueue: #{ptr}"
|
1030
|
+
#ref_count = FFI::MemoryPointer.new( :cl_uint )
|
1031
|
+
#OpenCL.clGetCommandQueueInfo(ptr, OpenCL::CommandQueue::REFERENCE_COUNT, ref_count.size, ref_count, nil)
|
1032
|
+
#STDERR.puts "reference counter: #{ref_count.read_cl_uint}"
|
1029
1033
|
error = OpenCL.clReleaseCommandQueue(ptr)
|
1030
1034
|
#STDERR.puts "Object released! #{error}"
|
1031
1035
|
OpenCL.error_check( error )
|
@@ -1096,6 +1100,9 @@ module OpenCL
|
|
1096
1100
|
# method called at Mem deletion, releases the object if aplicable
|
1097
1101
|
def self.release(ptr)
|
1098
1102
|
#STDERR.puts "Releasing Mem: #{ptr}"
|
1103
|
+
#ref_count = FFI::MemoryPointer.new( :cl_uint )
|
1104
|
+
#OpenCL.clGetMemObjectInfo(ptr, OpenCL::Mem::REFERENCE_COUNT, ref_count.size, ref_count, nil)
|
1105
|
+
#STDERR.puts "reference counter: #{ref_count.read_cl_uint}"
|
1099
1106
|
error = OpenCL.clReleaseMemObject(ptr)
|
1100
1107
|
#STDERR.puts "Object released! #{error}"
|
1101
1108
|
OpenCL.error_check( error )
|
@@ -1200,6 +1207,9 @@ module OpenCL
|
|
1200
1207
|
# method called at Program deletion, releases the object if aplicable
|
1201
1208
|
def self.release(ptr)
|
1202
1209
|
#STDERR.puts "Releasing Program: #{ptr}"
|
1210
|
+
#ref_count = FFI::MemoryPointer.new( :cl_uint )
|
1211
|
+
#OpenCL.clGetProgramInfo(ptr, OpenCL::Program::REFERENCE_COUNT, ref_count.size, ref_count, nil)
|
1212
|
+
#STDERR.puts "reference counter: #{ref_count.read_cl_uint}"
|
1203
1213
|
error = OpenCL.clReleaseProgram(ptr)
|
1204
1214
|
#STDERR.puts "Object released! #{error}"
|
1205
1215
|
OpenCL.error_check( error )
|
@@ -1271,6 +1281,9 @@ module OpenCL
|
|
1271
1281
|
# method called at Kernel deletion, releases the object if aplicable
|
1272
1282
|
def self.release(ptr)
|
1273
1283
|
#STDERR.puts "Releasing Kernel: #{ptr}"
|
1284
|
+
#ref_count = FFI::MemoryPointer.new( :cl_uint )
|
1285
|
+
#OpenCL.clGetKernelInfo(ptr, OpenCL::Kernel::REFERENCE_COUNT, ref_count.size, ref_count, nil)
|
1286
|
+
#STDERR.puts "reference counter: #{ref_count.read_cl_uint}"
|
1274
1287
|
error = OpenCL.clReleaseKernel(ptr)
|
1275
1288
|
#STDERR.puts "Object released! #{error}"
|
1276
1289
|
OpenCL.error_check( error )
|
@@ -1380,6 +1393,9 @@ module OpenCL
|
|
1380
1393
|
# method called at Event deletion, releases the object if aplicable
|
1381
1394
|
def self.release(ptr)
|
1382
1395
|
#STDERR.puts "Releasing Event: #{ptr}"
|
1396
|
+
#ref_count = FFI::MemoryPointer.new( :cl_uint )
|
1397
|
+
#OpenCL.clGetEventInfo(ptr, OpenCL::Event::REFERENCE_COUNT, ref_count.size, ref_count, nil)
|
1398
|
+
#STDERR.puts "reference counter: #{ref_count.read_cl_uint}"
|
1383
1399
|
error = OpenCL.clReleaseEvent(ptr)
|
1384
1400
|
#STDERR.puts "Object released! #{error}"
|
1385
1401
|
OpenCL.error_check( error )
|
@@ -1406,6 +1422,9 @@ module OpenCL
|
|
1406
1422
|
# method called at Sampler deletion, releases the object if aplicable
|
1407
1423
|
def self.release(ptr)
|
1408
1424
|
#STDERR.puts "Releasing Sampler: #{ptr}"
|
1425
|
+
#ref_count = FFI::MemoryPointer.new( :cl_uint )
|
1426
|
+
#OpenCL.clGetSamplerInfo(ptr, OpenCL::Sampler::REFERENCE_COUNT, ref_count.size, ref_count, nil)
|
1427
|
+
#STDERR.puts "reference counter: #{ref_count.read_cl_uint}"
|
1409
1428
|
error = OpenCL.clReleaseSampler(ptr)
|
1410
1429
|
#STDERR.puts "Object released! #{error}"
|
1411
1430
|
OpenCL.error_check( error )
|
@@ -1426,7 +1445,6 @@ module OpenCL
|
|
1426
1445
|
|
1427
1446
|
# method called at GLsync deletion, releases the object if aplicable
|
1428
1447
|
def self.release(ptr)
|
1429
|
-
#STDERR.puts "Releasing GLsync: #{ptr}"
|
1430
1448
|
end
|
1431
1449
|
end
|
1432
1450
|
|
data/opencl_ruby_ffi.gemspec
CHANGED