\hypertarget{group__hwlocality__helper__nodeset__convert}{\section{Conversion between cpuset and nodeset}
\label{group__hwlocality__helper__nodeset__convert}\index{Conversion between cpuset and nodeset@{Conversion between cpuset and nodeset}}
}


There are two semantics for converting cpusets to nodesets depending on how non-\/\+N\+U\+M\+A machines are handled.  


\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
static \+\_\+\+\_\+hwloc\+\_\+inline void \hyperlink{group__hwlocality__helper__nodeset__convert_ga60ecc4ae480c28b5fbd34aca4fc37daa}{hwloc\+\_\+cpuset\+\_\+to\+\_\+nodeset} (\hyperlink{group__hwlocality__topology_ga9d1e76ee15a7dee158b786c30b6a6e38}{hwloc\+\_\+topology\+\_\+t} topology, \hyperlink{group__hwlocality__sets_ga1f784433e9b606261f62d1134f6a3b25}{hwloc\+\_\+const\+\_\+cpuset\+\_\+t} cpuset, \hyperlink{group__hwlocality__sets_ga37e35730fa7e775b5bb0afe893d6d508}{hwloc\+\_\+nodeset\+\_\+t} nodeset)
\begin{DoxyCompactList}\small\item\em Convert a C\+P\+U set into a N\+U\+M\+A node set and handle non-\/\+N\+U\+M\+A cases. \end{DoxyCompactList}\item 
static \+\_\+\+\_\+hwloc\+\_\+inline void \hyperlink{group__hwlocality__helper__nodeset__convert_ga9162785e39d7c697f76f99524c4a2fb4}{hwloc\+\_\+cpuset\+\_\+to\+\_\+nodeset\+\_\+strict} (struct \hyperlink{structhwloc__topology}{hwloc\+\_\+topology} $\ast$topology, \hyperlink{group__hwlocality__sets_ga1f784433e9b606261f62d1134f6a3b25}{hwloc\+\_\+const\+\_\+cpuset\+\_\+t} cpuset, \hyperlink{group__hwlocality__sets_ga37e35730fa7e775b5bb0afe893d6d508}{hwloc\+\_\+nodeset\+\_\+t} nodeset)
\begin{DoxyCompactList}\small\item\em Convert a C\+P\+U set into a N\+U\+M\+A node set without handling non-\/\+N\+U\+M\+A cases. \end{DoxyCompactList}\item 
static \+\_\+\+\_\+hwloc\+\_\+inline void \hyperlink{group__hwlocality__helper__nodeset__convert_gaa677fd588304b5615de4ea78104adfb5}{hwloc\+\_\+cpuset\+\_\+from\+\_\+nodeset} (\hyperlink{group__hwlocality__topology_ga9d1e76ee15a7dee158b786c30b6a6e38}{hwloc\+\_\+topology\+\_\+t} topology, \hyperlink{group__hwlocality__sets_ga4bbf39b68b6f568fb92739e7c0ea7801}{hwloc\+\_\+cpuset\+\_\+t} cpuset, \hyperlink{group__hwlocality__sets_ga2f5276235841ad66a79bedad16a5a10c}{hwloc\+\_\+const\+\_\+nodeset\+\_\+t} nodeset)
\begin{DoxyCompactList}\small\item\em Convert a N\+U\+M\+A node set into a C\+P\+U set and handle non-\/\+N\+U\+M\+A cases. \end{DoxyCompactList}\item 
static \+\_\+\+\_\+hwloc\+\_\+inline void \hyperlink{group__hwlocality__helper__nodeset__convert_gaa7c3f39802b00a758c58e024a8119979}{hwloc\+\_\+cpuset\+\_\+from\+\_\+nodeset\+\_\+strict} (struct \hyperlink{structhwloc__topology}{hwloc\+\_\+topology} $\ast$topology, \hyperlink{group__hwlocality__sets_ga4bbf39b68b6f568fb92739e7c0ea7801}{hwloc\+\_\+cpuset\+\_\+t} cpuset, \hyperlink{group__hwlocality__sets_ga2f5276235841ad66a79bedad16a5a10c}{hwloc\+\_\+const\+\_\+nodeset\+\_\+t} nodeset)
\begin{DoxyCompactList}\small\item\em Convert a N\+U\+M\+A node set into a C\+P\+U set without handling non-\/\+N\+U\+M\+A cases. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
There are two semantics for converting cpusets to nodesets depending on how non-\/\+N\+U\+M\+A machines are handled. 

When manipulating nodesets for memory binding, non-\/\+N\+U\+M\+A machines should be considered as having a single N\+U\+M\+A node. The standard conversion routines below should be used so that marking the first bit of the nodeset means that memory should be bound to a non-\/\+N\+U\+M\+A whole machine.

When manipulating nodesets as an actual list of N\+U\+M\+A nodes without any need to handle memory binding on non-\/\+N\+U\+M\+A machines, the strict conversion routines may be used instead. 

\subsection{Function Documentation}
\hypertarget{group__hwlocality__helper__nodeset__convert_gaa677fd588304b5615de4ea78104adfb5}{\index{Conversion between cpuset and nodeset@{Conversion between cpuset and nodeset}!hwloc\+\_\+cpuset\+\_\+from\+\_\+nodeset@{hwloc\+\_\+cpuset\+\_\+from\+\_\+nodeset}}
\index{hwloc\+\_\+cpuset\+\_\+from\+\_\+nodeset@{hwloc\+\_\+cpuset\+\_\+from\+\_\+nodeset}!Conversion between cpuset and nodeset@{Conversion between cpuset and nodeset}}
\subsubsection[{hwloc\+\_\+cpuset\+\_\+from\+\_\+nodeset}]{\setlength{\rightskip}{0pt plus 5cm}static \+\_\+\+\_\+hwloc\+\_\+inline void hwloc\+\_\+cpuset\+\_\+from\+\_\+nodeset (
\begin{DoxyParamCaption}
\item[{{\bf hwloc\+\_\+topology\+\_\+t}}]{topology, }
\item[{{\bf hwloc\+\_\+cpuset\+\_\+t}}]{cpuset, }
\item[{{\bf hwloc\+\_\+const\+\_\+nodeset\+\_\+t}}]{nodeset}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}}\label{group__hwlocality__helper__nodeset__convert_gaa677fd588304b5615de4ea78104adfb5}


Convert a N\+U\+M\+A node set into a C\+P\+U set and handle non-\/\+N\+U\+M\+A cases. 

If the topology contains no N\+U\+M\+A nodes, the machine is considered as a single memory node, and the following behavior is used\+: If {\ttfamily nodeset} is empty, {\ttfamily cpuset} will be emptied as well. Otherwise {\ttfamily cpuset} will be entirely filled. This is useful for manipulating memory binding sets. 

References hwloc\+\_\+obj\+::cpuset, hwloc\+\_\+obj\+::depth, hwloc\+\_\+bitmap\+\_\+fill(), hwloc\+\_\+bitmap\+\_\+isset(), hwloc\+\_\+bitmap\+\_\+iszero(), hwloc\+\_\+bitmap\+\_\+or(), hwloc\+\_\+bitmap\+\_\+zero(), hwloc\+\_\+get\+\_\+next\+\_\+obj\+\_\+by\+\_\+depth(), hwloc\+\_\+get\+\_\+type\+\_\+depth(), H\+W\+L\+O\+C\+\_\+\+O\+B\+J\+\_\+\+N\+O\+D\+E, H\+W\+L\+O\+C\+\_\+\+T\+Y\+P\+E\+\_\+\+D\+E\+P\+T\+H\+\_\+\+U\+N\+K\+N\+O\+W\+N, and hwloc\+\_\+obj\+::os\+\_\+index.



Referenced by hwloc\+\_\+get\+\_\+area\+\_\+membind(), hwloc\+\_\+get\+\_\+membind(), and hwloc\+\_\+get\+\_\+proc\+\_\+membind().

\hypertarget{group__hwlocality__helper__nodeset__convert_gaa7c3f39802b00a758c58e024a8119979}{\index{Conversion between cpuset and nodeset@{Conversion between cpuset and nodeset}!hwloc\+\_\+cpuset\+\_\+from\+\_\+nodeset\+\_\+strict@{hwloc\+\_\+cpuset\+\_\+from\+\_\+nodeset\+\_\+strict}}
\index{hwloc\+\_\+cpuset\+\_\+from\+\_\+nodeset\+\_\+strict@{hwloc\+\_\+cpuset\+\_\+from\+\_\+nodeset\+\_\+strict}!Conversion between cpuset and nodeset@{Conversion between cpuset and nodeset}}
\subsubsection[{hwloc\+\_\+cpuset\+\_\+from\+\_\+nodeset\+\_\+strict}]{\setlength{\rightskip}{0pt plus 5cm}static \+\_\+\+\_\+hwloc\+\_\+inline void hwloc\+\_\+cpuset\+\_\+from\+\_\+nodeset\+\_\+strict (
\begin{DoxyParamCaption}
\item[{struct {\bf hwloc\+\_\+topology} $\ast$}]{topology, }
\item[{{\bf hwloc\+\_\+cpuset\+\_\+t}}]{cpuset, }
\item[{{\bf hwloc\+\_\+const\+\_\+nodeset\+\_\+t}}]{nodeset}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}}\label{group__hwlocality__helper__nodeset__convert_gaa7c3f39802b00a758c58e024a8119979}


Convert a N\+U\+M\+A node set into a C\+P\+U set without handling non-\/\+N\+U\+M\+A cases. 

This is the strict variant of \hyperlink{group__hwlocality__helper__nodeset__convert_gaa677fd588304b5615de4ea78104adfb5}{hwloc\+\_\+cpuset\+\_\+from\+\_\+nodeset}. It does not fix non-\/\+N\+U\+M\+A cases. If the topology contains some N\+U\+M\+A nodes, behave exactly the same. However, if the topology contains no N\+U\+M\+A nodes, return an empty cpuset. 

References hwloc\+\_\+obj\+::cpuset, hwloc\+\_\+obj\+::depth, hwloc\+\_\+bitmap\+\_\+isset(), hwloc\+\_\+bitmap\+\_\+or(), hwloc\+\_\+bitmap\+\_\+zero(), hwloc\+\_\+get\+\_\+next\+\_\+obj\+\_\+by\+\_\+depth(), hwloc\+\_\+get\+\_\+type\+\_\+depth(), H\+W\+L\+O\+C\+\_\+\+O\+B\+J\+\_\+\+N\+O\+D\+E, H\+W\+L\+O\+C\+\_\+\+T\+Y\+P\+E\+\_\+\+D\+E\+P\+T\+H\+\_\+\+U\+N\+K\+N\+O\+W\+N, and hwloc\+\_\+obj\+::os\+\_\+index.

\hypertarget{group__hwlocality__helper__nodeset__convert_ga60ecc4ae480c28b5fbd34aca4fc37daa}{\index{Conversion between cpuset and nodeset@{Conversion between cpuset and nodeset}!hwloc\+\_\+cpuset\+\_\+to\+\_\+nodeset@{hwloc\+\_\+cpuset\+\_\+to\+\_\+nodeset}}
\index{hwloc\+\_\+cpuset\+\_\+to\+\_\+nodeset@{hwloc\+\_\+cpuset\+\_\+to\+\_\+nodeset}!Conversion between cpuset and nodeset@{Conversion between cpuset and nodeset}}
\subsubsection[{hwloc\+\_\+cpuset\+\_\+to\+\_\+nodeset}]{\setlength{\rightskip}{0pt plus 5cm}static \+\_\+\+\_\+hwloc\+\_\+inline void hwloc\+\_\+cpuset\+\_\+to\+\_\+nodeset (
\begin{DoxyParamCaption}
\item[{{\bf hwloc\+\_\+topology\+\_\+t}}]{topology, }
\item[{{\bf hwloc\+\_\+const\+\_\+cpuset\+\_\+t}}]{cpuset, }
\item[{{\bf hwloc\+\_\+nodeset\+\_\+t}}]{nodeset}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}}\label{group__hwlocality__helper__nodeset__convert_ga60ecc4ae480c28b5fbd34aca4fc37daa}


Convert a C\+P\+U set into a N\+U\+M\+A node set and handle non-\/\+N\+U\+M\+A cases. 

If some N\+U\+M\+A nodes have no C\+P\+Us at all, this function never sets their indexes in the output node set, even if a full C\+P\+U set is given in input.

If the topology contains no N\+U\+M\+A nodes, the machine is considered as a single memory node, and the following behavior is used\+: If {\ttfamily cpuset} is empty, {\ttfamily nodeset} will be emptied as well. Otherwise {\ttfamily nodeset} will be entirely filled. 

References hwloc\+\_\+obj\+::depth, hwloc\+\_\+bitmap\+\_\+fill(), hwloc\+\_\+bitmap\+\_\+iszero(), hwloc\+\_\+bitmap\+\_\+set(), hwloc\+\_\+bitmap\+\_\+zero(), hwloc\+\_\+get\+\_\+next\+\_\+obj\+\_\+covering\+\_\+cpuset\+\_\+by\+\_\+depth(), hwloc\+\_\+get\+\_\+type\+\_\+depth(), H\+W\+L\+O\+C\+\_\+\+O\+B\+J\+\_\+\+N\+O\+D\+E, H\+W\+L\+O\+C\+\_\+\+T\+Y\+P\+E\+\_\+\+D\+E\+P\+T\+H\+\_\+\+U\+N\+K\+N\+O\+W\+N, and hwloc\+\_\+obj\+::os\+\_\+index.

\hypertarget{group__hwlocality__helper__nodeset__convert_ga9162785e39d7c697f76f99524c4a2fb4}{\index{Conversion between cpuset and nodeset@{Conversion between cpuset and nodeset}!hwloc\+\_\+cpuset\+\_\+to\+\_\+nodeset\+\_\+strict@{hwloc\+\_\+cpuset\+\_\+to\+\_\+nodeset\+\_\+strict}}
\index{hwloc\+\_\+cpuset\+\_\+to\+\_\+nodeset\+\_\+strict@{hwloc\+\_\+cpuset\+\_\+to\+\_\+nodeset\+\_\+strict}!Conversion between cpuset and nodeset@{Conversion between cpuset and nodeset}}
\subsubsection[{hwloc\+\_\+cpuset\+\_\+to\+\_\+nodeset\+\_\+strict}]{\setlength{\rightskip}{0pt plus 5cm}static \+\_\+\+\_\+hwloc\+\_\+inline void hwloc\+\_\+cpuset\+\_\+to\+\_\+nodeset\+\_\+strict (
\begin{DoxyParamCaption}
\item[{struct {\bf hwloc\+\_\+topology} $\ast$}]{topology, }
\item[{{\bf hwloc\+\_\+const\+\_\+cpuset\+\_\+t}}]{cpuset, }
\item[{{\bf hwloc\+\_\+nodeset\+\_\+t}}]{nodeset}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}}\label{group__hwlocality__helper__nodeset__convert_ga9162785e39d7c697f76f99524c4a2fb4}


Convert a C\+P\+U set into a N\+U\+M\+A node set without handling non-\/\+N\+U\+M\+A cases. 

This is the strict variant of \hyperlink{group__hwlocality__helper__nodeset__convert_ga60ecc4ae480c28b5fbd34aca4fc37daa}{hwloc\+\_\+cpuset\+\_\+to\+\_\+nodeset}. It does not fix non-\/\+N\+U\+M\+A cases. If the topology contains some N\+U\+M\+A nodes, behave exactly the same. However, if the topology contains no N\+U\+M\+A nodes, return an empty nodeset. 

References hwloc\+\_\+obj\+::depth, hwloc\+\_\+bitmap\+\_\+set(), hwloc\+\_\+bitmap\+\_\+zero(), hwloc\+\_\+get\+\_\+next\+\_\+obj\+\_\+covering\+\_\+cpuset\+\_\+by\+\_\+depth(), hwloc\+\_\+get\+\_\+type\+\_\+depth(), H\+W\+L\+O\+C\+\_\+\+O\+B\+J\+\_\+\+N\+O\+D\+E, H\+W\+L\+O\+C\+\_\+\+T\+Y\+P\+E\+\_\+\+D\+E\+P\+T\+H\+\_\+\+U\+N\+K\+N\+O\+W\+N, and hwloc\+\_\+obj\+::os\+\_\+index.

