opencl_ruby_ffi 0.995 → 0.996
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/opencl_ruby_ffi/CommandQueue.rb +22 -29
- data/lib/opencl_ruby_ffi/Image.rb +1 -1
- data/lib/opencl_ruby_ffi/Pipe.rb +1 -1
- data/lib/opencl_ruby_ffi/SVM.rb +13 -7
- data/lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb +9 -1
- data/opencl_ruby_ffi.gemspec +1 -1
- metadata +18 -26
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0713a0dacbcdc402b03447ecb6de63b041b359a3
|
4
|
+
data.tar.gz: 48115b80e8d5bade57ef1634972c52b1d3ce381b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8ba6e9b12fb6ffb166c57613bfd76011fbc28d92fa57b72661591870d34d188db580c8ba8d548bc6d658b3142e3e8b7d10442d67539593e7f0945bcd618cdaa2
|
7
|
+
data.tar.gz: 8dfe8b59516785150b979adf667ad85ce9dfae59589ab8167ee00181a323fecd5da5a0ea0876492c53859831636cfb8109e9e1ae04ac5a2512dbf6c42dd9c37e
|
@@ -549,7 +549,7 @@ module OpenCL
|
|
549
549
|
# ==== Returns
|
550
550
|
#
|
551
551
|
# the Event associated with the command
|
552
|
-
def self.
|
552
|
+
def self.enqueue_acquire_GL_objects( command_queue, mem_objects, options = {} )
|
553
553
|
num_objs = [mem_objects].flatten.length
|
554
554
|
objs = nil
|
555
555
|
if num_objs > 0 then
|
@@ -560,10 +560,13 @@ module OpenCL
|
|
560
560
|
end
|
561
561
|
num_events, events = get_event_wait_list( options )
|
562
562
|
event = FFI::MemoryPointer::new( Event )
|
563
|
-
error =
|
563
|
+
error = clEnqueueAcquireGLObjects( command_queue, num_objs, objs, num_events, events, event )
|
564
564
|
error_check(error)
|
565
565
|
return Event::new(event.read_pointer, false)
|
566
566
|
end
|
567
|
+
class << self
|
568
|
+
alias :enqueue_acquire_gl_objects :enqueue_acquire_GL_objects
|
569
|
+
end
|
567
570
|
|
568
571
|
# Release OpenCL Mem objects that have been created from OpenGL objects and previously acquired
|
569
572
|
#
|
@@ -580,7 +583,7 @@ module OpenCL
|
|
580
583
|
# ==== Returns
|
581
584
|
#
|
582
585
|
# the Event associated with the command
|
583
|
-
def self.
|
586
|
+
def self.enqueue_release_GL_objects( command_queue, mem_objects, options = {} )
|
584
587
|
num_objs = [mem_objects].flatten.length
|
585
588
|
objs = nil
|
586
589
|
if num_objs > 0 then
|
@@ -591,10 +594,13 @@ module OpenCL
|
|
591
594
|
end
|
592
595
|
num_events, events = get_event_wait_list( options )
|
593
596
|
event = FFI::MemoryPointer::new( Event )
|
594
|
-
error =
|
597
|
+
error = clEnqueueReleaseGLObjects( command_queue, num_objs, objs, num_events, events, event )
|
595
598
|
error_check(error)
|
596
599
|
return Event::new(event.read_pointer, false)
|
597
600
|
end
|
601
|
+
class << self
|
602
|
+
alias :enqueue_release_gl_objects :enqueue_release_GL_objects
|
603
|
+
end
|
598
604
|
|
599
605
|
# Enqueues a command to fill a Buffer with the given pattern
|
600
606
|
#
|
@@ -954,6 +960,9 @@ module OpenCL
|
|
954
960
|
error_check(error)
|
955
961
|
return Event::new(event.read_pointer, false)
|
956
962
|
end
|
963
|
+
class << self
|
964
|
+
alias :enqueue_nd_range_kernel :enqueue_NDrange_kernel
|
965
|
+
end
|
957
966
|
|
958
967
|
# Enqueues a barrier on a list of envents
|
959
968
|
#
|
@@ -1077,25 +1086,6 @@ module OpenCL
|
|
1077
1086
|
# Returns the :cl_command_queue_properties used to create the CommandQueue
|
1078
1087
|
eval get_info("CommandQueue", :cl_command_queue_properties, "PROPERTIES")
|
1079
1088
|
|
1080
|
-
# Enqueues a native kernel using the CommandQueue
|
1081
|
-
# not yet fully implemented
|
1082
|
-
#
|
1083
|
-
# ==== Attributes
|
1084
|
-
#
|
1085
|
-
# * +options+ - a hash containing named options
|
1086
|
-
# * +func+ - a Proc object to execute
|
1087
|
-
#
|
1088
|
-
# ==== Options
|
1089
|
-
#
|
1090
|
-
# * +:event_wait_list+ - if provided, a list of Event to wait upon before executing the command
|
1091
|
-
#
|
1092
|
-
# ==== Returns
|
1093
|
-
#
|
1094
|
-
# the Event associated with the command
|
1095
|
-
def enqueue_native_kernel( options = {}, &func )
|
1096
|
-
return OpenCL.enqueue_native_kernel( self, options, &func )
|
1097
|
-
end
|
1098
|
-
|
1099
1089
|
# Enqueues a kernel as a task using the CommandQueue
|
1100
1090
|
#
|
1101
1091
|
# ==== Attributes
|
@@ -1134,6 +1124,7 @@ module OpenCL
|
|
1134
1124
|
def enqueue_NDrange_kernel( kernel, global_work_size, options = {} )
|
1135
1125
|
return OpenCL.enqueue_NDrange_kernel( self, kernel, global_work_size, options )
|
1136
1126
|
end
|
1127
|
+
alias :enqueue_nd_range_kernel :enqueue_NDrange_kernel
|
1137
1128
|
|
1138
1129
|
# Enqueues a command to write to a Buffer object from host memory using the CommandQueue
|
1139
1130
|
#
|
@@ -1497,9 +1488,10 @@ module OpenCL
|
|
1497
1488
|
# ==== Returns
|
1498
1489
|
#
|
1499
1490
|
# the Event associated with the command
|
1500
|
-
def
|
1501
|
-
return OpenCL.
|
1491
|
+
def enqueue_acquire_GL_objects( mem_objects, options = {} )
|
1492
|
+
return OpenCL.enqueue_acquire_GL_objects( self, mem_objects, options )
|
1502
1493
|
end
|
1494
|
+
alias :enqueue_acquire_gl_objects :enqueue_acquire_GL_objects
|
1503
1495
|
|
1504
1496
|
# Release OpenCL Mem objects that have been created from OpenGL objects and previously acquired using the CommandQueue
|
1505
1497
|
#
|
@@ -1515,9 +1507,10 @@ module OpenCL
|
|
1515
1507
|
# ==== Returns
|
1516
1508
|
#
|
1517
1509
|
# the Event associated with the command
|
1518
|
-
def
|
1519
|
-
return OpenCL.
|
1510
|
+
def enqueue_release_GL_objects( mem_objects, options = {} )
|
1511
|
+
return OpenCL.enqueue_release_GL_objects( self, mem_objects, options )
|
1520
1512
|
end
|
1513
|
+
alias :enqueue_release_gl_objects :enqueue_release_GL_objects
|
1521
1514
|
|
1522
1515
|
# Enqueues a command to map a Buffer into host memory using the CommandQueue
|
1523
1516
|
#
|
@@ -1697,8 +1690,8 @@ module OpenCL
|
|
1697
1690
|
# ==== Returns
|
1698
1691
|
#
|
1699
1692
|
# the Event associated with the command
|
1700
|
-
def
|
1701
|
-
return OpenCL.
|
1693
|
+
def enqueue_svm_mem_fill(command_queue, svm_ptr, pattern, size, options = {})
|
1694
|
+
return OpenCL.enqueue_svm_mem_fill(self, svm_ptr, pattern, size, options)
|
1702
1695
|
end
|
1703
1696
|
|
1704
1697
|
# Enqueues a command to map an Image into host memory using the CommandQueue
|
data/lib/opencl_ruby_ffi/Pipe.rb
CHANGED
data/lib/opencl_ruby_ffi/SVM.rb
CHANGED
@@ -4,19 +4,25 @@ module OpenCL
|
|
4
4
|
class SVMPointer < FFI::Pointer
|
5
5
|
|
6
6
|
# create a new SVMPointer from its address and the context it pertains to
|
7
|
-
def initialize( address, context )
|
7
|
+
def initialize( address, context, size, base = nil )
|
8
8
|
super( address )
|
9
9
|
@context = context
|
10
|
+
if base then
|
11
|
+
@base = base
|
12
|
+
else
|
13
|
+
@base = address
|
14
|
+
end
|
15
|
+
@size = size
|
10
16
|
end
|
11
17
|
|
12
18
|
# creates a new SVMPointer relative to an existing one from an offset
|
13
19
|
def +( offset )
|
14
|
-
return SVMPointer::new( self.address + offset, @context )
|
20
|
+
return SVMPointer::new( self.address + offset, @context, @size, @base )
|
15
21
|
end
|
16
22
|
|
17
|
-
# frees the
|
23
|
+
# frees the parent memory region associated to this SVMPointer
|
18
24
|
def free
|
19
|
-
return OpenCL::svm_free( @context,
|
25
|
+
return OpenCL::svm_free( @context, @base )
|
20
26
|
end
|
21
27
|
|
22
28
|
end
|
@@ -40,7 +46,7 @@ module OpenCL
|
|
40
46
|
alignment = options[:alignment] if options[:alignment]
|
41
47
|
ptr = clSVMAlloc( context, flags, size, alignment )
|
42
48
|
error_check(MEM_OBJECT_ALLOCATION_FAILURE) if ptr.null?
|
43
|
-
return SVMPointer::new( ptr, context )
|
49
|
+
return SVMPointer::new( ptr, context, size )
|
44
50
|
end
|
45
51
|
|
46
52
|
# Frees an SVMPointer
|
@@ -140,12 +146,12 @@ module OpenCL
|
|
140
146
|
# ==== Returns
|
141
147
|
#
|
142
148
|
# the Event associated with the command
|
143
|
-
def self.
|
149
|
+
def self.enqueue_svm_mem_fill(command_queue, svm_ptr, pattern, size, options = {})
|
144
150
|
num_events, events = get_event_wait_list( options )
|
145
151
|
pattern_size = pattern.size
|
146
152
|
pattern_size = options[:pattern_size] if options[:pattern_size]
|
147
153
|
event = FFI::MemoryPointer::new( Event )
|
148
|
-
error =
|
154
|
+
error = clEnqueueSVMMemFill(command_queue, svm_ptr, pattern, pattern_size, size, num_events, events, event)
|
149
155
|
error_check(error)
|
150
156
|
return Event::new(event.read_pointer, false)
|
151
157
|
end
|
@@ -6,7 +6,15 @@ module OpenCL
|
|
6
6
|
begin
|
7
7
|
ffi_lib "OpenCL"
|
8
8
|
rescue LoadError => e
|
9
|
-
|
9
|
+
begin
|
10
|
+
ffi_lib "libOpenCL.so.1"
|
11
|
+
rescue LoadError => e
|
12
|
+
begin
|
13
|
+
ffi_lib '/System/Library/Frameworks/OpenCL.framework/OpenCL'
|
14
|
+
rescue LoadError => e
|
15
|
+
raise "OpenCL implementation not found!"
|
16
|
+
end
|
17
|
+
end
|
10
18
|
end
|
11
19
|
#:stopdoc:
|
12
20
|
SUCCESS = 0
|
data/opencl_ruby_ffi.gemspec
CHANGED
metadata
CHANGED
@@ -1,62 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opencl_ruby_ffi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
5
|
-
prerelease:
|
4
|
+
version: '0.996'
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Brice Videau
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2014-
|
11
|
+
date: 2014-12-02 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: narray
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 0.6.0.8
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 0.6.0.8
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: ffi
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: 1.9.3
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: 1.9.3
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: narray_ffi
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ">="
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0.2'
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - ">="
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0.2'
|
62
55
|
description: Ruby OpenCL FFI bindings. OpenCL 2.0 ready
|
@@ -65,7 +58,6 @@ executables: []
|
|
65
58
|
extensions: []
|
66
59
|
extra_rdoc_files: []
|
67
60
|
files:
|
68
|
-
- opencl_ruby_ffi.gemspec
|
69
61
|
- LICENSE
|
70
62
|
- lib/opencl_ruby_ffi.rb
|
71
63
|
- lib/opencl_ruby_ffi/Arithmetic_gen.rb
|
@@ -77,36 +69,36 @@ files:
|
|
77
69
|
- lib/opencl_ruby_ffi/Image.rb
|
78
70
|
- lib/opencl_ruby_ffi/Kernel.rb
|
79
71
|
- lib/opencl_ruby_ffi/Mem.rb
|
80
|
-
- lib/opencl_ruby_ffi/
|
81
|
-
- lib/opencl_ruby_ffi/opencl_ruby_ffi_base.rb
|
72
|
+
- lib/opencl_ruby_ffi/Pipe.rb
|
82
73
|
- lib/opencl_ruby_ffi/Platform.rb
|
83
74
|
- lib/opencl_ruby_ffi/Program.rb
|
84
|
-
- lib/opencl_ruby_ffi/Sampler.rb
|
85
|
-
- lib/opencl_ruby_ffi/Pipe.rb
|
86
75
|
- lib/opencl_ruby_ffi/SVM.rb
|
76
|
+
- lib/opencl_ruby_ffi/Sampler.rb
|
77
|
+
- lib/opencl_ruby_ffi/opencl_ruby_ffi_base.rb
|
78
|
+
- lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb
|
79
|
+
- opencl_ruby_ffi.gemspec
|
87
80
|
homepage: https://github.com/Nanosim-LIG/opencl-ruby
|
88
81
|
licenses:
|
89
82
|
- BSD
|
83
|
+
metadata: {}
|
90
84
|
post_install_message:
|
91
85
|
rdoc_options: []
|
92
86
|
require_paths:
|
93
87
|
- lib
|
94
88
|
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
-
none: false
|
96
89
|
requirements:
|
97
|
-
- -
|
90
|
+
- - ">="
|
98
91
|
- !ruby/object:Gem::Version
|
99
92
|
version: 1.8.7
|
100
93
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
-
none: false
|
102
94
|
requirements:
|
103
|
-
- -
|
95
|
+
- - ">="
|
104
96
|
- !ruby/object:Gem::Version
|
105
97
|
version: '0'
|
106
98
|
requirements: []
|
107
99
|
rubyforge_project:
|
108
|
-
rubygems_version:
|
100
|
+
rubygems_version: 2.2.2
|
109
101
|
signing_key:
|
110
|
-
specification_version:
|
102
|
+
specification_version: 4
|
111
103
|
summary: Ruby OpenCL FFI bindings
|
112
104
|
test_files: []
|