class Hwloc::Topology
Constants
- Flags
Attributes
ptr[R]
Public Class Methods
const_missing( sym )
click to toggle source
Calls superclass method
# File lib/hwloc/Topology.rb, line 155 def self.const_missing( sym ) begin value = Hwloc.const_get( "TOPOLOGY_#{sym}".to_sym ) return value rescue end super end
new( *args )
click to toggle source
# File lib/hwloc/Topology.rb, line 172 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) ) elsif arg.kind_of?( String ) 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) ) @xml_buffer = FFI::MemoryPointer::from_string(arg) set_xmlbuffer(@xml_buffer) else raise TopologyError, "Invalid argument" end else raise TopologyError, "Invalid argument" end end
Public Instance Methods
alloc(size)
click to toggle source
# File lib/hwloc/Bind.rb, line 322 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)
click to toggle source
# File lib/hwloc/Bind.rb, line 329 def alloc_membind(size, set, policy, *flags) 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)
click to toggle source
# File lib/hwloc/Bind.rb, line 196 def alloc_membind_nodeset(size, nodeset, policy, *flags) 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)
click to toggle source
# File lib/hwloc/Bind.rb, line 336 def alloc_membind_policy(size, set, policy, *flags) 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)
click to toggle source
# File lib/hwloc/Bind.rb, line 203 def alloc_membind_policy_nodeset(size, nodeset, policy, *flags) 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()
click to toggle source
# File lib/hwloc/Topology.rb, line 211 def check Hwloc.hwloc_topology_check(@ptr) return self end
custom_insert_group_object_by_parent(parent, groupdepth)
click to toggle source
# 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)
click to toggle source
# 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
distances(*kind)
click to toggle source
# File lib/hwloc/Topology.rb, line 512 def distances(*kind) num_d = distances_number(*kind) return [] if num_d == 0 nr = FFI::MemoryPointer::new(:uint) nr.write_uint num_d dis = FFI::MemoryPointer::new(:pointer, num_d) err = Hwloc.hwloc_distances_get(@ptr, nr, dis, kind, 0); raise TopologyError if err == -1 return dis.read_array_of_pointer(nr.read_uint).collect { |p| d = Distances::new(p) d.instance_variable_set(:@topology, self) d } end
distances_add(objs, values, *kind, flags: [])
click to toggle source
# File lib/hwloc/Topology.rb, line 555 def distances_add(objs, values, *kind, flags: []) nbobjs = objs.size vals = values.flatten raise TopologyError if vals.length != nbobjs * nbobjs vals_p = FFI::MemoryPointer::new(:uint64, vals.length) vals_p.write_array_of_uint64(vals) objs_p = FFI::MemoryPointer::new(:pointer, objs.length) objs_p.write_array_of_pointer(objs.collect(&:to_ptr)) err = Hwloc.hwloc_distances_add(@ptr, nbobjs, objs_p, vals_p, kind, flags) raise TopologyError if err == -1 self end
distances_by_depth(depth, *kind)
click to toggle source
# File lib/hwloc/Topology.rb, line 527 def distances_by_depth(depth, *kind) nr = FFI::MemoryPointer::new(:uint) nr.write_uint 0 err = Hwloc.hwloc_distances_get_by_depth(@ptr, depth, nr, nil, kind, 0); raise TopologyError if err == -1 num_d = nr.read_uint return [] if num_d == 0 dis = FFI::MemoryPointer::new(:pointer, num_d) err = Hwloc.hwloc_distances_get_by_depth(@ptr, depth, nr, dis, kind, 0); return dis.read_array_of_pointer(nr.read_uint).collect { |p| d = Distances::new(p) d.instance_variable_set(:@topology, self) d } end
distances_by_type(type, *kind)
click to toggle source
# File lib/hwloc/Topology.rb, line 543 def distances_by_type(type, *kind) depth = get_type_depth(type) return [] if depth == Hwloc::TYPE_DEPTH_UNKNOWN if depth == Hwloc::TYPE_DEPTH_MULTIPLE then depth_list = each_obj.select{ |e| e.type == type }.collect{ |e| e.depth }.uniq res = depth_list.collect { |d| distances_by_depth(d, *kind) }.reduce(:+) return [] unless res return res end return distances_by_depth(depth, *kind) end
distances_number(*kind)
click to toggle source
# File lib/hwloc/Topology.rb, line 502 def distances_number(*kind) res = nil nr = FFI::MemoryPointer::new(:uint) nr.write_uint 0 err = Hwloc.hwloc_distances_get(@ptr, nr, nil, kind, 0); raise TopologyError if err == -1 res = nr.read_uint res end
distances_remove()
click to toggle source
# File lib/hwloc/Topology.rb, line 568 def distances_remove err = Hwloc.hwloc_distances_remove(@ptr) raise TopologyError if err == -1 self end
distances_remove_by_depth(depth)
click to toggle source
# File lib/hwloc/Topology.rb, line 574 def distances_remove_by_depth(depth) err = Hwloc.hwloc_distances_remove_by_depth(@ptr, depth) raise TopologyError if err == -1 self end
distances_remove_by_type(type)
click to toggle source
# File lib/hwloc/Topology.rb, line 580 def distances_remove_by_type(type) depth = get_type_depth(type) return self if depth == Hwloc::TYPE_DEPTH_UNKNOWN if depth == Hwloc::TYPE_DEPTH_MULTIPLE then depth_list = each_obj.select{ |e| e.type == type }.collect{ |e| e.depth }.uniq depth_list.each { |d| distances_remove_by_depth(d) } return self end return distances_remove_by_depth(depth) end
dup()
click to toggle source
# File lib/hwloc/Topology.rb, line 207 def dup return Topology::new( self ) end
each_by_depth(depth) { |o| ... }
click to toggle source
# File lib/hwloc/Topology.rb, line 448 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 to_enum(:each_by_depth, depth) end end
each_by_type(type, &block)
click to toggle source
# File lib/hwloc/Topology.rb, line 461 def each_by_type(type, &block) if block_given? then depth = get_type_depth(type) if depth == Hwloc::TYPE_DEPTH_MULTIPLE each_obj.select{ |e| e.type == type }.each(&block) return self else return each_by_depth(depth, &block) end else to_enum(:each_by_type, type) end end
each_obj(&block)
click to toggle source
# File lib/hwloc/Topology.rb, line 487 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)
click to toggle source
# File lib/hwloc/Export.rb, line 86 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)
click to toggle source
# File lib/hwloc/Export.rb, line 40 def export_xml(xmlpath) err = Hwloc.hwloc_topology_export_xml(@ptr, xmlpath) raise ExportError if err == -1 return self end
export_xmlbuffer()
click to toggle source
# File lib/hwloc/Export.rb, line 46 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)
click to toggle source
# File lib/hwloc/Bind.rb, line 304 def get_area_membind(pointer, *flags) 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)
click to toggle source
# File lib/hwloc/Bind.rb, line 187 def get_area_membind_nodeset(pointer, *flags) 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)
click to toggle source
# File lib/hwloc/Bind.rb, line 314 def get_area_memlocation(pointer, *flags) 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)
click to toggle source
# File lib/hwloc/Bind.rb, line 69 def get_cpubind(*flags) cpuset = Cpuset::new err = Hwloc.hwloc_get_cpubind(@ptr, cpuset, flags) raise CpubindError if err == -1 return cpuset end
get_depth()
click to toggle source
# File lib/hwloc/Topology.rb, line 363 def get_depth Hwloc.hwloc_topology_get_depth(@ptr) end
Also aliased as: depth
get_depth_type(depth)
click to toggle source
# File lib/hwloc/Topology.rb, line 373 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()
click to toggle source
# File lib/hwloc/Topology.rb, line 296 def get_flags Hwloc.hwloc_topology_get_flags(@ptr) end
Also aliased as: flags
get_last_cpu_location(*flags)
click to toggle source
# File lib/hwloc/Bind.rb, line 102 def get_last_cpu_location(*flags) cpuset = Cpuset::new err = Hwloc.hwloc_get_last_cpu_location(@ptr, cpuset, flags) raise CpubindError if err == -1 return cpuset end
get_membind(*flags)
click to toggle source
# File lib/hwloc/Bind.rb, line 274 def get_membind(*flags) 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)
click to toggle source
# File lib/hwloc/Bind.rb, line 157 def get_membind_nodeset(*flags) 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)
click to toggle source
# File lib/hwloc/Topology.rb, line 401 def get_nbobjs_by_depth(depth) return Hwloc.hwloc_get_nbobjs_by_depth(@ptr, depth) end
get_nbobjs_by_type(type)
click to toggle source
# File lib/hwloc/Topology.rb, line 405 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)
click to toggle source
# File lib/hwloc/Topology.rb, line 432 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)
click to toggle source
# File lib/hwloc/Topology.rb, line 438 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)
click to toggle source
# File lib/hwloc/Topology.rb, line 412 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)
click to toggle source
# File lib/hwloc/Topology.rb, line 425 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)
click to toggle source
# 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)
click to toggle source
# File lib/hwloc/Bind.rb, line 109 def get_proc_last_cpu_location(pid, *flags) 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)
click to toggle source
# File lib/hwloc/Bind.rb, line 289 def get_proc_membind(pid, *flags) 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)
click to toggle source
# File lib/hwloc/Bind.rb, line 172 def get_proc_membind_nodeset(pid, *flags) 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()
click to toggle source
# File lib/hwloc/Topology.rb, line 419 def get_root_obj return get_obj_by_depth(0, 0) end
Also aliased as: root_obj
get_support()
click to toggle source
# File lib/hwloc/Topology.rb, line 355 def get_support p = Hwloc.hwloc_topology_get_support(@ptr) p.instance_variable_set(:@topology, self) return p end
Also aliased as: support
get_thread_cpubind(thread, *flags)
click to toggle source
# File lib/hwloc/Bind.rb, line 95 def get_thread_cpubind(thread, *flags) 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)
click to toggle source
# File lib/hwloc/Topology.rb, line 369 def get_type_depth(type) Hwloc.hwloc_get_type_depth(@ptr, type) end
get_type_filter(type)
click to toggle source
# File lib/hwloc/Topology.rb, line 249 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)
click to toggle source
# File lib/hwloc/Topology.rb, line 390 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)
click to toggle source
# File lib/hwloc/Topology.rb, line 379 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)
click to toggle source
# File lib/hwloc/Topology.rb, line 217 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)
click to toggle source
# File lib/hwloc/Topology.rb, line 223 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)
click to toggle source
# 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)
click to toggle source
# 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
Also aliased as: insert_misc_object
inspect()
click to toggle source
# File lib/hwloc/Topology.rb, line 168 def inspect return "#<#{self.class}:#{"0x00%x" % (object_id << 1)}>" end
is_thissystem()
click to toggle source
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
# File lib/hwloc/Topology.rb, line 349 def is_thissystem return Hwloc.hwloc_topology_is_thissystem(@ptr) == 1 end
Also aliased as: thissystem?
load()
click to toggle source
# File lib/hwloc/Topology.rb, line 200 def load err = Hwloc.hwloc_topology_load(@ptr) raise TopologyError if err == -1 @xml_buffer = nil if @xml_buffer return self end
restrict(cpuset, flags)
click to toggle source
# 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)
click to toggle source
# File lib/hwloc/Topology.rb, line 245 def set_all_types_filter(filter) return set_type_filter(:all, filter) end
set_area_membind(pointer, set, policy, *flags)
click to toggle source
# File lib/hwloc/Bind.rb, line 298 def set_area_membind(pointer, set, policy, *flags) 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)
click to toggle source
# File lib/hwloc/Bind.rb, line 181 def set_area_membind_nodeset(pointer, nodeset, policy, *flags) 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)
click to toggle source
# File lib/hwloc/Topology.rb, line 257 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) { || ... }
click to toggle source
# File lib/hwloc/Bind.rb, line 56 def set_cpubind(cpuset, *flags) 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()
click to toggle source
# File lib/hwloc/Topology.rb, line 335 def set_custom err = Hwloc.hwloc_topology_set_custom(@ptr) raise TopologyError if err == -1 return self end
set_flags(flags)
click to toggle source
# File lib/hwloc/Topology.rb, line 288 def set_flags(flags) err = Hwloc.hwloc_topology_set_flags(@ptr, flags) raise TopologyError if err == -1 return self end
Also aliased as: flags=
set_fsroot(fsroot_path)
click to toggle source
# File lib/hwloc/Topology.rb, line 309 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)
click to toggle source
# File lib/hwloc/Topology.rb, line 264 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)
click to toggle source
# File lib/hwloc/Topology.rb, line 271 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) { || ... }
click to toggle source
# File lib/hwloc/Bind.rb, line 261 def set_membind(set, policy, *flags) 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)
click to toggle source
# File lib/hwloc/Bind.rb, line 151 def set_membind_nodeset(nodeset, policy, *flags) err = Hwloc.hwloc_set_membind_nodeset(@ptr, nodeset, policy, flags) raise MembindError if err == -1 return self end
set_pid(pid)
click to toggle source
# File lib/hwloc/Topology.rb, line 302 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)
click to toggle source
# File lib/hwloc/Bind.rb, line 76 def set_proc_cpubind(pid, cpuset, *flags) 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)
click to toggle source
# File lib/hwloc/Bind.rb, line 283 def set_proc_membind(pid, set, policy, *flags) 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)
click to toggle source
# File lib/hwloc/Bind.rb, line 166 def set_proc_membind_nodeset(pid, nodeset, policy, *flags) err = Hwloc.hwloc_set_proc_membind_nodeset(@ptr, pid, nodeset, policy, flags) raise MembindError if err == -1 return self end
set_synthetic(description)
click to toggle source
# File lib/hwloc/Topology.rb, line 316 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)
click to toggle source
# File lib/hwloc/Bind.rb, line 89 def set_thread_cpubind(thread, cpuset, *flags) err = Hwloc.hwloc_set_thread_cpubind(@ptr, thread, cpuset, flags) raise CpubindError if err == -1 return self end
set_type_filter(type, filter)
click to toggle source
# File lib/hwloc/Topology.rb, line 234 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)
click to toggle source
# File lib/hwloc/Topology.rb, line 322 def set_xml(xmlpath) err = Hwloc.hwloc_topology_set_xml(@ptr, xmlpath) raise TopologyError if err == -1 return self end
set_xmlbuffer(pointer)
click to toggle source
# File lib/hwloc/Topology.rb, line 328 def set_xmlbuffer(pointer) err = Hwloc.hwloc_topology_set_xmlbuffer(@ptr, pointer, pointer.size) raise TopologyError if err == -1 return self end
to_s()
click to toggle source
Calls superclass method
# File lib/hwloc/Export.rb, line 93 def to_s begin return export_synthetic rescue ExportError return super end end
to_xml(flags = 0)
click to toggle source
# File lib/hwloc/Export.rb, line 71 def to_xml(flags = 0) a = if API_VERSION >= API_VERSION_2_0 export_xmlbuffer(flags) else export_xmlbuffer end a.read_string end
Private Instance Methods
free(pointer)
click to toggle source
# File lib/hwloc/Bind.rb, line 347 def free(pointer) Hwloc.hwloc_free(@ptr, pointer, pointer.size) end
free_xmlbuffer(pointer)
click to toggle source
# File lib/hwloc/Export.rb, line 80 def free_xmlbuffer(pointer) Hwloc.hwloc_free_xmlbuffer(@self, pointer) end