\hypertarget{maffinity_8h}{\section{opal/mca/maffinity/maffinity.h File Reference}
\label{maffinity_8h}\index{opal/mca/maffinity/maffinity.\+h@{opal/mca/maffinity/maffinity.\+h}}
}


maffinity (memory affinity) framework component interface definitions.  


{\ttfamily \#include \char`\"{}opal\+\_\+config.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}opal/mca/mca.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}opal/mca/base/base.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}opal/mca/maffinity/maffinity\+\_\+types.\+h\char`\"{}}\\*
\subsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{structopal__maffinity__base__component__2__0__0__t}{opal\+\_\+maffinity\+\_\+base\+\_\+component\+\_\+2\+\_\+0\+\_\+0\+\_\+t}
\begin{DoxyCompactList}\small\item\em Structure for maffinity components. \end{DoxyCompactList}\item 
struct \hyperlink{structopal__maffinity__base__module__1__0__0__t}{opal\+\_\+maffinity\+\_\+base\+\_\+module\+\_\+1\+\_\+0\+\_\+0\+\_\+t}
\begin{DoxyCompactList}\small\item\em Structure for maffinity modules. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define {\bfseries O\+P\+A\+L\+\_\+\+M\+A\+F\+F\+I\+N\+I\+T\+Y\+\_\+\+B\+A\+S\+E\+\_\+\+V\+E\+R\+S\+I\+O\+N\+\_\+2\+\_\+0\+\_\+0}
\end{DoxyCompactItemize}
\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
typedef int($\ast$ \hyperlink{maffinity_8h_aaec12c34631d5b80c4829e3e93421ad0}{opal\+\_\+maffinity\+\_\+base\+\_\+module\+\_\+init\+\_\+1\+\_\+0\+\_\+0\+\_\+fn\+\_\+t} )(void)
\begin{DoxyCompactList}\small\item\em Module initialization function. \end{DoxyCompactList}\item 
typedef int($\ast$ \hyperlink{maffinity_8h_a4aa130a2f70f773c8956fd21e430c5d0}{opal\+\_\+maffinity\+\_\+base\+\_\+module\+\_\+set\+\_\+fn\+\_\+t} )(\hyperlink{structopal__maffinity__base__segment__t}{opal\+\_\+maffinity\+\_\+base\+\_\+segment\+\_\+t} $\ast$segments, size\+\_\+t num\+\_\+segments)
\begin{DoxyCompactList}\small\item\em Module function to set memory affinity. \end{DoxyCompactList}\item 
\hypertarget{maffinity_8h_a8b8584062d030728ae574a2238a6eb7e}{typedef int($\ast$ \hyperlink{maffinity_8h_a8b8584062d030728ae574a2238a6eb7e}{opal\+\_\+maffinity\+\_\+base\+\_\+module\+\_\+node\+\_\+name\+\_\+to\+\_\+id\+\_\+fn\+\_\+t} )(char $\ast$node\+\_\+name, int $\ast$node\+\_\+id)}\label{maffinity_8h_a8b8584062d030728ae574a2238a6eb7e}

\begin{DoxyCompactList}\small\item\em translate memory node name (such as \char`\"{}mem0\char`\"{}) to memory node id \end{DoxyCompactList}\item 
\hypertarget{maffinity_8h_a5ca9c372085b4bb03675c9c22e468bf1}{typedef int($\ast$ \hyperlink{maffinity_8h_a5ca9c372085b4bb03675c9c22e468bf1}{opal\+\_\+maffinity\+\_\+base\+\_\+module\+\_\+bind\+\_\+fn\+\_\+t} )(\hyperlink{structopal__maffinity__base__segment__t}{opal\+\_\+maffinity\+\_\+base\+\_\+segment\+\_\+t} $\ast$segments, size\+\_\+t num\+\_\+segments, int node\+\_\+id)}\label{maffinity_8h_a5ca9c372085b4bb03675c9c22e468bf1}

\begin{DoxyCompactList}\small\item\em bind memory to node \end{DoxyCompactList}\item 
\hypertarget{maffinity_8h_a8d340204b2ee8d9bf58554692fbc4044}{typedef struct \\*
\hyperlink{structopal__maffinity__base__component__2__0__0__t}{opal\+\_\+maffinity\+\_\+base\+\_\+component\+\_\+2\+\_\+0\+\_\+0\+\_\+t} \hyperlink{maffinity_8h_a8d340204b2ee8d9bf58554692fbc4044}{opal\+\_\+maffinity\+\_\+base\+\_\+component\+\_\+2\+\_\+0\+\_\+0\+\_\+t}}\label{maffinity_8h_a8d340204b2ee8d9bf58554692fbc4044}

\begin{DoxyCompactList}\small\item\em Convenience typedef. \end{DoxyCompactList}\item 
\hypertarget{maffinity_8h_a9c093730320ff48f3d44eceda7693a66}{typedef struct \\*
\hyperlink{structopal__maffinity__base__module__1__0__0__t}{opal\+\_\+maffinity\+\_\+base\+\_\+module\+\_\+1\+\_\+0\+\_\+0\+\_\+t} \hyperlink{maffinity_8h_a9c093730320ff48f3d44eceda7693a66}{opal\+\_\+maffinity\+\_\+base\+\_\+module\+\_\+1\+\_\+0\+\_\+0\+\_\+t}}\label{maffinity_8h_a9c093730320ff48f3d44eceda7693a66}

\begin{DoxyCompactList}\small\item\em Convenience typedef. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
maffinity (memory affinity) framework component interface definitions. 

Intent

Simple component to set memory affinity for pages. Note that this framework assumes that processor affinity is being used (it doesn't make much sense to use memory affinity unless processes are bound to specific processors, otherwise the processes may move around and the memory may end up being remote).

maffinity components are typically used with shared memory operations, but can be used elsewhere as well. The idea is to get memory physically located with the process that is going to use it. For memory allocated to a processor-\/bound process, functions such as malloc() do this naturally. However, when working with memory shared by multiple processes on a N\+U\+M\+A machine, it can be extremely advantageous to ensure that pages containing the data structures for a given process are physically local to the processor where that process is bound.

One process will allocate a large shared memory block and all will need to participate to make pages local to specific processors.

There is one main module function (opal\+\_\+maffinity\+\_\+base\+\_\+module\+\_\+set\+\_\+fn\+\_\+t) that takes an array of segment descriptions within the block. Each process will get a different set of segment descriptions (i.\+e., the segments belonging to that process). Components then do whatever is necessary to make pages local to their respective processes (i.\+e., the processors where the processes are running). 

\subsection{Macro Definition Documentation}
\hypertarget{maffinity_8h_a05fbba74dc3a34a66c2bb495b25d768e}{\index{maffinity.\+h@{maffinity.\+h}!O\+P\+A\+L\+\_\+\+M\+A\+F\+F\+I\+N\+I\+T\+Y\+\_\+\+B\+A\+S\+E\+\_\+\+V\+E\+R\+S\+I\+O\+N\+\_\+2\+\_\+0\+\_\+0@{O\+P\+A\+L\+\_\+\+M\+A\+F\+F\+I\+N\+I\+T\+Y\+\_\+\+B\+A\+S\+E\+\_\+\+V\+E\+R\+S\+I\+O\+N\+\_\+2\+\_\+0\+\_\+0}}
\index{O\+P\+A\+L\+\_\+\+M\+A\+F\+F\+I\+N\+I\+T\+Y\+\_\+\+B\+A\+S\+E\+\_\+\+V\+E\+R\+S\+I\+O\+N\+\_\+2\+\_\+0\+\_\+0@{O\+P\+A\+L\+\_\+\+M\+A\+F\+F\+I\+N\+I\+T\+Y\+\_\+\+B\+A\+S\+E\+\_\+\+V\+E\+R\+S\+I\+O\+N\+\_\+2\+\_\+0\+\_\+0}!maffinity.\+h@{maffinity.\+h}}
\subsubsection[{O\+P\+A\+L\+\_\+\+M\+A\+F\+F\+I\+N\+I\+T\+Y\+\_\+\+B\+A\+S\+E\+\_\+\+V\+E\+R\+S\+I\+O\+N\+\_\+2\+\_\+0\+\_\+0}]{\setlength{\rightskip}{0pt plus 5cm}\#define O\+P\+A\+L\+\_\+\+M\+A\+F\+F\+I\+N\+I\+T\+Y\+\_\+\+B\+A\+S\+E\+\_\+\+V\+E\+R\+S\+I\+O\+N\+\_\+2\+\_\+0\+\_\+0}}\label{maffinity_8h_a05fbba74dc3a34a66c2bb495b25d768e}
{\bfseries Value\+:}
\begin{DoxyCode}
MCA\_BASE\_VERSION\_2\_0\_0, \(\backslash\)
    \textcolor{stringliteral}{"maffinity"}, 2, 0, 0
\end{DoxyCode}


\subsection{Typedef Documentation}
\hypertarget{maffinity_8h_aaec12c34631d5b80c4829e3e93421ad0}{\index{maffinity.\+h@{maffinity.\+h}!opal\+\_\+maffinity\+\_\+base\+\_\+module\+\_\+init\+\_\+1\+\_\+0\+\_\+0\+\_\+fn\+\_\+t@{opal\+\_\+maffinity\+\_\+base\+\_\+module\+\_\+init\+\_\+1\+\_\+0\+\_\+0\+\_\+fn\+\_\+t}}
\index{opal\+\_\+maffinity\+\_\+base\+\_\+module\+\_\+init\+\_\+1\+\_\+0\+\_\+0\+\_\+fn\+\_\+t@{opal\+\_\+maffinity\+\_\+base\+\_\+module\+\_\+init\+\_\+1\+\_\+0\+\_\+0\+\_\+fn\+\_\+t}!maffinity.\+h@{maffinity.\+h}}
\subsubsection[{opal\+\_\+maffinity\+\_\+base\+\_\+module\+\_\+init\+\_\+1\+\_\+0\+\_\+0\+\_\+fn\+\_\+t}]{\setlength{\rightskip}{0pt plus 5cm}typedef int($\ast$ opal\+\_\+maffinity\+\_\+base\+\_\+module\+\_\+init\+\_\+1\+\_\+0\+\_\+0\+\_\+fn\+\_\+t)(void)}}\label{maffinity_8h_aaec12c34631d5b80c4829e3e93421ad0}


Module initialization function. 

Should return O\+P\+A\+L\+\_\+\+S\+U\+C\+C\+E\+S\+S. \hypertarget{maffinity_8h_a4aa130a2f70f773c8956fd21e430c5d0}{\index{maffinity.\+h@{maffinity.\+h}!opal\+\_\+maffinity\+\_\+base\+\_\+module\+\_\+set\+\_\+fn\+\_\+t@{opal\+\_\+maffinity\+\_\+base\+\_\+module\+\_\+set\+\_\+fn\+\_\+t}}
\index{opal\+\_\+maffinity\+\_\+base\+\_\+module\+\_\+set\+\_\+fn\+\_\+t@{opal\+\_\+maffinity\+\_\+base\+\_\+module\+\_\+set\+\_\+fn\+\_\+t}!maffinity.\+h@{maffinity.\+h}}
\subsubsection[{opal\+\_\+maffinity\+\_\+base\+\_\+module\+\_\+set\+\_\+fn\+\_\+t}]{\setlength{\rightskip}{0pt plus 5cm}typedef int($\ast$ opal\+\_\+maffinity\+\_\+base\+\_\+module\+\_\+set\+\_\+fn\+\_\+t)({\bf opal\+\_\+maffinity\+\_\+base\+\_\+segment\+\_\+t} $\ast$segments, size\+\_\+t num\+\_\+segments)}}\label{maffinity_8h_a4aa130a2f70f773c8956fd21e430c5d0}


Module function to set memory affinity. 

Take an array of maffinity\+\_\+base\+\_\+segment\+\_\+t instances to describe which memory should physically reside with which process.

This function is intended to be invoked by each process immediately after they mmap / attach the shared memory. In some cases, it will be a no-\/op for some processes (i.\+e., machines where a single function call in the creating process sets the memory affinity for the entire region), but in other cases all processes will need to participate (e.\+g., the first\+\_\+use component, each each process will \char`\"{}touch\char`\"{} the pages that are supposed to be local to them). 