.TH "hwlocality_diff" 3 "Version 2.10.0rc2" "Hardware Locality (hwloc)" \" -*- nroff -*- .ad l .nh .SH NAME hwlocality_diff \- Topology differences .SH SYNOPSIS .br .PP .SS "Data Structures" .in +1c .ti -1c .RI "union \fBhwloc_topology_diff_obj_attr_u\fP" .br .ti -1c .RI "union \fBhwloc_topology_diff_u\fP" .br .in -1c .SS "Typedefs" .in +1c .ti -1c .RI "typedef enum \fBhwloc_topology_diff_obj_attr_type_e\fP \fBhwloc_topology_diff_obj_attr_type_t\fP" .br .ti -1c .RI "typedef enum \fBhwloc_topology_diff_type_e\fP \fBhwloc_topology_diff_type_t\fP" .br .ti -1c .RI "typedef union \fBhwloc_topology_diff_u\fP * \fBhwloc_topology_diff_t\fP" .br .in -1c .SS "Enumerations" .in +1c .ti -1c .RI "enum \fBhwloc_topology_diff_obj_attr_type_e\fP { \fBHWLOC_TOPOLOGY_DIFF_OBJ_ATTR_SIZE\fP, \fBHWLOC_TOPOLOGY_DIFF_OBJ_ATTR_NAME\fP, \fBHWLOC_TOPOLOGY_DIFF_OBJ_ATTR_INFO\fP }" .br .ti -1c .RI "enum \fBhwloc_topology_diff_type_e\fP { \fBHWLOC_TOPOLOGY_DIFF_OBJ_ATTR\fP, \fBHWLOC_TOPOLOGY_DIFF_TOO_COMPLEX\fP }" .br .ti -1c .RI "enum \fBhwloc_topology_diff_apply_flags_e\fP { \fBHWLOC_TOPOLOGY_DIFF_APPLY_REVERSE\fP }" .br .in -1c .SS "Functions" .in +1c .ti -1c .RI "int \fBhwloc_topology_diff_build\fP (\fBhwloc_topology_t\fP topology, \fBhwloc_topology_t\fP newtopology, unsigned long flags, \fBhwloc_topology_diff_t\fP *diff)" .br .ti -1c .RI "int \fBhwloc_topology_diff_apply\fP (\fBhwloc_topology_t\fP topology, \fBhwloc_topology_diff_t\fP diff, unsigned long flags)" .br .ti -1c .RI "int \fBhwloc_topology_diff_destroy\fP (\fBhwloc_topology_diff_t\fP diff)" .br .ti -1c .RI "int \fBhwloc_topology_diff_load_xml\fP (const char *xmlpath, \fBhwloc_topology_diff_t\fP *diff, char **refname)" .br .ti -1c .RI "int \fBhwloc_topology_diff_export_xml\fP (\fBhwloc_topology_diff_t\fP diff, const char *refname, const char *xmlpath)" .br .ti -1c .RI "int \fBhwloc_topology_diff_load_xmlbuffer\fP (const char *xmlbuffer, int buflen, \fBhwloc_topology_diff_t\fP *diff, char **refname)" .br .ti -1c .RI "int \fBhwloc_topology_diff_export_xmlbuffer\fP (\fBhwloc_topology_diff_t\fP diff, const char *refname, char **xmlbuffer, int *buflen)" .br .in -1c .SH "Detailed Description" .PP Applications that manipulate many similar topologies, for instance one for each node of a homogeneous cluster, may want to compress topologies to reduce the memory footprint\&. .PP This file offers a way to manipulate the difference between topologies and export/import it to/from XML\&. Compression may therefore be achieved by storing one topology entirely while the others are only described by their differences with the former\&. The actual topology can be reconstructed when actually needed by applying the precomputed difference to the reference topology\&. .PP This interface targets very similar nodes\&. Only very simple differences between topologies are actually supported, for instance a change in the memory size, the name of the object, or some info attribute\&. More complex differences such as adding or removing objects cannot be represented in the difference structures and therefore return errors\&. Differences between object sets or topology-wide allowed sets, cannot be represented either\&. .PP It means that there is no need to apply the difference when looking at the tree organization (how many levels, how many objects per level, what kind of objects, CPU and node sets, etc) and when binding to objects\&. However the difference must be applied when looking at object attributes such as the name, the memory size or info attributes\&. .SH "Typedef Documentation" .PP .SS "typedef enum \fBhwloc_topology_diff_obj_attr_type_e\fP \fBhwloc_topology_diff_obj_attr_type_t\fP" .PP Type of one object attribute difference\&. .SS "typedef union \fBhwloc_topology_diff_u\fP * \fBhwloc_topology_diff_t\fP" .PP One element of a difference list between two topologies\&. .SS "typedef enum \fBhwloc_topology_diff_type_e\fP \fBhwloc_topology_diff_type_t\fP" .PP Type of one element of a difference list\&. .SH "Enumeration Type Documentation" .PP .SS "enum \fBhwloc_topology_diff_apply_flags_e\fP" .PP Flags to be given to \fBhwloc_topology_diff_apply()\fP\&. .PP \fBEnumerator\fP .in +1c .TP \fB\fIHWLOC_TOPOLOGY_DIFF_APPLY_REVERSE \fP\fP Apply topology diff in reverse direction\&. .SS "enum \fBhwloc_topology_diff_obj_attr_type_e\fP" .PP Type of one object attribute difference\&. .PP \fBEnumerator\fP .in +1c .TP \fB\fIHWLOC_TOPOLOGY_DIFF_OBJ_ATTR_SIZE \fP\fP The object local memory is modified\&. The union is a \fBhwloc_topology_diff_obj_attr_u::hwloc_topology_diff_obj_attr_uint64_s\fP (and the index field is ignored)\&. .TP \fB\fIHWLOC_TOPOLOGY_DIFF_OBJ_ATTR_NAME \fP\fP The object name is modified\&. The union is a \fBhwloc_topology_diff_obj_attr_u::hwloc_topology_diff_obj_attr_string_s\fP (and the name field is ignored)\&. .TP \fB\fIHWLOC_TOPOLOGY_DIFF_OBJ_ATTR_INFO \fP\fP the value of an info attribute is modified\&. The union is a \fBhwloc_topology_diff_obj_attr_u::hwloc_topology_diff_obj_attr_string_s\fP\&. .SS "enum \fBhwloc_topology_diff_type_e\fP" .PP Type of one element of a difference list\&. .PP \fBEnumerator\fP .in +1c .TP \fB\fIHWLOC_TOPOLOGY_DIFF_OBJ_ATTR \fP\fP An object attribute was changed\&. The union is a \fBhwloc_topology_diff_u::hwloc_topology_diff_obj_attr_s\fP\&. .TP \fB\fIHWLOC_TOPOLOGY_DIFF_TOO_COMPLEX \fP\fP The difference is too complex, it cannot be represented\&. The difference below this object has not been checked\&. \fBhwloc_topology_diff_build()\fP will return 1\&. The union is a \fBhwloc_topology_diff_u::hwloc_topology_diff_too_complex_s\fP\&. .SH "Function Documentation" .PP .SS "int hwloc_topology_diff_apply (\fBhwloc_topology_t\fP topology, \fBhwloc_topology_diff_t\fP diff, unsigned long flags)" .PP Apply a topology diff to an existing topology\&. \fCflags\fP is an OR'ed set of \fBhwloc_topology_diff_apply_flags_e\fP\&. .PP The new topology is modified in place\&. \fBhwloc_topology_dup()\fP may be used to duplicate it before patching\&. .PP If the difference cannot be applied entirely, all previous applied elements are unapplied before returning\&. .PP \fBReturns\fP .RS 4 0 on success\&. .PP -N if applying the difference failed while trying to apply the N-th part of the difference\&. For instance -1 is returned if the very first difference element could not be applied\&. .RE .PP .SS "int hwloc_topology_diff_build (\fBhwloc_topology_t\fP topology, \fBhwloc_topology_t\fP newtopology, unsigned long flags, \fBhwloc_topology_diff_t\fP * diff)" .PP Compute the difference between 2 topologies\&. The difference is stored as a list of \fBhwloc_topology_diff_t\fP entries starting at \fCdiff\fP\&. It is computed by doing a depth-first traversal of both topology trees simultaneously\&. .PP If the difference between 2 objects is too complex to be represented (for instance if some objects have different types, or different numbers of children), a special diff entry of type \fBHWLOC_TOPOLOGY_DIFF_TOO_COMPLEX\fP is queued\&. The computation of the diff does not continue below these objects\&. So each such diff entry means that the difference between two subtrees could not be computed\&. .PP \fBReturns\fP .RS 4 0 if the difference can be represented properly\&. .PP 0 with \fCdiff\fP pointing to NULL if there is no difference between the topologies\&. .PP 1 if the difference is too complex (see above)\&. Some entries in the list will be of type \fBHWLOC_TOPOLOGY_DIFF_TOO_COMPLEX\fP\&. .PP -1 on any other error\&. .RE .PP \fBNote\fP .RS 4 \fCflags\fP is currently not used\&. It should be 0\&. .PP The output diff has to be freed with \fBhwloc_topology_diff_destroy()\fP\&. .PP The output diff can only be exported to XML or passed to \fBhwloc_topology_diff_apply()\fP if 0 was returned, i\&.e\&. if no entry of type \fBHWLOC_TOPOLOGY_DIFF_TOO_COMPLEX\fP is listed\&. .PP The output diff may be modified by removing some entries from the list\&. The removed entries should be freed by passing them to to \fBhwloc_topology_diff_destroy()\fP (possible as another list)\&. .RE .PP .SS "int hwloc_topology_diff_destroy (\fBhwloc_topology_diff_t\fP diff)" .PP Destroy a list of topology differences\&. .PP \fBReturns\fP .RS 4 0\&. .RE .PP .SS "int hwloc_topology_diff_export_xml (\fBhwloc_topology_diff_t\fP diff, const char * refname, const char * xmlpath)" .PP Export a list of topology differences to a XML file\&. If not \fCNULL\fP, \fCrefname\fP defines an identifier string for the reference topology which was used as a base when computing this difference\&. This identifier is usually the name of the other XML file that contains the reference topology\&. This attribute is given back when reading the diff from XML\&. .PP \fBReturns\fP .RS 4 0 on success, -1 on error\&. .RE .PP .SS "int hwloc_topology_diff_export_xmlbuffer (\fBhwloc_topology_diff_t\fP diff, const char * refname, char ** xmlbuffer, int * buflen)" .PP Export a list of topology differences to a XML buffer\&. If not \fCNULL\fP, \fCrefname\fP defines an identifier string for the reference topology which was used as a base when computing this difference\&. This identifier is usually the name of the other XML file that contains the reference topology\&. This attribute is given back when reading the diff from XML\&. .PP The returned buffer ends with a \\0 that is included in the returned length\&. .PP \fBReturns\fP .RS 4 0 on success, -1 on error\&. .RE .PP \fBNote\fP .RS 4 The XML buffer should later be freed with \fBhwloc_free_xmlbuffer()\fP\&. .RE .PP .SS "int hwloc_topology_diff_load_xml (const char * xmlpath, \fBhwloc_topology_diff_t\fP * diff, char ** refname)" .PP Load a list of topology differences from a XML file\&. If not \fCNULL\fP, \fCrefname\fP will be filled with the identifier string of the reference topology for the difference file, if any was specified in the XML file\&. This identifier is usually the name of the other XML file that contains the reference topology\&. .PP \fBReturns\fP .RS 4 0 on success, -1 on error\&. .RE .PP \fBNote\fP .RS 4 the pointer returned in refname should later be freed by the caller\&. .RE .PP .SS "int hwloc_topology_diff_load_xmlbuffer (const char * xmlbuffer, int buflen, \fBhwloc_topology_diff_t\fP * diff, char ** refname)" .PP Load a list of topology differences from a XML buffer\&. If not \fCNULL\fP, \fCrefname\fP will be filled with the identifier string of the reference topology for the difference file, if any was specified in the XML file\&. This identifier is usually the name of the other XML file that contains the reference topology\&. .PP \fBReturns\fP .RS 4 0 on success, -1 on error\&. .RE .PP \fBNote\fP .RS 4 the pointer returned in refname should later be freed by the caller\&. .RE .PP .SH "Author" .PP Generated automatically by Doxygen for Hardware Locality (hwloc) from the source code\&.