6 #ifndef HWLOC_PLUGINS_H
7 #define HWLOC_PLUGINS_H
16 #ifdef HWLOC_INSIDE_PLUGIN
118 struct hwloc_topology * topology;
289 struct hwloc_obj *obj = malloc(
sizeof(*obj));
290 memset(obj, 0,
sizeof(*obj));
294 obj->
attr = malloc(
sizeof(*obj->
attr));
295 memset(obj->
attr, 0,
sizeof(*obj->
attr));
322 static __hwloc_inline
int
325 #ifdef HWLOC_INSIDE_PLUGIN
328 handle = lt_dlopen(NULL);
332 sym = lt_dlsym(handle, symbol);
335 static int verboseenv_checked = 0;
336 static int verboseenv_value = 0;
337 if (!verboseenv_checked) {
338 char *verboseenv = getenv(
"HWLOC_PLUGINS_VERBOSE");
339 verboseenv_value = atoi(verboseenv);
340 verboseenv_checked = 1;
342 if (verboseenv_value)
343 fprintf(stderr,
"Plugin `%s' disabling itself because it cannot find the `%s' core symbol.\n",
374 HWLOC_DECLSPEC
unsigned hwloc_pci_find_cap(
const unsigned char *config,
unsigned cap);
Structure of a topology object.
Definition: hwloc.h:331
void(* hwloc_report_error_t)(const char *msg, int line)
Type of error callbacks during object insertion.
Definition: plugins.h:261
unsigned hwloc_pci_find_cap(const unsigned char *config, unsigned cap)
Return the offset of the given capability in the PCI config space buffer.
int is_thissystem
Backend-specific 'is_thissystem' property. Set to 0 or 1 if the backend should enforce the thissystem...
Definition: plugins.h:135
void * private_data
Backend private data, or NULL if none.
Definition: plugins.h:138
hwloc_obj_type_t
Type of topology object.
Definition: hwloc.h:152
hwloc_component_type_e
Generic component type.
Definition: plugins.h:202
struct hwloc_backend * hwloc_backend_alloc(struct hwloc_disc_component *component)
Allocate a backend structure, set good default values, initialize backend->component and topology...
struct hwloc_obj * hwloc__insert_object_by_cpuset(struct hwloc_topology *topology, hwloc_obj_t obj, hwloc_report_error_t report_error)
Add an object to the topology and specify which error callback to use.
int is_custom
Backend-specific 'is_custom' property. Shortcut on !strcmp(..->component->name, "custom"). Only the custom component should touch this.
Definition: plugins.h:130
int(* get_obj_cpuset)(struct hwloc_backend *backend, struct hwloc_backend *caller, struct hwloc_obj *obj, hwloc_bitmap_t cpuset)
Callback used by the PCI backend to retrieve the locality of a PCI object from the OS/cpu backend...
Definition: plugins.h:151
void hwloc_report_os_error(const char *msg, int line)
Report an insertion error from a backend.
The data field must point to a struct hwloc_disc_component.
Definition: plugins.h:204
hwloc_component_type_t type
Component type.
Definition: plugins.h:220
CPU-only discovery through the OS, or generic no-OS support.
Definition: plugins.h:31
struct hwloc_obj * parent
Parent, NULL if root (system object)
Definition: hwloc.h:357
enum hwloc_disc_component_type_e hwloc_disc_component_type_t
Discovery component type.
void * data
Component data, pointing to a struct hwloc_disc_component or struct hwloc_xml_component.
Definition: plugins.h:226
The data field must point to a struct hwloc_xml_component.
Definition: plugins.h:207
unsigned os_index
OS-provided physical index number.
Definition: hwloc.h:334
xml, synthetic or custom, platform-specific components such as bgq. Anything the discovers CPU and ev...
Definition: plugins.h:38
int hwloc_fill_object_sets(hwloc_obj_t obj)
Setup object cpusets/nodesets by OR'ing its children.
unsigned abi
Component ABI version, set to HWLOC_COMPONENT_ABI.
Definition: plugins.h:217
unsigned priority
Component priority. Used to sort topology->components, higher priority first. Also used to decide bet...
Definition: plugins.h:86
Generic component structure.
Definition: plugins.h:215
struct hwloc_obj * hwloc_insert_object_by_cpuset(struct hwloc_topology *topology, hwloc_obj_t obj)
Add an object to the topology.
int hwloc_pci_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...
Discovery backend structure.
Definition: plugins.h:114
OpenCL, Cuda, etc.
Definition: plugins.h:42
int(* discover)(struct hwloc_backend *backend)
Main discovery callback. returns > 0 if it modified the topology tree, -1 on error, 0 otherwise. May be NULL if type is HWLOC_DISC_COMPONENT_TYPE_MISC.
Definition: plugins.h:147
hwloc_obj_type_t type
Type of object.
Definition: hwloc.h:333
signed os_level
OS-provided physical level, -1 if unknown or meaningless.
Definition: hwloc.h:350
unsigned long flags
Component flags, unused for now.
Definition: plugins.h:223
hwloc_backend_flag_e
Backend flags.
Definition: plugins.h:160
hwloc_disc_component_type_t type
Discovery component type.
Definition: plugins.h:52
int hwloc_backends_notify_new_object(struct hwloc_backend *caller, struct hwloc_obj *obj)
Used by backends discovery callbacks to notify other backends of new objects.
Discovery component structure.
Definition: plugins.h:50
hwloc_disc_component_type_e
Discovery component type.
Definition: plugins.h:28
static int hwloc_plugin_check_namespace(const char *pluginname, const char *symbol)
Make sure that plugins can lookup core symbols.
Definition: plugins.h:323
void(* disable)(struct hwloc_backend *backend)
Callback for freeing the private_data. May be NULL.
Definition: plugins.h:142
int hwloc_backends_get_obj_cpuset(struct hwloc_backend *caller, struct hwloc_obj *obj, hwloc_bitmap_t cpuset)
Used by backends discovery callbacks to request locality information from others. ...
int hwloc_hide_errors(void)
Check whether insertion errors are hidden.
union hwloc_obj_attr_u * attr
Object type-specific Attributes, may be NULL if no attribute value was found.
Definition: hwloc.h:339
int hwloc_insert_pci_device_list(struct hwloc_backend *backend, struct hwloc_obj *first_obj)
Insert a list of PCI devices and bridges in the backend topology.
int hwloc_pci_prepare_bridge(hwloc_obj_t obj, const unsigned char *config)
Modify the PCI device object into a bridge and fill its attribute if a bridge is found in the PCI con...
static struct hwloc_obj * hwloc_alloc_setup_object(hwloc_obj_type_t type, signed os_index)
Allocate and initialize an object of the given type and physical index.
Definition: plugins.h:287
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:57
struct hwloc_bitmap_s * hwloc_bitmap_t
Set of bits represented as an opaque pointer to an internal bitmap.
Definition: bitmap.h:45
unsigned long flags
Backend flags, as an OR'ed set of HWLOC_BACKEND_FLAG_*.
Definition: plugins.h:125
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.
int hwloc_backend_enable(struct hwloc_topology *topology, struct hwloc_backend *backend)
Enable a previously allocated and setup backend.
int(* notify_new_object)(struct hwloc_backend *backend, struct hwloc_backend *caller, struct hwloc_obj *obj)
Callback called by backends to notify this backend that a new object was added. returns > 0 if it mod...
Definition: plugins.h:156
Levels should be reconnected before this backend discover() is used.
Definition: plugins.h:163
hwloc_cpuset_t cpuset
CPUs covered by this object.
Definition: hwloc.h:375
enum hwloc_component_type_e hwloc_component_type_t
Generic component type.
unsigned excludes
Component types to exclude, as an OR'ed set of HWLOC_DISC_COMPONENT_TYPE_*.
Definition: plugins.h:67