|
Hardware Locality (hwloc)
PR-737-20250925.0822.gite8f69c77f
|
9 #ifndef HWLOC_PLUGINS_H
10 #define HWLOC_PLUGINS_H
20 #ifdef HWLOC_INSIDE_PLUGIN
22 #ifdef HWLOC_HAVE_LTDL
24 #elif !defined(HWLOC_WIN_SYS)
183 struct hwloc_topology * topology;
225 #define HWLOC_BACKEND_PRIVATE_DATA(_backend) (void*)(((char*)(_backend)) + sizeof(struct hwloc_backend))
331 static __hwloc_inline
int
334 #ifdef HWLOC_INSIDE_PLUGIN
336 #ifdef HWLOC_HAVE_LTDL
337 lt_dlhandle handle = lt_dlopen(NULL);
338 #elif defined(HWLOC_WIN_SYS)
339 HMODULE handle = GetModuleHandleA(NULL);
341 void *handle = dlopen(NULL, RTLD_NOW|RTLD_LOCAL);
346 #ifdef HWLOC_HAVE_LTDL
347 sym = lt_dlsym(handle, symbol);
349 #elif defined(HWLOC_WIN_SYS)
350 sym = GetModuleHandleA(
"hwloc.dll");
353 sym = dlsym(handle, symbol);
357 static int verboseenv_checked = 0;
358 static int verboseenv_value = 0;
359 if (!verboseenv_checked) {
360 const char *verboseenv = getenv(
"HWLOC_PLUGINS_VERBOSE");
361 verboseenv_value = verboseenv ? atoi(verboseenv) : 0;
362 verboseenv_checked = 1;
364 if (verboseenv_value)
365 fprintf(stderr,
"Plugin `%s' disabling itself because it cannot find the `%s' core symbol.\n",
404 #define HWLOC_SHOW_CRITICAL_ERRORS() (hwloc_hide_errors() < 2)
405 #define HWLOC_SHOW_ALL_ERRORS() (hwloc_hide_errors() == 0)
498 static __hwloc_inline
int
501 unsigned baseclass = classid >> 8;
502 return (baseclass == 0x03
511 || baseclass == 0x12 );
518 static __hwloc_inline
int
530 static __hwloc_inline
int
543 static __hwloc_inline
int
598 unsigned *secondary_busp,
unsigned *subordinate_busp,
599 const unsigned char *config);
671 const char *
name,
unsigned long kind,
672 unsigned long flags);
689 hwloc_uint64_t *values,
690 unsigned long flags);
701 unsigned long flags);
void * hwloc_backend_distances_add_handle_t
Handle to a new distances structure during its addition to the topology.
Definition: plugins.h:661
Discovery backend structure.
Definition: plugins.h:179
hwloc_backend_distances_add_handle_t hwloc_backend_distances_add_create(hwloc_topology_t topology, const char *name, unsigned long kind, unsigned long flags)
Create a new empty distances structure.
unsigned long flags
Backend flags, currently always 0.
Definition: plugins.h:195
struct hwloc_obj * hwloc_pci_find_parent_by_busid(struct hwloc_topology *topology, unsigned domain, unsigned bus, unsigned dev, unsigned func)
Find the object or a parent of a PCI bus ID.
hwloc_obj_t hwloc__insert_object_by_cpuset(struct hwloc_topology *topology, hwloc_obj_t root, hwloc_obj_t obj, const char *reason)
Add an object to the topology.
hwloc_obj_t hwloc_alloc_setup_object(hwloc_topology_t topology, hwloc_obj_type_t type, unsigned os_index)
Allocate and initialize an object of the given type and physical index.
int hwloc_backend_distances_add_commit(hwloc_topology_t topology, hwloc_backend_distances_add_handle_t handle, unsigned long flags)
Commit a new distances structure.
unsigned long flags
OR'ed set of hwloc_disc_status_flag_e.
Definition: plugins.h:158
struct hwloc_backend * hwloc_backend_alloc(struct hwloc_topology *topology, struct hwloc_disc_component *component, unsigned long private_data_size)
Allocate a backend structure, set good default values, initialize backend->component and topology,...
@ HWLOC_DISC_PHASE_ANNOTATE
Annotating existing objects, adding distances, etc.
Definition: plugins.h:125
unsigned short class_id
The class number (first two bytes, without the prog_if).
Definition: hwloc.h:730
int hwloc_backend_distances_add_values(hwloc_topology_t topology, hwloc_backend_distances_add_handle_t handle, unsigned nbobjs, hwloc_obj_t *objs, hwloc_uint64_t *values, unsigned long flags)
Specify the objects and values in a new empty distances structure.
int(* init)(unsigned long flags)
Process-wide component initialization callback.
Definition: plugins.h:285
Structure of a topology object.
Definition: hwloc.h:488
Discovery status structure.
Definition: plugins.h:146
hwloc_disc_phase_t phase
The current discovery phase that is performed. Must match one of the phases in the component phases f...
Definition: plugins.h:150
struct hwloc_topology * hwloc_topology_t
Topology context.
Definition: hwloc.h:778
unsigned phases
Discovery phases performed by this component, possibly without some of them if excluded by other comp...
Definition: plugins.h:192
hwloc_disc_status_flag_e
Discovery status flags.
Definition: plugins.h:136
@ HWLOC_DISC_PHASE_MISC
Misc objects that gets added below anything else.
Definition: plugins.h:121
hwloc_component_type_t type
Component type.
Definition: plugins.h:301
@ HWLOC_DISC_PHASE_PCI
Attach PCI devices and bridges to existing CPU objects.
Definition: plugins.h:113
unsigned excluded_phases
Dynamically excluded phases. If a component decides during discovery that some phases are no longer n...
Definition: plugins.h:155
int hwloc_topology_get_type_filter(hwloc_topology_t topology, hwloc_obj_type_t type, enum hwloc_type_filter_e *filter)
Get the current filtering for the given object type.
unsigned excluded_phases
Component phases to exclude, as an OR'ed set of hwloc_disc_phase_t.
Definition: plugins.h:62
@ HWLOC_DISC_STATUS_FLAG_GOT_ALLOWED_RESOURCES
The sets of allowed resources were already retrieved.
Definition: plugins.h:138
unsigned long flags
Component flags, unused for now.
Definition: plugins.h:304
unsigned enabled_by_default
Enabled by default. If unset, if will be disabled unless explicitly requested.
Definition: plugins.h:86
hwloc_obj_type_t
Type of topology object.
Definition: hwloc.h:198
void hwloc_pcidisc_tree_insert_by_busid(struct hwloc_obj **treep, struct hwloc_obj *obj)
Insert a PCI object in the given PCI tree by looking at PCI bus IDs.
@ HWLOC_DISC_PHASE_IO
I/O discovery that requires PCI devices (OS devices such as OpenCL, CUDA, etc.).
Definition: plugins.h:117
struct hwloc_obj_attr_u::hwloc_osdev_attr_s osdev
unsigned hwloc_pcidisc_find_cap(const unsigned char *config, unsigned cap)
Return the offset of the given capability in the PCI config space buffer.
unsigned priority
Component priority. Used to sort topology->components, higher priority first. Also used to decide bet...
Definition: plugins.h:81
unsigned abi
Component ABI version, set to HWLOC_COMPONENT_ABI.
Definition: plugins.h:266
union hwloc_obj_attr_u * attr
Object type-specific Attributes, may be NULL if no attribute value was found.
Definition: hwloc.h:507
hwloc_component_type_e
Generic component type.
Definition: plugins.h:251
enum hwloc_disc_phase_e hwloc_disc_phase_t
Discovery phase.
int hwloc_filter_check_keep_object(hwloc_topology_t topology, hwloc_obj_t obj)
Check whether the given object should be filtered-out.
Definition: plugins.h:544
@ HWLOC_DISC_PHASE_TWEAK
Final tweaks to a ready-to-use topology. This phase runs once the topology is loaded,...
Definition: plugins.h:132
@ HWLOC_DISC_PHASE_MEMORY
Attach memory to existing CPU objects.
Definition: plugins.h:109
const char * name
Name. If this component is built as a plugin, this name does not have to match the plugin filename.
Definition: plugins.h:47
int hwloc_obj_add_children_sets(hwloc_obj_t obj)
Setup object cpusets/nodesets by OR'ing its children.
struct hwloc_obj * hwloc_pci_find_by_busid(struct hwloc_topology *topology, unsigned domain, unsigned bus, unsigned dev, unsigned func)
Find the PCI device or bridge matching a PCI bus ID exactly.
void(* disable)(struct hwloc_backend *backend)
Callback for freeing things stored inside the private data. May be NULL.
Definition: plugins.h:208
@ HWLOC_DISC_PHASE_GLOBAL
xml or synthetic, platform-specific components. Discovers everything including CPU,...
Definition: plugins.h:101
int(* get_pci_busid_cpuset)(struct hwloc_backend *backend, struct hwloc_pcidev_attr_s *busid, hwloc_bitmap_t cpuset)
Callback to retrieve the locality of a PCI object. Called by the PCI core when attaching PCI hierarch...
Definition: plugins.h:221
@ HWLOC_COMPONENT_TYPE_DISC
The data field must point to a struct hwloc_disc_component.
Definition: plugins.h:253
struct hwloc_bitmap_s * hwloc_bitmap_t
Set of bits represented as an opaque pointer to an internal bitmap.
Definition: bitmap.h:70
int hwloc_pcidisc_find_linkspeed(const unsigned char *config, unsigned offset, float *linkspeed)
Fill linkspeed by reading the PCI config space where PCI_CAP_ID_EXP is at position offset.
hwloc_obj_osdev_types_t types
OR'ed set of at least one hwloc_obj_osdev_type_e.
Definition: hwloc.h:761
@ HWLOC_COMPONENT_TYPE_XML
The data field must point to a struct hwloc_xml_component.
Definition: plugins.h:256
@ HWLOC_DISC_PHASE_CPU
CPU discovery.
Definition: plugins.h:105
char * name
Object-specific name if any. Mostly used for identifying OS devices and Misc objects where a name str...
Definition: hwloc.h:500
@ HWLOC_OBJ_OS_DEVICE
Operating system device (filtered out by default).
Definition: hwloc.h:330
unsigned phases
Discovery phases performed by this component. OR'ed set of hwloc_disc_phase_t.
Definition: plugins.h:52
void * data
Component data, pointing to a struct hwloc_disc_component or struct hwloc_xml_component.
Definition: plugins.h:307
void hwloc_insert_object_by_parent(struct hwloc_topology *topology, hwloc_obj_t parent, hwloc_obj_t obj)
Insert an object somewhere in the topology.
enum hwloc_component_type_e hwloc_component_type_t
Generic component type.
@ HWLOC_OBJ_OSDEV_DMA
Operating system dma engine device. For instance the "dma0chan0" DMA channel on Linux.
Definition: hwloc.h:415
int hwloc_hide_errors(void)
Check whether error messages are hidden.
@ HWLOC_TYPE_FILTER_KEEP_IMPORTANT
Only keep likely-important objects of the given type.
Definition: hwloc.h:2640
int hwloc_backend_enable(struct hwloc_backend *backend)
Enable a previously allocated and setup backend.
void(* finalize)(unsigned long flags)
Process-wide component termination callback.
Definition: plugins.h:298
@ HWLOC_OBJ_PCI_DEVICE
PCI device (filtered out by default).
Definition: hwloc.h:320
hwloc_obj_type_t hwloc_pcidisc_check_bridge_type(unsigned device_class, const unsigned char *config)
Return the hwloc object type (PCI device or Bridge) for the given class and configuration space.
unsigned long hwloc_obj_osdev_types_t
Type(s) of a OS device. OR'ed set of hwloc_obj_osdev_type_e.
Definition: hwloc.h:424
Generic component structure.
Definition: plugins.h:264
int hwloc_filter_check_keep_object_type(hwloc_topology_t topology, hwloc_obj_type_t type)
Check whether a non-I/O object type should be filtered-out.
Definition: plugins.h:531
Discovery component structure.
Definition: plugins.h:43
int hwloc_filter_check_pcidev_subtype_important(unsigned classid)
Check whether the given PCI device classid is important.
Definition: plugins.h:499
int hwloc_plugin_check_namespace(const char *pluginname, const char *symbol)
Make sure that plugins can lookup core symbols.
Definition: plugins.h:332
struct hwloc_obj_attr_u::hwloc_pcidev_attr_s pcidev
int hwloc_pcidisc_tree_attach(struct hwloc_topology *topology, struct hwloc_obj *tree)
Add some hostbridges on top of the given tree of PCI objects and attach them to the topology.
hwloc_disc_phase_e
Discovery phase.
Definition: plugins.h:96
hwloc_obj_type_t type
Type of object.
Definition: hwloc.h:490
hwloc_type_filter_e
Type filtering flags.
Definition: hwloc.h:2597
int is_thissystem
Backend-specific 'is_thissystem' property. Set to 0 if the backend disables the thissystem flag for t...
Definition: plugins.h:203
@ HWLOC_TYPE_FILTER_KEEP_NONE
Ignore all objects of this type.
Definition: hwloc.h:2611
int hwloc_filter_check_osdev_subtype_important(hwloc_obj_osdev_types_t subtype)
Check whether the given OS device subtype is important.
Definition: plugins.h:519
int(* discover)(struct hwloc_backend *backend, struct hwloc_disc_status *status)
Main discovery callback. returns -1 on error, either because it couldn't add its objects ot the exist...
Definition: plugins.h:215
int hwloc_pcidisc_find_bridge_buses(unsigned domain, unsigned bus, unsigned dev, unsigned func, unsigned *secondary_busp, unsigned *subordinate_busp, const unsigned char *config)
Fills the attributes of the given PCI bridge using the given PCI config space.
int hwloc_topology_reconnect(hwloc_topology_t topology, unsigned long flags)
Request a reconnection of children and levels in the topology.