\hypertarget{group__hwlocality__distances}{\section{Distances}
\label{group__hwlocality__distances}\index{Distances@{Distances}}
}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
static \+\_\+\+\_\+hwloc\+\_\+inline const \\*
struct \hyperlink{structhwloc__distances__s}{hwloc\+\_\+distances\+\_\+s} $\ast$ \hyperlink{group__hwlocality__distances_gad4326fa2e0b8b73a2a7f70519876f3a9}{hwloc\+\_\+get\+\_\+whole\+\_\+distance\+\_\+matrix\+\_\+by\+\_\+depth} (\hyperlink{group__hwlocality__topology_ga9d1e76ee15a7dee158b786c30b6a6e38}{hwloc\+\_\+topology\+\_\+t} topology, unsigned depth)
\begin{DoxyCompactList}\small\item\em Get the distances between all objects at the given depth. \end{DoxyCompactList}\item 
static \+\_\+\+\_\+hwloc\+\_\+inline const \\*
struct \hyperlink{structhwloc__distances__s}{hwloc\+\_\+distances\+\_\+s} $\ast$ \hyperlink{group__hwlocality__distances_ga3398bea7148d4e9f9732537aa97ddd5a}{hwloc\+\_\+get\+\_\+whole\+\_\+distance\+\_\+matrix\+\_\+by\+\_\+type} (\hyperlink{group__hwlocality__topology_ga9d1e76ee15a7dee158b786c30b6a6e38}{hwloc\+\_\+topology\+\_\+t} topology, \hyperlink{group__hwlocality__types_gacd37bb612667dc437d66bfb175a8dc55}{hwloc\+\_\+obj\+\_\+type\+\_\+t} type)
\begin{DoxyCompactList}\small\item\em Get the distances between all objects of a given type. \end{DoxyCompactList}\item 
static \+\_\+\+\_\+hwloc\+\_\+inline const \\*
struct \hyperlink{structhwloc__distances__s}{hwloc\+\_\+distances\+\_\+s} $\ast$ \hyperlink{group__hwlocality__distances_ga1411cd4d8a061ad8ee4cec4322e27e50}{hwloc\+\_\+get\+\_\+distance\+\_\+matrix\+\_\+covering\+\_\+obj\+\_\+by\+\_\+depth} (\hyperlink{group__hwlocality__topology_ga9d1e76ee15a7dee158b786c30b6a6e38}{hwloc\+\_\+topology\+\_\+t} topology, \hyperlink{group__hwlocality__objects_ga79b8ab56877ef99ac59b833203391c7d}{hwloc\+\_\+obj\+\_\+t} obj, unsigned depth, unsigned $\ast$firstp)
\begin{DoxyCompactList}\small\item\em Get distances for the given depth and covering some objects. \end{DoxyCompactList}\item 
static \+\_\+\+\_\+hwloc\+\_\+inline int \hyperlink{group__hwlocality__distances_ga9addde99e34b815df47625f1d6191839}{hwloc\+\_\+get\+\_\+latency} (\hyperlink{group__hwlocality__topology_ga9d1e76ee15a7dee158b786c30b6a6e38}{hwloc\+\_\+topology\+\_\+t} topology, \hyperlink{group__hwlocality__objects_ga79b8ab56877ef99ac59b833203391c7d}{hwloc\+\_\+obj\+\_\+t} obj1, \hyperlink{group__hwlocality__objects_ga79b8ab56877ef99ac59b833203391c7d}{hwloc\+\_\+obj\+\_\+t} obj2, float $\ast$latency, float $\ast$reverse\+\_\+latency)
\begin{DoxyCompactList}\small\item\em Get the latency in both directions between two objects. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}


\subsection{Function Documentation}
\hypertarget{group__hwlocality__distances_ga1411cd4d8a061ad8ee4cec4322e27e50}{\index{Distances@{Distances}!hwloc\+\_\+get\+\_\+distance\+\_\+matrix\+\_\+covering\+\_\+obj\+\_\+by\+\_\+depth@{hwloc\+\_\+get\+\_\+distance\+\_\+matrix\+\_\+covering\+\_\+obj\+\_\+by\+\_\+depth}}
\index{hwloc\+\_\+get\+\_\+distance\+\_\+matrix\+\_\+covering\+\_\+obj\+\_\+by\+\_\+depth@{hwloc\+\_\+get\+\_\+distance\+\_\+matrix\+\_\+covering\+\_\+obj\+\_\+by\+\_\+depth}!Distances@{Distances}}
\subsubsection[{hwloc\+\_\+get\+\_\+distance\+\_\+matrix\+\_\+covering\+\_\+obj\+\_\+by\+\_\+depth}]{\setlength{\rightskip}{0pt plus 5cm}static \+\_\+\+\_\+hwloc\+\_\+inline const struct {\bf hwloc\+\_\+distances\+\_\+s}$\ast$ hwloc\+\_\+get\+\_\+distance\+\_\+matrix\+\_\+covering\+\_\+obj\+\_\+by\+\_\+depth (
\begin{DoxyParamCaption}
\item[{{\bf hwloc\+\_\+topology\+\_\+t}}]{topology, }
\item[{{\bf hwloc\+\_\+obj\+\_\+t}}]{obj, }
\item[{unsigned}]{depth, }
\item[{unsigned $\ast$}]{firstp}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}}\label{group__hwlocality__distances_ga1411cd4d8a061ad8ee4cec4322e27e50}


Get distances for the given depth and covering some objects. 

Return a distance matrix that describes depth {\ttfamily depth} and covers at least object {\ttfamily obj} and all its children.

When looking for the distance between some objects, a common ancestor should be passed in {\ttfamily obj}.

{\ttfamily firstp} is set to logical index of the first object described by the matrix.

The returned structure belongs to the hwloc library. The caller should not modify or free it. 

References hwloc\+\_\+obj\+::cpuset, hwloc\+\_\+obj\+::depth, hwloc\+\_\+obj\+::distances, hwloc\+\_\+get\+\_\+next\+\_\+obj\+\_\+inside\+\_\+cpuset\+\_\+by\+\_\+depth(), hwloc\+\_\+obj\+::logical\+\_\+index, hwloc\+\_\+distances\+\_\+s\+::nbobjs, hwloc\+\_\+obj\+::parent, and hwloc\+\_\+distances\+\_\+s\+::relative\+\_\+depth.



Referenced by hwloc\+\_\+get\+\_\+latency().

\hypertarget{group__hwlocality__distances_ga9addde99e34b815df47625f1d6191839}{\index{Distances@{Distances}!hwloc\+\_\+get\+\_\+latency@{hwloc\+\_\+get\+\_\+latency}}
\index{hwloc\+\_\+get\+\_\+latency@{hwloc\+\_\+get\+\_\+latency}!Distances@{Distances}}
\subsubsection[{hwloc\+\_\+get\+\_\+latency}]{\setlength{\rightskip}{0pt plus 5cm}static \+\_\+\+\_\+hwloc\+\_\+inline int hwloc\+\_\+get\+\_\+latency (
\begin{DoxyParamCaption}
\item[{{\bf hwloc\+\_\+topology\+\_\+t}}]{topology, }
\item[{{\bf hwloc\+\_\+obj\+\_\+t}}]{obj1, }
\item[{{\bf hwloc\+\_\+obj\+\_\+t}}]{obj2, }
\item[{float $\ast$}]{latency, }
\item[{float $\ast$}]{reverse\+\_\+latency}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}}\label{group__hwlocality__distances_ga9addde99e34b815df47625f1d6191839}


Get the latency in both directions between two objects. 

Look at ancestor objects from the bottom to the top until one of them contains a distance matrix that matches the objects exactly.

{\ttfamily latency} gets the value from object {\ttfamily obj1} to {\ttfamily obj2}, while {\ttfamily reverse\+\_\+latency} gets the reverse-\/direction value, which may be different on some architectures.

\begin{DoxyReturn}{Returns}
-\/1 if no ancestor contains a matching latency matrix. 
\end{DoxyReturn}


References hwloc\+\_\+obj\+::depth, hwloc\+\_\+get\+\_\+common\+\_\+ancestor\+\_\+obj(), hwloc\+\_\+get\+\_\+distance\+\_\+matrix\+\_\+covering\+\_\+obj\+\_\+by\+\_\+depth(), hwloc\+\_\+distances\+\_\+s\+::latency, hwloc\+\_\+obj\+::logical\+\_\+index, and hwloc\+\_\+distances\+\_\+s\+::nbobjs.

\hypertarget{group__hwlocality__distances_gad4326fa2e0b8b73a2a7f70519876f3a9}{\index{Distances@{Distances}!hwloc\+\_\+get\+\_\+whole\+\_\+distance\+\_\+matrix\+\_\+by\+\_\+depth@{hwloc\+\_\+get\+\_\+whole\+\_\+distance\+\_\+matrix\+\_\+by\+\_\+depth}}
\index{hwloc\+\_\+get\+\_\+whole\+\_\+distance\+\_\+matrix\+\_\+by\+\_\+depth@{hwloc\+\_\+get\+\_\+whole\+\_\+distance\+\_\+matrix\+\_\+by\+\_\+depth}!Distances@{Distances}}
\subsubsection[{hwloc\+\_\+get\+\_\+whole\+\_\+distance\+\_\+matrix\+\_\+by\+\_\+depth}]{\setlength{\rightskip}{0pt plus 5cm}static \+\_\+\+\_\+hwloc\+\_\+inline const struct {\bf hwloc\+\_\+distances\+\_\+s}$\ast$ hwloc\+\_\+get\+\_\+whole\+\_\+distance\+\_\+matrix\+\_\+by\+\_\+depth (
\begin{DoxyParamCaption}
\item[{{\bf hwloc\+\_\+topology\+\_\+t}}]{topology, }
\item[{unsigned}]{depth}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}}\label{group__hwlocality__distances_gad4326fa2e0b8b73a2a7f70519876f3a9}


Get the distances between all objects at the given depth. 

\begin{DoxyReturn}{Returns}
a distances structure containing a matrix with all distances between all objects at the given depth.
\end{DoxyReturn}
Slot i+nbobjs$\ast$j contains the distance from the object of logical index i the object of logical index j.

\begin{DoxyNote}{Note}
This function only returns matrices covering the whole topology, without any unknown distance value. Those matrices are available in top-\/level object of the hierarchy. Matrices of lower objects are not reported here since they cover only part of the machine.
\end{DoxyNote}
The returned structure belongs to the hwloc library. The caller should not modify or free it.

\begin{DoxyReturn}{Returns}
{\ttfamily N\+U\+L\+L} if no such distance matrix exists. 
\end{DoxyReturn}


References hwloc\+\_\+obj\+::distances, hwloc\+\_\+get\+\_\+root\+\_\+obj(), and hwloc\+\_\+distances\+\_\+s\+::relative\+\_\+depth.



Referenced by hwloc\+\_\+get\+\_\+whole\+\_\+distance\+\_\+matrix\+\_\+by\+\_\+type().

\hypertarget{group__hwlocality__distances_ga3398bea7148d4e9f9732537aa97ddd5a}{\index{Distances@{Distances}!hwloc\+\_\+get\+\_\+whole\+\_\+distance\+\_\+matrix\+\_\+by\+\_\+type@{hwloc\+\_\+get\+\_\+whole\+\_\+distance\+\_\+matrix\+\_\+by\+\_\+type}}
\index{hwloc\+\_\+get\+\_\+whole\+\_\+distance\+\_\+matrix\+\_\+by\+\_\+type@{hwloc\+\_\+get\+\_\+whole\+\_\+distance\+\_\+matrix\+\_\+by\+\_\+type}!Distances@{Distances}}
\subsubsection[{hwloc\+\_\+get\+\_\+whole\+\_\+distance\+\_\+matrix\+\_\+by\+\_\+type}]{\setlength{\rightskip}{0pt plus 5cm}static \+\_\+\+\_\+hwloc\+\_\+inline const struct {\bf hwloc\+\_\+distances\+\_\+s}$\ast$ hwloc\+\_\+get\+\_\+whole\+\_\+distance\+\_\+matrix\+\_\+by\+\_\+type (
\begin{DoxyParamCaption}
\item[{{\bf hwloc\+\_\+topology\+\_\+t}}]{topology, }
\item[{{\bf hwloc\+\_\+obj\+\_\+type\+\_\+t}}]{type}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}}\label{group__hwlocality__distances_ga3398bea7148d4e9f9732537aa97ddd5a}


Get the distances between all objects of a given type. 

\begin{DoxyReturn}{Returns}
a distances structure containing a matrix with all distances between all objects of the given type.
\end{DoxyReturn}
Slot i+nbobjs$\ast$j contains the distance from the object of logical index i the object of logical index j.

\begin{DoxyNote}{Note}
This function only returns matrices covering the whole topology, without any unknown distance value. Those matrices are available in top-\/level object of the hierarchy. Matrices of lower objects are not reported here since they cover only part of the machine.
\end{DoxyNote}
The returned structure belongs to the hwloc library. The caller should not modify or free it.

\begin{DoxyReturn}{Returns}
{\ttfamily N\+U\+L\+L} if no such distance matrix exists. 
\end{DoxyReturn}


References hwloc\+\_\+get\+\_\+type\+\_\+depth(), and hwloc\+\_\+get\+\_\+whole\+\_\+distance\+\_\+matrix\+\_\+by\+\_\+depth().

