hwloc 0.2.0 → 0.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: '081b8121d7a652135e9b3737780c298fa7344cb6'
4
- data.tar.gz: 17d522c1332cda3854e27599c77427c04f2d84e7
3
+ metadata.gz: 9ba61e1a01e14b5b51f99082550eff817cfdf3cf
4
+ data.tar.gz: 27e11114673db41f5f885cec565e8b5e75721b75
5
5
  SHA512:
6
- metadata.gz: 425b74b3084abe8c680cdcd8b2179e892a87c3c2b27fa8350107be21e489c68664d87c21838399aeef66297d0e2dce1ce491a156893e3258c8ad92c5a6269ee6
7
- data.tar.gz: 48d341cb5425bc74dc089183e476d37335e90255e699d5bbf734a18e261e2b78188dcb545756693d34e7fe7a3e67fd18cf4ec5ef57e4284824f578dbb3f0055b
6
+ metadata.gz: 7aef73e3c365c766f4bb2218eb240ae8ab61d19cae1680a68b47763545bb9303ad59352264ab6c4ccc27db153427db04d657b096ab120f0a3473fa49f23eaf23
7
+ data.tar.gz: a9afb5b77ee7af7f150a38aa2d281ec8b0b8c1958e4624837805089b895e22385038992994e3fb0a300bcdd8ed65ba559bd8c02804d87aef5bd8466132653bb3
data/hwloc.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'hwloc'
3
- s.version = "0.2.0"
3
+ s.version = "0.3.0"
4
4
  s.author = "Brice Videau"
5
5
  s.email = "brice.videau@imag.fr"
6
6
  s.homepage = "https://github.com/Nanosim-LIG/hwloc-ruby"
@@ -11,4 +11,5 @@ Gem::Specification.new do |s|
11
11
  s.license = 'BSD-2-Clause'
12
12
  s.required_ruby_version = '>= 1.9.3'
13
13
  s.add_dependency 'ffi', '~> 1.9', '>=1.9.3'
14
+ s.add_dependency 'ffi-bitmask', '~> 0.1.0', '>=0.1.0'
14
15
  end
data/lib/hwloc/Bind.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  module Hwloc
2
- CpubindFlags = enum( :cpubin_flags, [
3
- :CPUBIND_PROCESS, 1<<0,
4
- :CPUBIND_THREAD, 1<<1,
5
- :CPUBIND_STRICT, 1<<2,
6
- :CPUBIND_NOMEMBIND, 1<<3
2
+ CpubindFlags = bitmask( :cpubind_flags, [
3
+ :CPUBIND_PROCESS,
4
+ :CPUBIND_THREAD,
5
+ :CPUBIND_STRICT,
6
+ :CPUBIND_NOMEMBIND
7
7
  ] )
8
8
 
9
9
  if API_VERSION < API_VERSION_2_0 then
@@ -27,23 +27,23 @@ module Hwloc
27
27
  ] )
28
28
  end
29
29
 
30
- MembindFlags = enum( :membind_flags, [
31
- :MEMBIND_PROCESS, 1<<0,
32
- :MEMBIND_THREAD, 1<<1,
33
- :MEMBIND_STRICT, 1<<2,
34
- :MEMBIND_MIGRATE, 1<<3,
35
- :MEMBIND_NOCPUBIND, 1<<4,
36
- :MEMBIND_BYNODESET, 1<<5
30
+ MembindFlags = bitmask( :membind_flags, [
31
+ :MEMBIND_PROCESS,
32
+ :MEMBIND_THREAD,
33
+ :MEMBIND_STRICT,
34
+ :MEMBIND_MIGRATE,
35
+ :MEMBIND_NOCPUBIND,
36
+ :MEMBIND_BYNODESET
37
37
  ] )
38
38
 
39
- attach_function :hwloc_set_cpubind, [:topology, :cpuset, :int], :int
40
- attach_function :hwloc_get_cpubind, [:topology, :cpuset, :int], :int
41
- attach_function :hwloc_set_proc_cpubind, [:topology, :hwloc_pid_t, :cpuset, :int], :int
42
- attach_function :hwloc_get_proc_cpubind, [:topology, :hwloc_pid_t, :cpuset, :int], :int
43
- attach_function :hwloc_set_thread_cpubind, [:topology, :hwloc_thread_t, :cpuset, :int], :int
44
- attach_function :hwloc_get_thread_cpubind, [:topology, :hwloc_thread_t, :cpuset, :int], :int
45
- attach_function :hwloc_get_last_cpu_location, [:topology, :cpuset, :int], :int
46
- attach_function :hwloc_get_proc_last_cpu_location, [:topology, :hwloc_pid_t, :cpuset, :int], :int
39
+ attach_function :hwloc_set_cpubind, [:topology, :cpuset, :cpubind_flags], :int
40
+ attach_function :hwloc_get_cpubind, [:topology, :cpuset, :cpubind_flags], :int
41
+ attach_function :hwloc_set_proc_cpubind, [:topology, :hwloc_pid_t, :cpuset, :cpubind_flags], :int
42
+ attach_function :hwloc_get_proc_cpubind, [:topology, :hwloc_pid_t, :cpuset, :cpubind_flags], :int
43
+ attach_function :hwloc_set_thread_cpubind, [:topology, :hwloc_thread_t, :cpuset, :cpubind_flags], :int
44
+ attach_function :hwloc_get_thread_cpubind, [:topology, :hwloc_thread_t, :cpuset, :cpubind_flags], :int
45
+ attach_function :hwloc_get_last_cpu_location, [:topology, :cpuset, :cpubind_flags], :int
46
+ attach_function :hwloc_get_proc_last_cpu_location, [:topology, :hwloc_pid_t, :cpuset, :cpubind_flags], :int
47
47
 
48
48
  class BindError < Error
49
49
  end
@@ -53,7 +53,7 @@ module Hwloc
53
53
 
54
54
  class Topology
55
55
 
56
- def set_cpubind(cpuset, flags = 0)
56
+ def set_cpubind(cpuset, *flags)
57
57
  if block_given? then
58
58
  oldcpuset = get_cpubind(flags)
59
59
  set_cpubind(cpuset, flags)
@@ -66,47 +66,47 @@ module Hwloc
66
66
  end
67
67
  end
68
68
 
69
- def get_cpubind(flags = 0)
69
+ def get_cpubind(*flags)
70
70
  cpuset = Cpuset::new
71
71
  err = Hwloc.hwloc_get_cpubind(@ptr, cpuset, flags)
72
72
  raise CpubindError if err == -1
73
73
  return cpuset
74
74
  end
75
75
 
76
- def set_proc_cpubind(pid, cpuset, flags = 0)
76
+ def set_proc_cpubind(pid, cpuset, *flags)
77
77
  err = Hwloc.hwloc_set_proc_cpubind(@ptr, pid, cpuset, flags)
78
78
  raise CpubindError if err == -1
79
79
  return self
80
80
  end
81
81
 
82
- def get_proc_cpubind(pid, flags)
82
+ def get_proc_cpubind(pid, *flags)
83
83
  cpuset = Cpuset::new
84
84
  err = Hwloc.hwloc_get_proc_cpubind(@ptr, pid, cpuset, flags)
85
85
  raise CpubindError if err == -1
86
86
  return cpuset
87
87
  end
88
88
 
89
- def set_thread_cpubind(thread, cpuset, flags = 0)
89
+ def set_thread_cpubind(thread, cpuset, *flags)
90
90
  err = Hwloc.hwloc_set_thread_cpubind(@ptr, thread, cpuset, flags)
91
91
  raise CpubindError if err == -1
92
92
  return self
93
93
  end
94
94
 
95
- def get_thread_cpubind(thread, flags = 0)
95
+ def get_thread_cpubind(thread, *flags)
96
96
  cpuset = Cpuset::new
97
97
  err = Hwloc.hwloc_get_thread_cpubind(@ptr, thread, cpuset, flags)
98
98
  raise CpubindError if err == -1
99
99
  return cpuset
100
100
  end
101
101
 
102
- def get_last_cpu_location(flags = 0)
102
+ def get_last_cpu_location(*flags)
103
103
  cpuset = Cpuset::new
104
104
  err = Hwloc.hwloc_get_last_cpu_location(@ptr, cpuset, flags)
105
105
  raise CpubindError if err == -1
106
106
  return cpuset
107
107
  end
108
108
 
109
- def get_proc_last_cpu_location(pid, flags = 0)
109
+ def get_proc_last_cpu_location(pid, *flags)
110
110
  cpuset = Cpuset::new
111
111
  err = Hwloc.hwloc_get_proc_last_cpu_location(@ptr, pid, cpuset, flags)
112
112
  raise CpubindError if err == -1
@@ -119,42 +119,41 @@ module Hwloc
119
119
  end
120
120
 
121
121
  if API_VERSION < API_VERSION_2_0 then
122
- attach_function :hwloc_set_membind_nodeset, [:topology, :nodeset, :membind_policy, :int], :int
123
- attach_function :hwloc_get_membind_nodeset, [:topology, :nodeset, :pointer, :int], :int
124
- attach_function :hwloc_set_proc_membind_nodeset, [:topology, :hwloc_pid_t, :nodeset, :membind_policy, :int], :int
125
- attach_function :hwloc_get_proc_membind_nodeset, [:topology, :hwloc_pid_t, :nodeset, :pointer, :int], :int
126
- attach_function :hwloc_set_area_membind_nodeset, [:topology, :pointer, :size_t, :nodeset, :membind_policy, :int], :int
127
- attach_function :hwloc_get_area_membind_nodeset, [:topology, :pointer, :size_t, :nodeset, :pointer, :int], :int
128
- attach_function :hwloc_alloc_membind_nodeset, [:topology, :size_t, :nodeset, :membind_policy, :int], :pointer
122
+ attach_function :hwloc_set_membind_nodeset, [:topology, :nodeset, :membind_policy, :membind_flags], :int
123
+ attach_function :hwloc_get_membind_nodeset, [:topology, :nodeset, :pointer, :membind_flags], :int
124
+ attach_function :hwloc_set_proc_membind_nodeset, [:topology, :hwloc_pid_t, :nodeset, :membind_policy, :membind_flags], :int
125
+ attach_function :hwloc_get_proc_membind_nodeset, [:topology, :hwloc_pid_t, :nodeset, :pointer, :membind_flags], :int
126
+ attach_function :hwloc_set_area_membind_nodeset, [:topology, :pointer, :size_t, :nodeset, :membind_policy, :membind_flags], :int
127
+ attach_function :hwloc_get_area_membind_nodeset, [:topology, :pointer, :size_t, :nodeset, :pointer, :membind_flags], :int
128
+ attach_function :hwloc_alloc_membind_nodeset, [:topology, :size_t, :nodeset, :membind_policy, :membind_flags], :pointer
129
129
  end
130
- attach_function :hwloc_set_membind, [:topology, :bitmap, :membind_policy, :int], :int
131
- attach_function :hwloc_get_membind, [:topology, :bitmap, :pointer, :int], :int
132
- attach_function :hwloc_set_proc_membind, [:topology, :hwloc_pid_t, :bitmap, :membind_policy, :int], :int
133
- attach_function :hwloc_get_proc_membind, [:topology, :hwloc_pid_t, :bitmap, :pointer, :int], :int
134
-
135
- attach_function :hwloc_set_area_membind, [:topology, :pointer, :size_t, :bitmap, :membind_policy, :int], :int
136
- attach_function :hwloc_get_area_membind, [:topology, :pointer, :size_t, :bitmap, :pointer, :int], :int
130
+ attach_function :hwloc_set_membind, [:topology, :bitmap, :membind_policy, :membind_flags], :int
131
+ attach_function :hwloc_get_membind, [:topology, :bitmap, :pointer, :membind_flags], :int
132
+ attach_function :hwloc_set_proc_membind, [:topology, :hwloc_pid_t, :bitmap, :membind_policy, :membind_flags], :int
133
+ attach_function :hwloc_get_proc_membind, [:topology, :hwloc_pid_t, :bitmap, :pointer, :membind_flags], :int
134
+ attach_function :hwloc_set_area_membind, [:topology, :pointer, :size_t, :bitmap, :membind_policy, :membind_flags], :int
135
+ attach_function :hwloc_get_area_membind, [:topology, :pointer, :size_t, :bitmap, :pointer, :membind_flags], :int
137
136
 
138
137
  begin
139
- attach_function :hwloc_get_area_memlocation, [:topology, :pointer, :size_t, :bitmap, :int], :int
138
+ attach_function :hwloc_get_area_memlocation, [:topology, :pointer, :size_t, :bitmap, :membind_flags], :int
140
139
  rescue FFI::NotFoundError
141
140
  warn "Missing hwloc_get_area_memlocation support!"
142
141
  end
143
142
 
144
143
  attach_function :hwloc_alloc, [:topology, :size_t], :pointer
145
- attach_function :hwloc_alloc_membind, [:topology, :size_t, :bitmap, :membind_policy, :int], :pointer
144
+ attach_function :hwloc_alloc_membind, [:topology, :size_t, :bitmap, :membind_policy, :membind_flags], :pointer
146
145
  attach_function :hwloc_free, [:topology, :pointer, :size_t], :int
147
146
 
148
147
  class Topology
149
148
 
150
149
  if API_VERSION < API_VERSION_2_0 then
151
- def set_membind_nodeset(nodeset, policy, flags=0)
150
+ def set_membind_nodeset(nodeset, policy, *flags)
152
151
  err = Hwloc.hwloc_set_membind_nodeset(@ptr, nodeset, policy, flags)
153
152
  raise MembindError if err == -1
154
153
  return self
155
154
  end
156
155
 
157
- def get_membind_nodeset(flags=0)
156
+ def get_membind_nodeset(*flags)
158
157
  nodeset = Nodeset::new
159
158
  policy_p = FFI::MemoryPointer::new(MembindPolicy.native_type)
160
159
  err = Hwloc.hwloc_get_membind_nodeset(@ptr, nodeset, policy_p, flags)
@@ -163,13 +162,13 @@ module Hwloc
163
162
  return [nodeset, MembindPolicy[policy]]
164
163
  end
165
164
 
166
- def set_proc_membind_nodeset(pid, nodeset, policy, flags=0)
165
+ def set_proc_membind_nodeset(pid, nodeset, policy, *flags)
167
166
  err = Hwloc.hwloc_set_proc_membind_nodeset(@ptr, pid, nodeset, policy, flags)
168
167
  raise MembindError if err == -1
169
168
  return self
170
169
  end
171
170
 
172
- def get_proc_membind_nodeset(pid, flags=0)
171
+ def get_proc_membind_nodeset(pid, *flags)
173
172
  nodeset = Nodeset::new
174
173
  policy_p = FFI::MemoryPointer::new(MembindPolicy.native_type)
175
174
  err = Hwloc.hwloc_get_proc_membind_nodeset(@ptr, pid, nodeset, policy_p, flags)
@@ -178,13 +177,13 @@ module Hwloc
178
177
  return [nodeset, policy]
179
178
  end
180
179
 
181
- def set_area_membind_nodeset(pointer, nodeset, policy, flags=0)
180
+ def set_area_membind_nodeset(pointer, nodeset, policy, *flags)
182
181
  err = Hwloc.hwloc_set_area_membind_nodeset(@ptr, pointer, pointer.size, nodeset, policy, flags)
183
182
  raise MembindError if err == -1
184
183
  return self
185
184
  end
186
185
 
187
- def get_area_membind_nodeset(pointer, flags=0)
186
+ def get_area_membind_nodeset(pointer, *flags)
188
187
  nodeset = Nodeset::new
189
188
  policy_p = FFI::MemoryPointer::new(MembindPolicy.native_type)
190
189
  err = Hwloc.hwloc_get_area_membind_nodeset(@ptr, pointer, pointer.size, nodeset, policy_p, flags)
@@ -193,14 +192,14 @@ module Hwloc
193
192
  return [nodeset, policy]
194
193
  end
195
194
 
196
- def alloc_membind_nodeset(size, nodeset, policy, flags=0)
195
+ def alloc_membind_nodeset(size, nodeset, policy, *flags)
197
196
  ptr = Hwloc.hwloc_alloc_membind_nodeset(@ptr, size, nodeset, policy, flags)
198
197
  raise MembindError if ptr.null?
199
198
  ptr = ptr.slice(0, size)
200
199
  return FFI::AutoPointer::new(ptr, self.method(:free))
201
200
  end
202
201
 
203
- def alloc_membind_policy_nodeset(size, nodeset, policy, flags=0)
202
+ def alloc_membind_policy_nodeset(size, nodeset, policy, *flags)
204
203
  begin
205
204
  return alloc_membind_nodeset(size, nodeset, policy, flags)
206
205
  rescue MembindError
@@ -213,7 +212,7 @@ module Hwloc
213
212
 
214
213
  end
215
214
 
216
- def set_membind(set, policy, flags=0)
215
+ def set_membind(set, policy, *flags)
217
216
  if block_given? then
218
217
  oldset, oldpolicy = get_membind(flags)
219
218
  set_membind(set, policy, flags)
@@ -226,7 +225,7 @@ module Hwloc
226
225
  end
227
226
  end
228
227
 
229
- def get_membind(flags=0)
228
+ def get_membind(*flags)
230
229
  set = Bitmap::new
231
230
  policy_p = FFI::MemoryPointer::new(MembindPolicy.native_type)
232
231
  err = Hwloc.hwloc_get_membind(@ptr, set, policy_p, flags)
@@ -235,13 +234,13 @@ module Hwloc
235
234
  return [set, MembindPolicy[policy]]
236
235
  end
237
236
 
238
- def set_proc_membind(pid, set, policy, flags=0)
237
+ def set_proc_membind(pid, set, policy, *flags)
239
238
  err = Hwloc.hwloc_set_proc_membind(@ptr, pid, set, policy, flags)
240
239
  raise MembindError if err == -1
241
240
  return self
242
241
  end
243
242
 
244
- def get_proc_membind(pid, flags=0)
243
+ def get_proc_membind(pid, *flags)
245
244
  set = Bitmap::new
246
245
  policy_p = FFI::MemoryPointer::new(MembindPolicy.native_type)
247
246
  err = Hwloc.hwloc_get_proc_membind(@ptr, pid, set, policy_p, flags)
@@ -250,13 +249,13 @@ module Hwloc
250
249
  return [set, policy]
251
250
  end
252
251
 
253
- def set_area_membind(pointer, set, policy, flags=0)
252
+ def set_area_membind(pointer, set, policy, *flags)
254
253
  err = Hwloc.hwloc_set_area_membind(@ptr, pointer, pointer.size, set, policy, flags)
255
254
  raise MembindError if err == -1
256
255
  return self
257
256
  end
258
257
 
259
- def get_area_membind(pointer, flags=0)
258
+ def get_area_membind(pointer, *flags)
260
259
  set = Bitmap::new
261
260
  policy_p = FFI::MemoryPointer::new(MembindPolicy.native_type)
262
261
  err = Hwloc.hwloc_get_area_membind(@ptr, pointer, pointer.size, set, policy_p, flags)
@@ -266,7 +265,7 @@ module Hwloc
266
265
  end
267
266
 
268
267
  if Hwloc.respond_to?(:hwloc_get_area_memlocation)
269
- def get_area_memlocation(pointer, flags=0)
268
+ def get_area_memlocation(pointer, *flags)
270
269
  set = Bitmap::new
271
270
  err = Hwloc.hwloc_get_area_memlocation(@ptr, pointer, pointer.size, set, flags)
272
271
  raise MembindError if err == -1
@@ -281,14 +280,14 @@ module Hwloc
281
280
  return FFI::AutoPointer::new(ptr, self.method(:free))
282
281
  end
283
282
 
284
- def alloc_membind(size, set, policy, flags=0)
283
+ def alloc_membind(size, set, policy, *flags)
285
284
  ptr = Hwloc.hwloc_alloc_membind(@ptr, size, set, policy, flags)
286
285
  raise MembindError if ptr.null?
287
286
  ptr = ptr.slice(0, size)
288
287
  return FFI::AutoPointer::new(ptr, self.method(:free))
289
288
  end
290
289
 
291
- def alloc_membind_policy(size, set, policy, flags=0)
290
+ def alloc_membind_policy(size, set, policy, *flags)
292
291
  begin
293
292
  return alloc_membind(size, set, policy, flags)
294
293
  rescue MembindError
data/lib/hwloc/Edition.rb CHANGED
@@ -13,20 +13,20 @@ module Hwloc
13
13
  end
14
14
 
15
15
  if API_VERSION < API_VERSION_2_0 then
16
- RestrictFlags = enum( FFI::find_type(:ulong), :restrict_flags, [
17
- :RESTRICT_FLAG_ADAPT_DISTANCES, 1<<0,
18
- :RESTRICT_FLAG_ADAPT_MISC, 1<<1,
19
- :RESTRICT_FLAG_ADAPT_IO, 1<<2
16
+ RestrictFlags = bitmask( FFI::find_type(:ulong), :restrict_flags, [
17
+ :RESTRICT_FLAG_ADAPT_DISTANCES,
18
+ :RESTRICT_FLAG_ADAPT_MISC,
19
+ :RESTRICT_FLAG_ADAPT_IO
20
20
  ] )
21
21
  else
22
- RestrictFlags = enum( FFI::find_type(:ulong), :restrict_flags, [
23
- :RESTRICT_FLAG_REMOVE_CPULESS, 1<<0,
24
- :RESTRICT_FLAG_ADAPT_MISC, 1<<1,
25
- :RESTRICT_FLAG_ADAPT_IO, 1<<2
22
+ RestrictFlags = bitmask( FFI::find_type(:ulong), :restrict_flags, [
23
+ :RESTRICT_FLAG_REMOVE_CPULESS,
24
+ :RESTRICT_FLAG_ADAPT_MISC,
25
+ :RESTRICT_FLAG_ADAPT_IO
26
26
  ] )
27
27
  end
28
28
 
29
- attach_function :hwloc_topology_restrict, [:topology, :cpuset, :ulong], :int
29
+ attach_function :hwloc_topology_restrict, [:topology, :cpuset, :restrict_flags], :int
30
30
 
31
31
  class EditionError < TopologyError
32
32
  end
data/lib/hwloc/Export.rb CHANGED
@@ -4,11 +4,11 @@ module Hwloc
4
4
  attach_function :hwloc_topology_export_xml, [:topology, :string], :int
5
5
  attach_function :hwloc_topology_export_xmlbuffer, [:topology, :pointer, :pointer], :int
6
6
  else
7
- TopologyExportXmlFlags = enum( FFI::find_type(:ulong), :topology_export_xml_flags, [
8
- :TOPOLOGY_EXPORT_XML_FLAG_V1, 1<<0
7
+ TopologyExportXmlFlags = bitmask( FFI::find_type(:ulong), :topology_export_xml_flags, [
8
+ :TOPOLOGY_EXPORT_XML_FLAG_V1
9
9
  ] )
10
- attach_function :hwloc_topology_export_xml, [:topology, :string, :ulong], :int
11
- attach_function :hwloc_topology_export_xmlbuffer, [:topology, :pointer, :pointer, :ulong], :int
10
+ attach_function :hwloc_topology_export_xml, [:topology, :string, :topology_export_xml_flags], :int
11
+ attach_function :hwloc_topology_export_xmlbuffer, [:topology, :pointer, :pointer, :topology_export_xml_flags], :int
12
12
  end
13
13
 
14
14
  attach_function :hwloc_free_xmlbuffer, [:topology, :pointer], :void
@@ -22,12 +22,12 @@ module Hwloc
22
22
  callback :hwloc_topology_set_userdata_import_callback_callback, [:topology, Obj.ptr, :string, :pointer, :size_t], :void
23
23
  attach_function :hwloc_topology_set_userdata_import_callback, [:topology, :hwloc_topology_set_userdata_import_callback_callback], :void
24
24
 
25
- TopologyExportSyntheticFlags = enum( FFI::find_type(:ulong), :topology_export_synthetic_flags, [
26
- :TOPOLOGY_EXPORT_SYNTHETIC_FLAG_NO_EXTENDED_TYPES, 1<<0,
27
- :TOPOLOGY_EXPORT_SYNTHETIC_FLAG_NO_ATTRS, 1<<1
25
+ TopologyExportSyntheticFlags = bitmask( FFI::find_type(:ulong), :topology_export_synthetic_flags, [
26
+ :TOPOLOGY_EXPORT_SYNTHETIC_FLAG_NO_EXTENDED_TYPES,
27
+ :TOPOLOGY_EXPORT_SYNTHETIC_FLAG_NO_ATTRS
28
28
  ] )
29
29
 
30
- attach_function :hwloc_topology_export_synthetic, [:topology, :pointer, :size_t, :uint], :int
30
+ attach_function :hwloc_topology_export_synthetic, [:topology, :pointer, :size_t, :topology_export_synthetic_flags], :int
31
31
 
32
32
  class ExportError < TopologyError
33
33
  end
data/lib/hwloc/Hwloc.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'ffi'
2
+ require 'ffi/bitmask'
2
3
 
3
4
  module Hwloc
4
5
  extend FFI::Library
data/lib/hwloc/Obj.rb CHANGED
@@ -137,22 +137,22 @@ module Hwloc
137
137
  end
138
138
  else
139
139
 
140
- DistancesKind = enum(FFI::find_type(:ulong), :distances_kind, [
141
- :DISTANCES_KIND_FROM_OS, 1<<0,
142
- :DISTANCES_KIND_FROM_USER, 1<<1,
143
- :DISTANCES_KIND_MEANS_LATENCY, 1<<2,
144
- :DISTANCES_KIND_MEANS_BANDWIDTH, 1<<3
140
+ DistancesKind = bitmask(FFI::find_type(:ulong), :distances_kind, [
141
+ :DISTANCES_KIND_FROM_OS,
142
+ :DISTANCES_KIND_FROM_USER,
143
+ :DISTANCES_KIND_MEANS_LATENCY,
144
+ :DISTANCES_KIND_MEANS_BANDWIDTH
145
145
  ])
146
146
 
147
- DistancesFlag = enum(FFI::find_type(:ulong), :distances_flag, [
148
- :DISTANCES_FLAG_GROUP, 1<<0,
149
- :DISTANCES_FLAG_GROUP_INACCURATE, 1<<1
147
+ DistancesFlag = bitmask(FFI::find_type(:ulong), :distances_flag, [
148
+ :DISTANCES_FLAG_GROUP,
149
+ :DISTANCES_FLAG_GROUP_INACCURATE
150
150
  ])
151
151
 
152
152
  class Distances < Struct
153
153
  layout :nbobjs, :uint,
154
154
  :objs, :pointer,
155
- :kind, :ulong,
155
+ :kind, :distances_kind,
156
156
  :values, :pointer
157
157
 
158
158
  def objs
@@ -67,24 +67,24 @@ module Hwloc
67
67
  attach_function :hwloc_topology_check, [:topology], :void
68
68
 
69
69
  if API_VERSION < API_VERSION_2_0 then
70
- TopologyFlags = enum( FFI::find_type(:ulong), :topology_flags, [
71
- :TOPOLOGY_FLAG_WHOLE_SYSTEM, 1<<0,
72
- :TOPOLOGY_FLAG_IS_THISSYSTEM, 1<<1,
73
- :TOPOLOGY_FLAG_IO_DEVICES, 1<<2,
74
- :TOPOLOGY_FLAG_IO_BRIDGES, 1<<3,
75
- :TOPOLOGY_FLAG_WHOLE_IO, 1<<4,
76
- :TOPOLOGY_FLAG_ICACHES, 1<<5
70
+ TopologyFlags = bitmask( FFI::find_type(:ulong), :topology_flags, [
71
+ :TOPOLOGY_FLAG_WHOLE_SYSTEM,
72
+ :TOPOLOGY_FLAG_IS_THISSYSTEM,
73
+ :TOPOLOGY_FLAG_IO_DEVICES,
74
+ :TOPOLOGY_FLAG_IO_BRIDGES,
75
+ :TOPOLOGY_FLAG_WHOLE_IO,
76
+ :TOPOLOGY_FLAG_ICACHES
77
77
  ] )
78
78
  else
79
- TopologyFlags = enum( FFI::find_type(:ulong), :topology_flags, [
80
- :TOPOLOGY_FLAG_WHOLE_SYSTEM, 1<<0,
81
- :TOPOLOGY_FLAG_IS_THISSYSTEM, 1<<1,
82
- :TOPOLOGY_FLAG_THISSYSTEM_ALLOWED_RESOURCES, 1<<2
79
+ TopologyFlags = bitmask( FFI::find_type(:ulong), :topology_flags, [
80
+ :TOPOLOGY_FLAG_WHOLE_SYSTEM,
81
+ :TOPOLOGY_FLAG_IS_THISSYSTEM,
82
+ :TOPOLOGY_FLAG_THISSYSTEM_ALLOWED_RESOURCES
83
83
  ] )
84
84
  end
85
85
 
86
- attach_function :hwloc_topology_set_flags, [:topology, :ulong], :int
87
- attach_function :hwloc_topology_get_flags, [:topology], :ulong
86
+ attach_function :hwloc_topology_set_flags, [:topology, :topology_flags], :int
87
+ attach_function :hwloc_topology_get_flags, [:topology], :topology_flags
88
88
 
89
89
  attach_function :hwloc_topology_set_pid, [:topology, :hwloc_pid_t], :int
90
90
  if API_VERSION < API_VERSION_2_0 then
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hwloc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brice Videau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-11 00:00:00.000000000 Z
11
+ date: 2017-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -30,6 +30,26 @@ dependencies:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: 1.9.3
33
+ - !ruby/object:Gem::Dependency
34
+ name: ffi-bitmask
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: 0.1.0
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 0.1.0
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: 0.1.0
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 0.1.0
33
53
  description: hwloc ruby bindings for versions 1.10 onward
34
54
  email: brice.videau@imag.fr
35
55
  executables: []