\hypertarget{group__hwlocality__cpubinding}{\section{C\+P\+U binding}
\label{group__hwlocality__cpubinding}\index{C\+P\+U binding@{C\+P\+U binding}}
}


It is often useful to call \hyperlink{group__hwlocality__bitmap_ga4630aa1b7e08eac5b41be126194e84a1}{hwloc\+\_\+bitmap\+\_\+singlify()} first so that a single C\+P\+U remains in the set.  


\subsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum \hyperlink{group__hwlocality__cpubinding_ga217dc8d373f8958cc93c154ebce1c71c}{hwloc\+\_\+cpubind\+\_\+flags\+\_\+t} \{ \hyperlink{group__hwlocality__cpubinding_gga217dc8d373f8958cc93c154ebce1c71ca2e0dd0128dac6b03408c7dd170477fdc}{H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+P\+R\+O\+C\+E\+S\+S}, 
\hyperlink{group__hwlocality__cpubinding_gga217dc8d373f8958cc93c154ebce1c71caf1b6bbad00d7b1017b918e3719f4d421}{H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+T\+H\+R\+E\+A\+D}, 
\hyperlink{group__hwlocality__cpubinding_gga217dc8d373f8958cc93c154ebce1c71ca679a7e0f0c7ee06b123565f90d98e7fa}{H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+S\+T\+R\+I\+C\+T}, 
\hyperlink{group__hwlocality__cpubinding_gga217dc8d373f8958cc93c154ebce1c71ca41ce440443cc3087caed95ab60edcad6}{H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+N\+O\+M\+E\+M\+B\+I\+N\+D}
 \}
\begin{DoxyCompactList}\small\item\em Process/\+Thread binding flags. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
H\+W\+L\+O\+C\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int \hyperlink{group__hwlocality__cpubinding_gaf4cc194d5c0d38004a21b9f03522a7e3}{hwloc\+\_\+set\+\_\+cpubind} (\hyperlink{group__hwlocality__topology_ga9d1e76ee15a7dee158b786c30b6a6e38}{hwloc\+\_\+topology\+\_\+t} topology, \hyperlink{group__hwlocality__sets_ga1f784433e9b606261f62d1134f6a3b25}{hwloc\+\_\+const\+\_\+cpuset\+\_\+t} set, int flags)
\begin{DoxyCompactList}\small\item\em Bind current process or thread on cpus given in physical bitmap {\ttfamily set}. \end{DoxyCompactList}\item 
H\+W\+L\+O\+C\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int \hyperlink{group__hwlocality__cpubinding_gab52f83ab16eac465da55e16bdd30df77}{hwloc\+\_\+get\+\_\+cpubind} (\hyperlink{group__hwlocality__topology_ga9d1e76ee15a7dee158b786c30b6a6e38}{hwloc\+\_\+topology\+\_\+t} topology, \hyperlink{group__hwlocality__sets_ga4bbf39b68b6f568fb92739e7c0ea7801}{hwloc\+\_\+cpuset\+\_\+t} set, int flags)
\begin{DoxyCompactList}\small\item\em Get current process or thread binding. \end{DoxyCompactList}\item 
H\+W\+L\+O\+C\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int \hyperlink{group__hwlocality__cpubinding_gac0ef3510b4e9c1273029ecf94e8c9686}{hwloc\+\_\+set\+\_\+proc\+\_\+cpubind} (\hyperlink{group__hwlocality__topology_ga9d1e76ee15a7dee158b786c30b6a6e38}{hwloc\+\_\+topology\+\_\+t} topology, hwloc\+\_\+pid\+\_\+t pid, \hyperlink{group__hwlocality__sets_ga1f784433e9b606261f62d1134f6a3b25}{hwloc\+\_\+const\+\_\+cpuset\+\_\+t} set, int flags)
\begin{DoxyCompactList}\small\item\em Bind a process {\ttfamily pid} on cpus given in physical bitmap {\ttfamily set}. \end{DoxyCompactList}\item 
H\+W\+L\+O\+C\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int \hyperlink{group__hwlocality__cpubinding_gaa1373a002b9a0a87eb002e26c590f2da}{hwloc\+\_\+get\+\_\+proc\+\_\+cpubind} (\hyperlink{group__hwlocality__topology_ga9d1e76ee15a7dee158b786c30b6a6e38}{hwloc\+\_\+topology\+\_\+t} topology, hwloc\+\_\+pid\+\_\+t pid, \hyperlink{group__hwlocality__sets_ga4bbf39b68b6f568fb92739e7c0ea7801}{hwloc\+\_\+cpuset\+\_\+t} set, int flags)
\begin{DoxyCompactList}\small\item\em Get the current physical binding of process {\ttfamily pid}. \end{DoxyCompactList}\item 
H\+W\+L\+O\+C\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int \hyperlink{group__hwlocality__cpubinding_ga8e9a4b5ee3eaa18fd3a229790c6b5b17}{hwloc\+\_\+get\+\_\+last\+\_\+cpu\+\_\+location} (\hyperlink{group__hwlocality__topology_ga9d1e76ee15a7dee158b786c30b6a6e38}{hwloc\+\_\+topology\+\_\+t} topology, \hyperlink{group__hwlocality__sets_ga4bbf39b68b6f568fb92739e7c0ea7801}{hwloc\+\_\+cpuset\+\_\+t} set, int flags)
\begin{DoxyCompactList}\small\item\em Get the last physical C\+P\+U where the current process or thread ran. \end{DoxyCompactList}\item 
H\+W\+L\+O\+C\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int \hyperlink{group__hwlocality__cpubinding_ga1e005ddb9701e6a993a9eb8abe67a710}{hwloc\+\_\+get\+\_\+proc\+\_\+last\+\_\+cpu\+\_\+location} (\hyperlink{group__hwlocality__topology_ga9d1e76ee15a7dee158b786c30b6a6e38}{hwloc\+\_\+topology\+\_\+t} topology, hwloc\+\_\+pid\+\_\+t pid, \hyperlink{group__hwlocality__sets_ga4bbf39b68b6f568fb92739e7c0ea7801}{hwloc\+\_\+cpuset\+\_\+t} set, int flags)
\begin{DoxyCompactList}\small\item\em Get the last physical C\+P\+U where a process ran. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
It is often useful to call \hyperlink{group__hwlocality__bitmap_ga4630aa1b7e08eac5b41be126194e84a1}{hwloc\+\_\+bitmap\+\_\+singlify()} first so that a single C\+P\+U remains in the set. 

This way, the process will not even migrate between different C\+P\+Us. Some operating systems also only support that kind of binding.

\begin{DoxyNote}{Note}
Some operating systems do not provide all hwloc-\/supported mechanisms to bind processes, threads, etc. and the corresponding binding functions may fail. -\/1 is returned and errno is set to E\+N\+O\+S\+Y\+S when it is not possible to bind the requested kind of object processes/threads. errno is set to E\+X\+D\+E\+V when the requested cpuset can not be enforced (e.\+g. some systems only allow one C\+P\+U, and some other systems only allow one N\+U\+M\+A node).
\end{DoxyNote}
The most portable version that should be preferred over the others, whenever possible, is


\begin{DoxyCode}
\hyperlink{group__hwlocality__cpubinding_gaf4cc194d5c0d38004a21b9f03522a7e3}{hwloc\_set\_cpubind}(topology, set, 0),
\end{DoxyCode}


as it just binds the current program, assuming it is single-\/threaded, or


\begin{DoxyCode}
\hyperlink{group__hwlocality__cpubinding_gaf4cc194d5c0d38004a21b9f03522a7e3}{hwloc\_set\_cpubind}(topology, set, \hyperlink{group__hwlocality__cpubinding_gga217dc8d373f8958cc93c154ebce1c71caf1b6bbad00d7b1017b918e3719f4d421}{HWLOC\_CPUBIND\_THREAD}),
\end{DoxyCode}


which binds the current thread of the current program (which may be multithreaded).

\begin{DoxyNote}{Note}
To unbind, just call the binding function with either a full cpuset or a cpuset equal to the system cpuset.

On some operating systems, C\+P\+U binding may have effects on memory binding, see \hyperlink{group__hwlocality__cpubinding_gga217dc8d373f8958cc93c154ebce1c71ca41ce440443cc3087caed95ab60edcad6}{H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+N\+O\+M\+E\+M\+B\+I\+N\+D}
\end{DoxyNote}
Running lstopo --top can be a very convenient tool to check how binding actually happened. 

\subsection{Enumeration Type Documentation}
\hypertarget{group__hwlocality__cpubinding_ga217dc8d373f8958cc93c154ebce1c71c}{\index{C\+P\+U binding@{C\+P\+U binding}!hwloc\+\_\+cpubind\+\_\+flags\+\_\+t@{hwloc\+\_\+cpubind\+\_\+flags\+\_\+t}}
\index{hwloc\+\_\+cpubind\+\_\+flags\+\_\+t@{hwloc\+\_\+cpubind\+\_\+flags\+\_\+t}!C\+P\+U binding@{C\+P\+U binding}}
\subsubsection[{hwloc\+\_\+cpubind\+\_\+flags\+\_\+t}]{\setlength{\rightskip}{0pt plus 5cm}enum {\bf hwloc\+\_\+cpubind\+\_\+flags\+\_\+t}}}\label{group__hwlocality__cpubinding_ga217dc8d373f8958cc93c154ebce1c71c}


Process/\+Thread binding flags. 

These bit flags can be used to refine the binding policy.

The default (0) is to bind the current process, assumed to be single-\/threaded, in a non-\/strict way. This is the most portable way to bind as all operating systems usually provide it.

\begin{DoxyNote}{Note}
Not all systems support all kinds of binding. See the \char`\"{}\+Detailed Description\char`\"{} section of \hyperlink{group__hwlocality__cpubinding}{C\+P\+U binding} for a description of errors that can occur. 
\end{DoxyNote}
\begin{Desc}
\item[Enumerator]\par
\begin{description}
\index{H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+P\+R\+O\+C\+E\+S\+S@{H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+P\+R\+O\+C\+E\+S\+S}!C\+P\+U binding@{C\+P\+U binding}}\index{C\+P\+U binding@{C\+P\+U binding}!H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+P\+R\+O\+C\+E\+S\+S@{H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+P\+R\+O\+C\+E\+S\+S}}\item[{\em 
\hypertarget{group__hwlocality__cpubinding_gga217dc8d373f8958cc93c154ebce1c71ca2e0dd0128dac6b03408c7dd170477fdc}{H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+P\+R\+O\+C\+E\+S\+S}\label{group__hwlocality__cpubinding_gga217dc8d373f8958cc93c154ebce1c71ca2e0dd0128dac6b03408c7dd170477fdc}
}]Bind all threads of the current (possibly) multithreaded process. \index{H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+T\+H\+R\+E\+A\+D@{H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+T\+H\+R\+E\+A\+D}!C\+P\+U binding@{C\+P\+U binding}}\index{C\+P\+U binding@{C\+P\+U binding}!H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+T\+H\+R\+E\+A\+D@{H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+T\+H\+R\+E\+A\+D}}\item[{\em 
\hypertarget{group__hwlocality__cpubinding_gga217dc8d373f8958cc93c154ebce1c71caf1b6bbad00d7b1017b918e3719f4d421}{H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+T\+H\+R\+E\+A\+D}\label{group__hwlocality__cpubinding_gga217dc8d373f8958cc93c154ebce1c71caf1b6bbad00d7b1017b918e3719f4d421}
}]Bind current thread of current process. \index{H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+S\+T\+R\+I\+C\+T@{H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+S\+T\+R\+I\+C\+T}!C\+P\+U binding@{C\+P\+U binding}}\index{C\+P\+U binding@{C\+P\+U binding}!H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+S\+T\+R\+I\+C\+T@{H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+S\+T\+R\+I\+C\+T}}\item[{\em 
\hypertarget{group__hwlocality__cpubinding_gga217dc8d373f8958cc93c154ebce1c71ca679a7e0f0c7ee06b123565f90d98e7fa}{H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+S\+T\+R\+I\+C\+T}\label{group__hwlocality__cpubinding_gga217dc8d373f8958cc93c154ebce1c71ca679a7e0f0c7ee06b123565f90d98e7fa}
}]\hyperlink{classRequest}{Request} for strict binding from the O\+S. By default, when the designated C\+P\+Us are all busy while other C\+P\+Us are idle, operating systems may execute the thread/process on those other C\+P\+Us instead of the designated C\+P\+Us, to let them progress anyway. Strict binding means that the thread/process will {\itshape never} execute on other cpus than the designated C\+P\+Us, even when those are busy with other tasks and other C\+P\+Us are idle.

\begin{DoxyNote}{Note}
Depending on the operating system, strict binding may not be possible (e.\+g., the O\+S does not implement it) or not allowed (e.\+g., for an administrative reasons), and the function will fail in that case.
\end{DoxyNote}
When retrieving the binding of a process, this flag checks whether all its threads actually have the same binding. If the flag is not given, the binding of each thread will be accumulated.

\begin{DoxyNote}{Note}
This flag is meaningless when retrieving the binding of a thread. 
\end{DoxyNote}
\index{H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+N\+O\+M\+E\+M\+B\+I\+N\+D@{H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+N\+O\+M\+E\+M\+B\+I\+N\+D}!C\+P\+U binding@{C\+P\+U binding}}\index{C\+P\+U binding@{C\+P\+U binding}!H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+N\+O\+M\+E\+M\+B\+I\+N\+D@{H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+N\+O\+M\+E\+M\+B\+I\+N\+D}}\item[{\em 
\hypertarget{group__hwlocality__cpubinding_gga217dc8d373f8958cc93c154ebce1c71ca41ce440443cc3087caed95ab60edcad6}{H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+N\+O\+M\+E\+M\+B\+I\+N\+D}\label{group__hwlocality__cpubinding_gga217dc8d373f8958cc93c154ebce1c71ca41ce440443cc3087caed95ab60edcad6}
}]Avoid any effect on memory binding. On some operating systems, some C\+P\+U binding function would also bind the memory on the corresponding N\+U\+M\+A node. It is often not a problem for the application, but if it is, setting this flag will make hwloc avoid using O\+S functions that would also bind memory. This will however reduce the support of C\+P\+U bindings, i.\+e. potentially return -\/1 with errno set to E\+N\+O\+S\+Y\+S in some cases.

This flag is only meaningful when used with functions that set the C\+P\+U binding. It is ignored when used with functions that get C\+P\+U binding information. \end{description}
\end{Desc}


\subsection{Function Documentation}
\hypertarget{group__hwlocality__cpubinding_gab52f83ab16eac465da55e16bdd30df77}{\index{C\+P\+U binding@{C\+P\+U binding}!hwloc\+\_\+get\+\_\+cpubind@{hwloc\+\_\+get\+\_\+cpubind}}
\index{hwloc\+\_\+get\+\_\+cpubind@{hwloc\+\_\+get\+\_\+cpubind}!C\+P\+U binding@{C\+P\+U binding}}
\subsubsection[{hwloc\+\_\+get\+\_\+cpubind}]{\setlength{\rightskip}{0pt plus 5cm}H\+W\+L\+O\+C\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int hwloc\+\_\+get\+\_\+cpubind (
\begin{DoxyParamCaption}
\item[{{\bf hwloc\+\_\+topology\+\_\+t}}]{topology, }
\item[{{\bf hwloc\+\_\+cpuset\+\_\+t}}]{set, }
\item[{int}]{flags}
\end{DoxyParamCaption}
)}}\label{group__hwlocality__cpubinding_gab52f83ab16eac465da55e16bdd30df77}


Get current process or thread binding. 

Writes into {\ttfamily set} the physical cpuset which the process or thread (according to {\itshape flags}) was last bound to. 

References H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+P\+R\+O\+C\+E\+S\+S, and H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+T\+H\+R\+E\+A\+D.



Referenced by ompi\+\_\+mpi\+\_\+init().

\hypertarget{group__hwlocality__cpubinding_ga8e9a4b5ee3eaa18fd3a229790c6b5b17}{\index{C\+P\+U binding@{C\+P\+U binding}!hwloc\+\_\+get\+\_\+last\+\_\+cpu\+\_\+location@{hwloc\+\_\+get\+\_\+last\+\_\+cpu\+\_\+location}}
\index{hwloc\+\_\+get\+\_\+last\+\_\+cpu\+\_\+location@{hwloc\+\_\+get\+\_\+last\+\_\+cpu\+\_\+location}!C\+P\+U binding@{C\+P\+U binding}}
\subsubsection[{hwloc\+\_\+get\+\_\+last\+\_\+cpu\+\_\+location}]{\setlength{\rightskip}{0pt plus 5cm}H\+W\+L\+O\+C\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int hwloc\+\_\+get\+\_\+last\+\_\+cpu\+\_\+location (
\begin{DoxyParamCaption}
\item[{{\bf hwloc\+\_\+topology\+\_\+t}}]{topology, }
\item[{{\bf hwloc\+\_\+cpuset\+\_\+t}}]{set, }
\item[{int}]{flags}
\end{DoxyParamCaption}
)}}\label{group__hwlocality__cpubinding_ga8e9a4b5ee3eaa18fd3a229790c6b5b17}


Get the last physical C\+P\+U where the current process or thread ran. 

The operating system may move some tasks from one processor to another at any time according to their binding, so this function may return something that is already outdated. 

References H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+P\+R\+O\+C\+E\+S\+S, and H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+T\+H\+R\+E\+A\+D.

\hypertarget{group__hwlocality__cpubinding_gaa1373a002b9a0a87eb002e26c590f2da}{\index{C\+P\+U binding@{C\+P\+U binding}!hwloc\+\_\+get\+\_\+proc\+\_\+cpubind@{hwloc\+\_\+get\+\_\+proc\+\_\+cpubind}}
\index{hwloc\+\_\+get\+\_\+proc\+\_\+cpubind@{hwloc\+\_\+get\+\_\+proc\+\_\+cpubind}!C\+P\+U binding@{C\+P\+U binding}}
\subsubsection[{hwloc\+\_\+get\+\_\+proc\+\_\+cpubind}]{\setlength{\rightskip}{0pt plus 5cm}H\+W\+L\+O\+C\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int hwloc\+\_\+get\+\_\+proc\+\_\+cpubind (
\begin{DoxyParamCaption}
\item[{{\bf hwloc\+\_\+topology\+\_\+t}}]{topology, }
\item[{hwloc\+\_\+pid\+\_\+t}]{pid, }
\item[{{\bf hwloc\+\_\+cpuset\+\_\+t}}]{set, }
\item[{int}]{flags}
\end{DoxyParamCaption}
)}}\label{group__hwlocality__cpubinding_gaa1373a002b9a0a87eb002e26c590f2da}


Get the current physical binding of process {\ttfamily pid}. 

\begin{DoxyNote}{Note}
{\ttfamily hwloc\+\_\+pid\+\_\+t} is {\ttfamily pid\+\_\+t} on Unix platforms, and {\ttfamily H\+A\+N\+D\+L\+E} on native Windows platforms.

H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+T\+H\+R\+E\+A\+D can not be used in {\ttfamily flags}.

As a special case on Linux, if a tid (thread I\+D) is supplied instead of a pid (process I\+D), the binding for that specific thread is returned. 
\end{DoxyNote}
\hypertarget{group__hwlocality__cpubinding_ga1e005ddb9701e6a993a9eb8abe67a710}{\index{C\+P\+U binding@{C\+P\+U binding}!hwloc\+\_\+get\+\_\+proc\+\_\+last\+\_\+cpu\+\_\+location@{hwloc\+\_\+get\+\_\+proc\+\_\+last\+\_\+cpu\+\_\+location}}
\index{hwloc\+\_\+get\+\_\+proc\+\_\+last\+\_\+cpu\+\_\+location@{hwloc\+\_\+get\+\_\+proc\+\_\+last\+\_\+cpu\+\_\+location}!C\+P\+U binding@{C\+P\+U binding}}
\subsubsection[{hwloc\+\_\+get\+\_\+proc\+\_\+last\+\_\+cpu\+\_\+location}]{\setlength{\rightskip}{0pt plus 5cm}H\+W\+L\+O\+C\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int hwloc\+\_\+get\+\_\+proc\+\_\+last\+\_\+cpu\+\_\+location (
\begin{DoxyParamCaption}
\item[{{\bf hwloc\+\_\+topology\+\_\+t}}]{topology, }
\item[{hwloc\+\_\+pid\+\_\+t}]{pid, }
\item[{{\bf hwloc\+\_\+cpuset\+\_\+t}}]{set, }
\item[{int}]{flags}
\end{DoxyParamCaption}
)}}\label{group__hwlocality__cpubinding_ga1e005ddb9701e6a993a9eb8abe67a710}


Get the last physical C\+P\+U where a process ran. 

The operating system may move some tasks from one processor to another at any time according to their binding, so this function may return something that is already outdated.

\begin{DoxyNote}{Note}
{\ttfamily hwloc\+\_\+pid\+\_\+t} is {\ttfamily pid\+\_\+t} on Unix platforms, and {\ttfamily H\+A\+N\+D\+L\+E} on native Windows platforms.

H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+T\+H\+R\+E\+A\+D can not be used in {\ttfamily flags}.

As a special case on Linux, if a tid (thread I\+D) is supplied instead of a pid (process I\+D), the binding for that specific thread is returned. 
\end{DoxyNote}
\hypertarget{group__hwlocality__cpubinding_gaf4cc194d5c0d38004a21b9f03522a7e3}{\index{C\+P\+U binding@{C\+P\+U binding}!hwloc\+\_\+set\+\_\+cpubind@{hwloc\+\_\+set\+\_\+cpubind}}
\index{hwloc\+\_\+set\+\_\+cpubind@{hwloc\+\_\+set\+\_\+cpubind}!C\+P\+U binding@{C\+P\+U binding}}
\subsubsection[{hwloc\+\_\+set\+\_\+cpubind}]{\setlength{\rightskip}{0pt plus 5cm}H\+W\+L\+O\+C\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int hwloc\+\_\+set\+\_\+cpubind (
\begin{DoxyParamCaption}
\item[{{\bf hwloc\+\_\+topology\+\_\+t}}]{topology, }
\item[{{\bf hwloc\+\_\+const\+\_\+cpuset\+\_\+t}}]{set, }
\item[{int}]{flags}
\end{DoxyParamCaption}
)}}\label{group__hwlocality__cpubinding_gaf4cc194d5c0d38004a21b9f03522a7e3}


Bind current process or thread on cpus given in physical bitmap {\ttfamily set}. 

\begin{DoxyReturn}{Returns}
-\/1 with errno set to E\+N\+O\+S\+Y\+S if the action is not supported 

-\/1 with errno set to E\+X\+D\+E\+V if the binding cannot be enforced 
\end{DoxyReturn}


References H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+P\+R\+O\+C\+E\+S\+S, and H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+T\+H\+R\+E\+A\+D.



Referenced by ompi\+\_\+mpi\+\_\+init().

\hypertarget{group__hwlocality__cpubinding_gac0ef3510b4e9c1273029ecf94e8c9686}{\index{C\+P\+U binding@{C\+P\+U binding}!hwloc\+\_\+set\+\_\+proc\+\_\+cpubind@{hwloc\+\_\+set\+\_\+proc\+\_\+cpubind}}
\index{hwloc\+\_\+set\+\_\+proc\+\_\+cpubind@{hwloc\+\_\+set\+\_\+proc\+\_\+cpubind}!C\+P\+U binding@{C\+P\+U binding}}
\subsubsection[{hwloc\+\_\+set\+\_\+proc\+\_\+cpubind}]{\setlength{\rightskip}{0pt plus 5cm}H\+W\+L\+O\+C\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int hwloc\+\_\+set\+\_\+proc\+\_\+cpubind (
\begin{DoxyParamCaption}
\item[{{\bf hwloc\+\_\+topology\+\_\+t}}]{topology, }
\item[{hwloc\+\_\+pid\+\_\+t}]{pid, }
\item[{{\bf hwloc\+\_\+const\+\_\+cpuset\+\_\+t}}]{set, }
\item[{int}]{flags}
\end{DoxyParamCaption}
)}}\label{group__hwlocality__cpubinding_gac0ef3510b4e9c1273029ecf94e8c9686}


Bind a process {\ttfamily pid} on cpus given in physical bitmap {\ttfamily set}. 

\begin{DoxyNote}{Note}
{\ttfamily hwloc\+\_\+pid\+\_\+t} is {\ttfamily pid\+\_\+t} on Unix platforms, and {\ttfamily H\+A\+N\+D\+L\+E} on native Windows platforms.

H\+W\+L\+O\+C\+\_\+\+C\+P\+U\+B\+I\+N\+D\+\_\+\+T\+H\+R\+E\+A\+D can not be used in {\ttfamily flags}. 
\end{DoxyNote}
