\hypertarget{group__hwlocality__linux}{\section{Linux-\/only helpers}
\label{group__hwlocality__linux}\index{Linux-\/only helpers@{Linux-\/only helpers}}
}


This includes helpers for manipulating linux kernel cpumap files, and hwloc equivalents of the Linux sched\+\_\+setaffinity and sched\+\_\+getaffinity system calls.  


\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
H\+W\+L\+O\+C\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int \hyperlink{group__hwlocality__linux_gaeacad897c30dbea284948374ad4b010c}{hwloc\+\_\+linux\+\_\+parse\+\_\+cpumap\+\_\+file} (F\+I\+L\+E $\ast$file, \hyperlink{group__hwlocality__sets_ga4bbf39b68b6f568fb92739e7c0ea7801}{hwloc\+\_\+cpuset\+\_\+t} set)
\begin{DoxyCompactList}\small\item\em Convert a linux kernel cpumap file {\ttfamily file} into hwloc C\+P\+U set. \end{DoxyCompactList}\item 
H\+W\+L\+O\+C\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int \hyperlink{group__hwlocality__linux_gaaaca5d1687053b6c3326b2c165bd6530}{hwloc\+\_\+linux\+\_\+set\+\_\+tid\+\_\+cpubind} (\hyperlink{group__hwlocality__topology_ga9d1e76ee15a7dee158b786c30b6a6e38}{hwloc\+\_\+topology\+\_\+t} topology, pid\+\_\+t tid, \hyperlink{group__hwlocality__sets_ga1f784433e9b606261f62d1134f6a3b25}{hwloc\+\_\+const\+\_\+cpuset\+\_\+t} set)
\begin{DoxyCompactList}\small\item\em Bind a thread {\ttfamily tid} on cpus given in cpuset {\ttfamily set}. \end{DoxyCompactList}\item 
H\+W\+L\+O\+C\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int \hyperlink{group__hwlocality__linux_gaf36a9211a21eb930f59090eb5d460b8e}{hwloc\+\_\+linux\+\_\+get\+\_\+tid\+\_\+cpubind} (\hyperlink{group__hwlocality__topology_ga9d1e76ee15a7dee158b786c30b6a6e38}{hwloc\+\_\+topology\+\_\+t} topology, pid\+\_\+t tid, \hyperlink{group__hwlocality__sets_ga4bbf39b68b6f568fb92739e7c0ea7801}{hwloc\+\_\+cpuset\+\_\+t} set)
\begin{DoxyCompactList}\small\item\em Get the current binding of thread {\ttfamily tid}. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
This includes helpers for manipulating linux kernel cpumap files, and hwloc equivalents of the Linux sched\+\_\+setaffinity and sched\+\_\+getaffinity system calls. 



\subsection{Function Documentation}
\hypertarget{group__hwlocality__linux_gaf36a9211a21eb930f59090eb5d460b8e}{\index{Linux-\/only helpers@{Linux-\/only helpers}!hwloc\+\_\+linux\+\_\+get\+\_\+tid\+\_\+cpubind@{hwloc\+\_\+linux\+\_\+get\+\_\+tid\+\_\+cpubind}}
\index{hwloc\+\_\+linux\+\_\+get\+\_\+tid\+\_\+cpubind@{hwloc\+\_\+linux\+\_\+get\+\_\+tid\+\_\+cpubind}!Linux-\/only helpers@{Linux-\/only helpers}}
\subsubsection[{hwloc\+\_\+linux\+\_\+get\+\_\+tid\+\_\+cpubind}]{\setlength{\rightskip}{0pt plus 5cm}H\+W\+L\+O\+C\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int hwloc\+\_\+linux\+\_\+get\+\_\+tid\+\_\+cpubind (
\begin{DoxyParamCaption}
\item[{{\bf hwloc\+\_\+topology\+\_\+t}}]{topology, }
\item[{pid\+\_\+t}]{tid, }
\item[{{\bf hwloc\+\_\+cpuset\+\_\+t}}]{set}
\end{DoxyParamCaption}
)}}\label{group__hwlocality__linux_gaf36a9211a21eb930f59090eb5d460b8e}


Get the current binding of thread {\ttfamily tid}. 

The behavior is exactly the same as the Linux sched\+\_\+getaffinity system call, but uses a hwloc cpuset. \hypertarget{group__hwlocality__linux_gaeacad897c30dbea284948374ad4b010c}{\index{Linux-\/only helpers@{Linux-\/only helpers}!hwloc\+\_\+linux\+\_\+parse\+\_\+cpumap\+\_\+file@{hwloc\+\_\+linux\+\_\+parse\+\_\+cpumap\+\_\+file}}
\index{hwloc\+\_\+linux\+\_\+parse\+\_\+cpumap\+\_\+file@{hwloc\+\_\+linux\+\_\+parse\+\_\+cpumap\+\_\+file}!Linux-\/only helpers@{Linux-\/only helpers}}
\subsubsection[{hwloc\+\_\+linux\+\_\+parse\+\_\+cpumap\+\_\+file}]{\setlength{\rightskip}{0pt plus 5cm}H\+W\+L\+O\+C\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int hwloc\+\_\+linux\+\_\+parse\+\_\+cpumap\+\_\+file (
\begin{DoxyParamCaption}
\item[{F\+I\+L\+E $\ast$}]{file, }
\item[{{\bf hwloc\+\_\+cpuset\+\_\+t}}]{set}
\end{DoxyParamCaption}
)}}\label{group__hwlocality__linux_gaeacad897c30dbea284948374ad4b010c}


Convert a linux kernel cpumap file {\ttfamily file} into hwloc C\+P\+U set. 

Might be used when reading C\+P\+U set from sysfs attributes such as topology and caches for processors, or local\+\_\+cpus for devices. 

References hwloc\+\_\+bitmap\+\_\+set\+\_\+ith\+\_\+ulong(), and hwloc\+\_\+bitmap\+\_\+zero().



Referenced by hwloc\+\_\+cuda\+\_\+get\+\_\+device\+\_\+cpuset(), hwloc\+\_\+cudart\+\_\+get\+\_\+device\+\_\+cpuset(), and hwloc\+\_\+ibv\+\_\+get\+\_\+device\+\_\+cpuset().

\hypertarget{group__hwlocality__linux_gaaaca5d1687053b6c3326b2c165bd6530}{\index{Linux-\/only helpers@{Linux-\/only helpers}!hwloc\+\_\+linux\+\_\+set\+\_\+tid\+\_\+cpubind@{hwloc\+\_\+linux\+\_\+set\+\_\+tid\+\_\+cpubind}}
\index{hwloc\+\_\+linux\+\_\+set\+\_\+tid\+\_\+cpubind@{hwloc\+\_\+linux\+\_\+set\+\_\+tid\+\_\+cpubind}!Linux-\/only helpers@{Linux-\/only helpers}}
\subsubsection[{hwloc\+\_\+linux\+\_\+set\+\_\+tid\+\_\+cpubind}]{\setlength{\rightskip}{0pt plus 5cm}H\+W\+L\+O\+C\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int hwloc\+\_\+linux\+\_\+set\+\_\+tid\+\_\+cpubind (
\begin{DoxyParamCaption}
\item[{{\bf hwloc\+\_\+topology\+\_\+t}}]{topology, }
\item[{pid\+\_\+t}]{tid, }
\item[{{\bf hwloc\+\_\+const\+\_\+cpuset\+\_\+t}}]{set}
\end{DoxyParamCaption}
)}}\label{group__hwlocality__linux_gaaaca5d1687053b6c3326b2c165bd6530}


Bind a thread {\ttfamily tid} on cpus given in cpuset {\ttfamily set}. 

The behavior is exactly the same as the Linux sched\+\_\+setaffinity system call, but uses a hwloc cpuset. 