Class: Hwloc::Topology
- Inherits:
-
Object
- Object
- Hwloc::Topology
- Includes:
- Enumerable
- Defined in:
- lib/hwloc/Bind.rb,
lib/hwloc/Bind.rb,
lib/hwloc/Export.rb,
lib/hwloc/Edition.rb,
lib/hwloc/Topology.rb
Constant Summary collapse
- Flags =
TopologyFlags
Instance Attribute Summary collapse
-
#ptr ⇒ Object
readonly
Returns the value of attribute ptr.
Class Method Summary collapse
Instance Method Summary collapse
- #alloc(size) ⇒ Object
- #alloc_membind(size, set, policy, flags = 0) ⇒ Object
- #alloc_membind_nodeset(size, nodeset, policy, flags = 0) ⇒ Object
- #alloc_membind_policy(size, set, policy, flags = 0) ⇒ Object
- #alloc_membind_policy_nodeset(size, nodeset, policy, flags = 0) ⇒ Object
- #check ⇒ Object
- #custom_insert_group_object_by_parent(parent, groupdepth) ⇒ Object
- #custom_insert_topology(newparent, oldtopology, oldroot = nil) ⇒ Object
- #dup ⇒ Object
- #each_by_depth(depth) ⇒ Object
- #each_by_type(type, &block) ⇒ Object
- #each_obj(&block) ⇒ Object (also: #traverse, #each)
- #export_synthetic(flags = 0) ⇒ Object
- #export_xml(xmlpath, flags = 0) ⇒ Object
- #export_xmlbuffer(flags = 0) ⇒ Object
- #get_area_membind(pointer, flags = 0) ⇒ Object
- #get_area_membind_nodeset(pointer, flags = 0) ⇒ Object
- #get_area_memlocation(pointer, flags = 0) ⇒ Object
- #get_cpubind(flags = 0) ⇒ Object
- #get_depth ⇒ Object (also: #depth)
- #get_depth_type(depth) ⇒ Object
- #get_flags ⇒ Object (also: #flags)
- #get_last_cpu_location(flags = 0) ⇒ Object
- #get_membind(flags = 0) ⇒ Object
- #get_membind_nodeset(flags = 0) ⇒ Object
- #get_nbobjs_by_depth(depth) ⇒ Object
- #get_nbobjs_by_type(type) ⇒ Object
- #get_next_obj_by_depth(depth, prev) ⇒ Object
- #get_next_obj_by_type(type, prev) ⇒ Object
- #get_obj_by_depth(depth, idx) ⇒ Object
- #get_obj_by_type(type, idx) ⇒ Object
- #get_proc_cpubind(pid, flags) ⇒ Object
- #get_proc_last_cpu_location(pid, flags = 0) ⇒ Object
- #get_proc_membind(pid, flags = 0) ⇒ Object
- #get_proc_membind_nodeset(pid, flags = 0) ⇒ Object
- #get_root_obj ⇒ Object (also: #root_obj)
- #get_support ⇒ Object (also: #support)
- #get_thread_cpubind(thread, flags = 0) ⇒ Object
- #get_type_depth(type) ⇒ Object
- #get_type_filter(type) ⇒ Object
- #get_type_or_above_depth(type) ⇒ Object
- #get_type_or_below_depth(type) ⇒ Object
- #ignore_type(type) ⇒ Object
- #ignore_type_keep_structure(type) ⇒ Object
-
#initialize(*args) ⇒ Topology
constructor
A new instance of Topology.
- #insert_misc_object_by_cpuset(cpuset, name) ⇒ Object
- #insert_misc_object_by_parent(parent, name) ⇒ Object (also: #insert_misc_object)
- #inspect ⇒ Object
-
#is_thissystem ⇒ Object
(also: #thissystem?)
Will need some work to define properly…
- #load ⇒ Object
- #restrict(cpuset, flags) ⇒ Object
- #set_all_types_filter(filter) ⇒ Object
- #set_area_membind(pointer, set, policy, flags = 0) ⇒ Object
- #set_area_membind_nodeset(pointer, nodeset, policy, flags = 0) ⇒ Object
- #set_cache_types_filter(filter) ⇒ Object
- #set_cpubind(cpuset, flags = 0) ⇒ Object
- #set_custom ⇒ Object
- #set_flags(flags) ⇒ Object (also: #flags=)
- #set_fsroot(fsroot_path) ⇒ Object
- #set_icache_types_filter(filter) ⇒ Object
- #set_io_types_filter(filter) ⇒ Object
- #set_membind(set, policy, flags = 0) ⇒ Object
- #set_membind_nodeset(nodeset, policy, flags = 0) ⇒ Object
- #set_pid(pid) ⇒ Object
- #set_proc_cpubind(pid, cpuset, flags = 0) ⇒ Object
- #set_proc_membind(pid, set, policy, flags = 0) ⇒ Object
- #set_proc_membind_nodeset(pid, nodeset, policy, flags = 0) ⇒ Object
- #set_synthetic(description) ⇒ Object
- #set_thread_cpubind(thread, cpuset, flags = 0) ⇒ Object
- #set_type_filter(type, filter) ⇒ Object
- #set_xml(xmlpath) ⇒ Object
- #set_xmlbuffer(pointer) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(*args) ⇒ Topology
Returns a new instance of Topology.
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/hwloc/Topology.rb', line 168 def initialize( *args ) if args.length == 0 then ptr = FFI::MemoryPointer::new( :pointer ) err = Hwloc.hwloc_topology_init(ptr) raise TopologyError if err == -1 @ptr = FFI::AutoPointer::new( ptr.read_pointer, Hwloc.method(:hwloc_topology_destroy) ) elsif args.length == 1 then arg = args[0] if arg.kind_of?( Topology ) then ptr = FFI::MemoryPointer::new( :pointer ) err = Hwloc.hwloc_topology_dup(ptr, arg.ptr) raise TopologyError if err == -1 @ptr = FFI::AutoPointer::new( ptr.read_pointer, Hwloc.method(:hwloc_topology_destroy) ) else raise TopologyError, "Invalid argument" end else raise TopologyError, "Invalid argument" end end |
Instance Attribute Details
#ptr ⇒ Object (readonly)
Returns the value of attribute ptr.
162 163 164 |
# File 'lib/hwloc/Topology.rb', line 162 def ptr @ptr end |
Class Method Details
.const_missing(sym) ⇒ Object
151 152 153 154 155 156 157 158 |
# File 'lib/hwloc/Topology.rb', line 151 def self.const_missing( sym ) begin value = Hwloc.const_get( "TOPOLOGY_#{sym}".to_sym ) return value rescue end super end |
Instance Method Details
#alloc(size) ⇒ Object
277 278 279 280 281 282 |
# File 'lib/hwloc/Bind.rb', line 277 def alloc(size) ptr = Hwloc.hwloc_alloc(@ptr, size) raise MembindError if ptr.null? ptr = ptr.slice(0, size) return FFI::AutoPointer::new(ptr, self.method(:free)) end |
#alloc_membind(size, set, policy, flags = 0) ⇒ Object
284 285 286 287 288 289 |
# File 'lib/hwloc/Bind.rb', line 284 def alloc_membind(size, set, policy, flags=0) ptr = Hwloc.hwloc_alloc_membind(@ptr, size, set, policy, flags) raise MembindError if ptr.null? ptr = ptr.slice(0, size) return FFI::AutoPointer::new(ptr, self.method(:free)) end |
#alloc_membind_nodeset(size, nodeset, policy, flags = 0) ⇒ Object
196 197 198 199 200 201 |
# File 'lib/hwloc/Bind.rb', line 196 def alloc_membind_nodeset(size, nodeset, policy, flags=0) ptr = Hwloc.hwloc_alloc_membind_nodeset(@ptr, size, nodeset, policy, flags) raise MembindError if ptr.null? ptr = ptr.slice(0, size) return FFI::AutoPointer::new(ptr, self.method(:free)) end |
#alloc_membind_policy(size, set, policy, flags = 0) ⇒ Object
291 292 293 294 295 296 297 298 299 300 |
# File 'lib/hwloc/Bind.rb', line 291 def alloc_membind_policy(size, set, policy, flags=0) begin return alloc_membind(size, set, policy, flags) rescue MembindError set_membind(set, policy, flags) ptr = alloc(size) ptr.clear if policy != Hwloc::MEMBIND_FIRSTTOUCH return ptr end end |
#alloc_membind_policy_nodeset(size, nodeset, policy, flags = 0) ⇒ Object
203 204 205 206 207 208 209 210 211 212 |
# File 'lib/hwloc/Bind.rb', line 203 def alloc_membind_policy_nodeset(size, nodeset, policy, flags=0) begin return alloc_membind_nodeset(size, nodeset, policy, flags) rescue MembindError set_membind_nodeset(nodeset, policy, flags) ptr = alloc(size) ptr.clear if policy != Hwloc::MEMBIND_FIRSTTOUCH return ptr end end |
#check ⇒ Object
199 200 201 202 |
# File 'lib/hwloc/Topology.rb', line 199 def check Hwloc.hwloc_topology_check(@ptr) return self end |
#custom_insert_group_object_by_parent(parent, groupdepth) ⇒ Object
59 60 61 62 63 64 |
# File 'lib/hwloc/Edition.rb', line 59 def custom_insert_group_object_by_parent(parent, groupdepth) obj = Hwloc.hwloc_custom_insert_group_object_by_parent(@ptr, parent, groupdepth) raise EditionError if obj.to_ptr.null? obj.instance_variable_set(:@topology, self) return obj end |
#custom_insert_topology(newparent, oldtopology, oldroot = nil) ⇒ Object
53 54 55 56 57 |
# File 'lib/hwloc/Edition.rb', line 53 def custom_insert_topology(newparent, oldtopology, oldroot = nil) err = Hwloc.hwloc_custom_insert_topology(@ptr, newparent, oldtopology.ptr, oldroot) raise EditionError if err == -1 return self end |
#dup ⇒ Object
195 196 197 |
# File 'lib/hwloc/Topology.rb', line 195 def dup return Topology::new( self ) end |
#each_by_depth(depth) ⇒ Object
436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 |
# File 'lib/hwloc/Topology.rb', line 436 def each_by_depth(depth) if block_given? then idx = 0 while o = get_obj_by_depth(depth, idx) do yield o idx += 1 end return self else return Enumerator::new do |yielder| idx = 0 while o = get_obj_by_depth(depth, idx) do yielder << o idx += 1 end end end end |
#each_by_type(type, &block) ⇒ Object
455 456 457 458 459 |
# File 'lib/hwloc/Topology.rb', line 455 def each_by_type(type, &block) depth = get_type_depth(type) return each_obj.select{ |e| e.type == type }.each(&block) if depth == Hwloc::TYPE_DEPTH_MULTIPLE return each_by_depth(depth, &block) end |
#each_obj(&block) ⇒ Object Also known as: traverse, each
473 474 475 476 477 478 479 480 481 |
# File 'lib/hwloc/Topology.rb', line 473 def each_obj(&block) if block then obj = get_root_obj obj.each_obj(&block) return self else to_enum(:each_obj) end end |
#export_synthetic(flags = 0) ⇒ Object
75 76 77 78 79 80 |
# File 'lib/hwloc/Export.rb', line 75 def export_synthetic(flags = 0) str_ptr = FFI::MemoryPointer::new(:char, 2048) err = Hwloc.hwloc_topology_export_synthetic(@ptr, str_ptr, str_ptr.size, flags) raise ExportError, "Topology not symetric" if err == -1 return str_ptr.read_string end |
#export_xml(xmlpath, flags = 0) ⇒ Object
38 39 40 41 42 |
# File 'lib/hwloc/Export.rb', line 38 def export_xml(xmlpath) err = Hwloc.hwloc_topology_export_xml(@ptr, xmlpath) raise ExportError if err == -1 return self end |
#export_xmlbuffer(flags = 0) ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'lib/hwloc/Export.rb', line 44 def export_xmlbuffer data_p = FFI::MemoryPointer::new(:pointer) count_p = FFI::MemoryPointer::new(:int) err = Hwloc.hwloc_topology_export_xmlbuffer(@ptr, data_p, count_p) raise ExportError if err == -1 xmlbuffer_p = data_p.read_pointer.slice(0, count_p.read_int) return FFI::AutoPointer::new(xmlbuffer_p, self.method(:free_xmlbuffer)) end |
#get_area_membind(pointer, flags = 0) ⇒ Object
259 260 261 262 263 264 265 266 |
# File 'lib/hwloc/Bind.rb', line 259 def get_area_membind(pointer, flags=0) set = Bitmap::new policy_p = FFI::MemoryPointer::new(MembindPolicy.native_type) err = Hwloc.hwloc_get_area_membind(@ptr, pointer, pointer.size, set, policy_p, flags) raise MembindError if err == -1 policy = MembindPolicy[policy_p.read_int] return [set, policy] end |
#get_area_membind_nodeset(pointer, flags = 0) ⇒ Object
187 188 189 190 191 192 193 194 |
# File 'lib/hwloc/Bind.rb', line 187 def get_area_membind_nodeset(pointer, flags=0) nodeset = Nodeset::new policy_p = FFI::MemoryPointer::new(MembindPolicy.native_type) err = Hwloc.hwloc_get_area_membind_nodeset(@ptr, pointer, pointer.size, nodeset, policy_p, flags) raise MembindError if err == -1 policy = MembindPolicy[policy_p.read_int] return [nodeset, policy] end |
#get_area_memlocation(pointer, flags = 0) ⇒ Object
269 270 271 272 273 274 |
# File 'lib/hwloc/Bind.rb', line 269 def get_area_memlocation(pointer, flags=0) set = Bitmap::new err = Hwloc.hwloc_get_area_memlocation(@ptr, pointer, pointer.size, set, flags) raise MembindError if err == -1 return set end |
#get_cpubind(flags = 0) ⇒ Object
69 70 71 72 73 74 |
# File 'lib/hwloc/Bind.rb', line 69 def get_cpubind(flags = 0) cpuset = Cpuset::new err = Hwloc.hwloc_get_cpubind(@ptr, cpuset, flags) raise CpubindError if err == -1 return cpuset end |
#get_depth ⇒ Object Also known as: depth
351 352 353 |
# File 'lib/hwloc/Topology.rb', line 351 def get_depth Hwloc.hwloc_topology_get_depth(@ptr) end |
#get_depth_type(depth) ⇒ Object
361 362 363 364 365 |
# File 'lib/hwloc/Topology.rb', line 361 def get_depth_type(depth) type = Hwloc.hwloc_get_depth_type(@ptr, depth) raise TopologyError, "Invalid argument" if type == -1 return type end |
#get_flags ⇒ Object Also known as: flags
284 285 286 |
# File 'lib/hwloc/Topology.rb', line 284 def get_flags Hwloc.hwloc_topology_get_flags(@ptr) end |
#get_last_cpu_location(flags = 0) ⇒ Object
102 103 104 105 106 107 |
# File 'lib/hwloc/Bind.rb', line 102 def get_last_cpu_location(flags = 0) cpuset = Cpuset::new err = Hwloc.hwloc_get_last_cpu_location(@ptr, cpuset, flags) raise CpubindError if err == -1 return cpuset end |
#get_membind(flags = 0) ⇒ Object
229 230 231 232 233 234 235 236 |
# File 'lib/hwloc/Bind.rb', line 229 def get_membind(flags=0) set = Bitmap::new policy_p = FFI::MemoryPointer::new(MembindPolicy.native_type) err = Hwloc.hwloc_get_membind(@ptr, set, policy_p, flags) raise MembindError if err == -1 policy = policy_p.read_int return [set, MembindPolicy[policy]] end |
#get_membind_nodeset(flags = 0) ⇒ Object
157 158 159 160 161 162 163 164 |
# File 'lib/hwloc/Bind.rb', line 157 def get_membind_nodeset(flags=0) nodeset = Nodeset::new policy_p = FFI::MemoryPointer::new(MembindPolicy.native_type) err = Hwloc.hwloc_get_membind_nodeset(@ptr, nodeset, policy_p, flags) raise MembindError if err == -1 policy = policy_p.read_int return [nodeset, MembindPolicy[policy]] end |
#get_nbobjs_by_depth(depth) ⇒ Object
389 390 391 |
# File 'lib/hwloc/Topology.rb', line 389 def get_nbobjs_by_depth(depth) return Hwloc.hwloc_get_nbobjs_by_depth(@ptr, depth) end |
#get_nbobjs_by_type(type) ⇒ Object
393 394 395 396 397 398 |
# File 'lib/hwloc/Topology.rb', line 393 def get_nbobjs_by_type(type) depth = get_type_depth(type) return 0 if depth == Hwloc::TYPE_DEPTH_UNKNOWN return each_obj.select{ |e| e.type == type }.count if depth == Hwloc::TYPE_DEPTH_MULTIPLE return Hwloc.hwloc_get_nbobjs_by_depth(@ptr, depth) end |
#get_next_obj_by_depth(depth, prev) ⇒ Object
420 421 422 423 424 |
# File 'lib/hwloc/Topology.rb', line 420 def get_next_obj_by_depth(depth, prev) return get_obj_by_depth(depth, 0) if prev.nil? return nil if prev.depth != depth return prev.next_cousin end |
#get_next_obj_by_type(type, prev) ⇒ Object
426 427 428 429 430 431 432 433 434 |
# File 'lib/hwloc/Topology.rb', line 426 def get_next_obj_by_type(type, prev) depth = get_type_depth(type) return nil if depth == Hwloc::TYPE_DEPTH_UNKNOWN if depth == Hwloc::TYPE_DEPTH_MULTIPLE then list = each_obj.select{ |e| e.type == type } return list[list.find_index { |e| e.to_ptr == e.to_ptr } + 1] end return get_next_obj_by_depth(depth, prev) end |
#get_obj_by_depth(depth, idx) ⇒ Object
400 401 402 403 404 405 |
# File 'lib/hwloc/Topology.rb', line 400 def get_obj_by_depth(depth, idx) p = Hwloc.hwloc_get_obj_by_depth(@ptr, depth, idx) return nil if p.to_ptr.null? p.instance_variable_set(:@topology, self) return p end |
#get_obj_by_type(type, idx) ⇒ Object
413 414 415 416 417 418 |
# File 'lib/hwloc/Topology.rb', line 413 def get_obj_by_type(type, idx) depth = get_type_depth(type) return nil if depth == Hwloc::TYPE_DEPTH_UNKNOWN return each_obj.select{ |e| e.type == type }[idx] if depth == Hwloc::TYPE_DEPTH_MULTIPLE return get_obj_by_depth(depth, idx) end |
#get_proc_cpubind(pid, flags) ⇒ Object
82 83 84 85 86 87 |
# File 'lib/hwloc/Bind.rb', line 82 def get_proc_cpubind(pid, flags) cpuset = Cpuset::new err = Hwloc.hwloc_get_proc_cpubind(@ptr, pid, cpuset, flags) raise CpubindError if err == -1 return cpuset end |
#get_proc_last_cpu_location(pid, flags = 0) ⇒ Object
109 110 111 112 113 114 |
# File 'lib/hwloc/Bind.rb', line 109 def get_proc_last_cpu_location(pid, flags = 0) cpuset = Cpuset::new err = Hwloc.hwloc_get_proc_last_cpu_location(@ptr, pid, cpuset, flags) raise CpubindError if err == -1 return cpuset end |
#get_proc_membind(pid, flags = 0) ⇒ Object
244 245 246 247 248 249 250 251 |
# File 'lib/hwloc/Bind.rb', line 244 def get_proc_membind(pid, flags=0) set = Bitmap::new policy_p = FFI::MemoryPointer::new(MembindPolicy.native_type) err = Hwloc.hwloc_get_proc_membind(@ptr, pid, set, policy_p, flags) raise MembindError if err == -1 policy = MembindPolicy[policy_p.read_int] return [set, policy] end |
#get_proc_membind_nodeset(pid, flags = 0) ⇒ Object
172 173 174 175 176 177 178 179 |
# File 'lib/hwloc/Bind.rb', line 172 def get_proc_membind_nodeset(pid, flags=0) nodeset = Nodeset::new policy_p = FFI::MemoryPointer::new(MembindPolicy.native_type) err = Hwloc.hwloc_get_proc_membind_nodeset(@ptr, pid, nodeset, policy_p, flags) raise MembindError if err == -1 policy = MembindPolicy[policy_p.read_int] return [nodeset, policy] end |
#get_root_obj ⇒ Object Also known as: root_obj
407 408 409 |
# File 'lib/hwloc/Topology.rb', line 407 def get_root_obj return get_obj_by_depth(0, 0) end |
#get_support ⇒ Object Also known as: support
343 344 345 346 347 |
# File 'lib/hwloc/Topology.rb', line 343 def get_support p = Hwloc.hwloc_topology_get_support(@ptr) p.instance_variable_set(:@topology, self) return p end |
#get_thread_cpubind(thread, flags = 0) ⇒ Object
95 96 97 98 99 100 |
# File 'lib/hwloc/Bind.rb', line 95 def get_thread_cpubind(thread, flags = 0) cpuset = Cpuset::new err = Hwloc.hwloc_get_thread_cpubind(@ptr, thread, cpuset, flags) raise CpubindError if err == -1 return cpuset end |
#get_type_depth(type) ⇒ Object
357 358 359 |
# File 'lib/hwloc/Topology.rb', line 357 def get_type_depth(type) Hwloc.hwloc_get_type_depth(@ptr, type) end |
#get_type_filter(type) ⇒ Object
237 238 239 240 241 242 243 |
# File 'lib/hwloc/Topology.rb', line 237 def get_type_filter(type) filter_p = FFI::MemoryPointer::new(TypeFilter.native_type) err = Hwloc.hwloc_topology_get_type_filter(@ptr, type, filter_p) raise TopologyError if err == -1 filter = filter_p.read_int return TypeFilter[filter] end |
#get_type_or_above_depth(type) ⇒ Object
378 379 380 381 382 383 384 385 386 387 |
# File 'lib/hwloc/Topology.rb', line 378 def get_type_or_above_depth(type) depth = get_type_depth(type) return depth if depth != Hwloc::TYPE_DEPTH_UNKNOWN depth = 0 while depth <= get_type_depth(Hwloc::OBJ_PU) do return depth - 1 if Hwloc.compare_types(get_depth_type(depth), type) > 0 depth += 1 end raise TopologyError end |
#get_type_or_below_depth(type) ⇒ Object
367 368 369 370 371 372 373 374 375 376 |
# File 'lib/hwloc/Topology.rb', line 367 def get_type_or_below_depth(type) depth = get_type_depth(type) return depth if depth != Hwloc::TYPE_DEPTH_UNKNOWN depth = get_type_depth(Hwloc::OBJ_PU) while depth >= 0 do return depth + 1 if Hwloc.compare_types(get_depth_type(depth), type) < 0 depth -= 1 end raise TopologyError end |
#ignore_type(type) ⇒ Object
205 206 207 208 209 |
# File 'lib/hwloc/Topology.rb', line 205 def ignore_type(type) err = Hwloc.hwloc_topology_ignore_type(@ptr, type) raise TopologyError if err == -1 return self end |
#ignore_type_keep_structure(type) ⇒ Object
211 212 213 214 215 216 217 218 219 220 |
# File 'lib/hwloc/Topology.rb', line 211 def ignore_type_keep_structure(type) if type == :all then err = Hwloc.hwloc_topology_ignore_all_keep_structure(@ptr) raise TopologyError if err == -1 else err = Hwloc.hwloc_topology_ignore_type_keep_structure(@ptr, type) raise TopologyError if err == -1 end return self end |
#insert_misc_object_by_cpuset(cpuset, name) ⇒ Object
37 38 39 40 41 42 |
# File 'lib/hwloc/Edition.rb', line 37 def insert_misc_object_by_cpuset(cpuset, name) obj = Hwloc.hwloc_topology_insert_misc_object_by_cpuset(@ptr, cpuset, name) raise EditionError if obj.to_ptr.null? obj.instance_variable_set(:@topology, self) return obj end |
#insert_misc_object_by_parent(parent, name) ⇒ Object Also known as: insert_misc_object
44 45 46 47 48 49 |
# File 'lib/hwloc/Edition.rb', line 44 def insert_misc_object_by_parent(parent, name) obj = Hwloc.hwloc_topology_insert_misc_object_by_parent(@ptr, parent, name) raise EditionError if obj.to_ptr.null? obj.instance_variable_set(:@topology, self) return obj end |
#inspect ⇒ Object
164 165 166 |
# File 'lib/hwloc/Topology.rb', line 164 def inspect return "#<#{self.class}:#{"0x00%x" % (object_id << 1)}>" end |
#is_thissystem ⇒ Object Also known as: thissystem?
Will need some work to define properly…
def set_distance_matrix(type, nbobjs, os_index, distances)
err = Hwloc.hwloc_topology_set_distance_matrix(@ptr, type, nbobjs, os_index, distances)
raise TopologyError if err == -1
return self
end
337 338 339 |
# File 'lib/hwloc/Topology.rb', line 337 def is_thissystem return Hwloc.hwloc_topology_is_thissystem(@ptr) == 1 end |
#load ⇒ Object
189 190 191 192 193 |
# File 'lib/hwloc/Topology.rb', line 189 def load err = Hwloc.hwloc_topology_load(@ptr) raise TopologyError if err == -1 return self end |
#restrict(cpuset, flags) ⇒ Object
75 76 77 78 79 |
# File 'lib/hwloc/Edition.rb', line 75 def restrict(cpuset, flags) err = Hwloc.hwloc_topology_restrict(@ptr, cpuset, flags) raise EditionError if err == -1 return self end |
#set_all_types_filter(filter) ⇒ Object
233 234 235 |
# File 'lib/hwloc/Topology.rb', line 233 def set_all_types_filter(filter) return set_type_filter(:all, filter) end |
#set_area_membind(pointer, set, policy, flags = 0) ⇒ Object
253 254 255 256 257 |
# File 'lib/hwloc/Bind.rb', line 253 def set_area_membind(pointer, set, policy, flags=0) err = Hwloc.hwloc_set_area_membind(@ptr, pointer, pointer.size, set, policy, flags) raise MembindError if err == -1 return self end |
#set_area_membind_nodeset(pointer, nodeset, policy, flags = 0) ⇒ Object
181 182 183 184 185 |
# File 'lib/hwloc/Bind.rb', line 181 def set_area_membind_nodeset(pointer, nodeset, policy, flags=0) err = Hwloc.hwloc_set_area_membind_nodeset(@ptr, pointer, pointer.size, nodeset, policy, flags) raise MembindError if err == -1 return self end |
#set_cache_types_filter(filter) ⇒ Object
245 246 247 248 249 250 |
# File 'lib/hwloc/Topology.rb', line 245 def set_cache_types_filter(filter) (Hwloc::OBJ_L1CACHE..Hwloc::OBJ_L3ICACHE).each { |cl| set_type_filter(cl, filter) } return self end |
#set_cpubind(cpuset, flags = 0) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/hwloc/Bind.rb', line 56 def set_cpubind(cpuset, flags = 0) if block_given? then oldcpuset = get_cpubind(flags) set_cpubind(cpuset, flags) yield set_cpubind(oldcpuset, flags) else err = Hwloc.hwloc_set_cpubind(@ptr, cpuset, flags) raise CpubindError if err == -1 return self end end |
#set_custom ⇒ Object
323 324 325 326 327 |
# File 'lib/hwloc/Topology.rb', line 323 def set_custom err = Hwloc.hwloc_topology_set_custom(@ptr) raise TopologyError if err == -1 return self end |
#set_flags(flags) ⇒ Object Also known as: flags=
276 277 278 279 280 |
# File 'lib/hwloc/Topology.rb', line 276 def set_flags(flags) err = Hwloc.hwloc_topology_set_flags(@ptr, flags) raise TopologyError if err == -1 return self end |
#set_fsroot(fsroot_path) ⇒ Object
297 298 299 300 301 |
# File 'lib/hwloc/Topology.rb', line 297 def set_fsroot(fsroot_path) err = Hwloc.hwloc_topology_set_fsroot(@ptr, fsroot_path) raise TopologyError if err == -1 return self end |
#set_icache_types_filter(filter) ⇒ Object
252 253 254 255 256 257 |
# File 'lib/hwloc/Topology.rb', line 252 def set_icache_types_filter(filter) (Hwloc::OBJ_L1ICACHE..Hwloc::OBJ_L3ICACHE).each { |cl| set_type_filter(cl, filter) } return self end |
#set_io_types_filter(filter) ⇒ Object
259 260 261 262 263 264 265 |
# File 'lib/hwloc/Topology.rb', line 259 def set_io_types_filter(filter) set_type_filter(Hwloc::OBJ_MISC, filter) set_type_filter(Hwloc::OBJ_BRIDGE, filter) set_type_filter(Hwloc::OBJ_PCI_DEVICE, filter) set_type_filter(Hwloc::OBJ_OS_DEVICE, filter) return self end |
#set_membind(set, policy, flags = 0) ⇒ Object
216 217 218 219 220 221 222 223 224 225 226 227 |
# File 'lib/hwloc/Bind.rb', line 216 def set_membind(set, policy, flags=0) if block_given? then oldset, oldpolicy = get_membind(flags) set_membind(set, policy, flags) yield set_membind(oldset, oldpolicy, flags) else err = Hwloc.hwloc_set_membind(@ptr, set, policy, flags) raise MembindError if err == -1 return self end end |
#set_membind_nodeset(nodeset, policy, flags = 0) ⇒ Object
151 152 153 154 155 |
# File 'lib/hwloc/Bind.rb', line 151 def set_membind_nodeset(nodeset, policy, flags=0) err = Hwloc.hwloc_set_membind_nodeset(@ptr, nodeset, policy, flags) raise MembindError if err == -1 return self end |
#set_pid(pid) ⇒ Object
290 291 292 293 294 |
# File 'lib/hwloc/Topology.rb', line 290 def set_pid(pid) err = Hwloc.hwloc_topology_set_pid(@ptr, pid) raise TopologyError if err == -1 return self end |
#set_proc_cpubind(pid, cpuset, flags = 0) ⇒ Object
76 77 78 79 80 |
# File 'lib/hwloc/Bind.rb', line 76 def set_proc_cpubind(pid, cpuset, flags = 0) err = Hwloc.hwloc_set_proc_cpubind(@ptr, pid, cpuset, flags) raise CpubindError if err == -1 return self end |
#set_proc_membind(pid, set, policy, flags = 0) ⇒ Object
238 239 240 241 242 |
# File 'lib/hwloc/Bind.rb', line 238 def set_proc_membind(pid, set, policy, flags=0) err = Hwloc.hwloc_set_proc_membind(@ptr, pid, set, policy, flags) raise MembindError if err == -1 return self end |
#set_proc_membind_nodeset(pid, nodeset, policy, flags = 0) ⇒ Object
166 167 168 169 170 |
# File 'lib/hwloc/Bind.rb', line 166 def set_proc_membind_nodeset(pid, nodeset, policy, flags=0) err = Hwloc.hwloc_set_proc_membind_nodeset(@ptr, pid, nodeset, policy, flags) raise MembindError if err == -1 return self end |
#set_synthetic(description) ⇒ Object
304 305 306 307 308 |
# File 'lib/hwloc/Topology.rb', line 304 def set_synthetic(description) err = Hwloc.hwloc_topology_set_synthetic(@ptr, description) raise TopologyError if err == -1 return self end |
#set_thread_cpubind(thread, cpuset, flags = 0) ⇒ Object
89 90 91 92 93 |
# File 'lib/hwloc/Bind.rb', line 89 def set_thread_cpubind(thread, cpuset, flags = 0) err = Hwloc.hwloc_set_thread_cpubind(@ptr, thread, cpuset, flags) raise CpubindError if err == -1 return self end |
#set_type_filter(type, filter) ⇒ Object
222 223 224 225 226 227 228 229 230 231 |
# File 'lib/hwloc/Topology.rb', line 222 def set_type_filter(type, filter) if type == :all then err = Hwloc.hwloc_topology_set_all_types_filter(@ptr, filter) raise TopologyError if err == -1 else err = Hwloc.hwloc_topology_set_type_filter(@ptr, type, filter) raise TopologyError if err == -1 end return self end |
#set_xml(xmlpath) ⇒ Object
310 311 312 313 314 |
# File 'lib/hwloc/Topology.rb', line 310 def set_xml(xmlpath) err = Hwloc.hwloc_topology_set_xml(@ptr, xmlpath) raise TopologyError if err == -1 return self end |
#set_xmlbuffer(pointer) ⇒ Object
316 317 318 319 320 |
# File 'lib/hwloc/Topology.rb', line 316 def set_xmlbuffer(pointer) err = Hwloc.hwloc_topology_set_xmlbuffer(@ptr, pointer, pointer.size) raise TopologyError if err == -1 return self end |
#to_s ⇒ Object
82 83 84 85 86 87 88 |
# File 'lib/hwloc/Export.rb', line 82 def to_s begin return export_synthetic rescue ExportError return super end end |