\hypertarget{mpool__gpusm__module_8c}{\section{ompi/mca/mpool/gpusm/mpool\+\_\+gpusm\+\_\+module.c File Reference}
\label{mpool__gpusm__module_8c}\index{ompi/mca/mpool/gpusm/mpool\+\_\+gpusm\+\_\+module.\+c@{ompi/mca/mpool/gpusm/mpool\+\_\+gpusm\+\_\+module.\+c}}
}


This file implements a simple memory pool that is used by the G\+P\+U buffer on the sending side.  


{\ttfamily \#include \char`\"{}ompi\+\_\+config.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}ompi/mca/mpool/base/base.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}ompi/mca/mpool/gpusm/mpool\+\_\+gpusm.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}ompi/runtime/params.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}ompi/mca/common/cuda/common\+\_\+cuda.\+h\char`\"{}}\\*
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
static void \hyperlink{mpool__gpusm__module_8c_a32abd60c7f7fbd9a67d8589e3c9aa4f5}{mca\+\_\+mpool\+\_\+gpusm\+\_\+registration\+\_\+constructor} (\hyperlink{structmca__mpool__gpusm__registration__t}{mca\+\_\+mpool\+\_\+gpusm\+\_\+registration\+\_\+t} $\ast$item)
\begin{DoxyCompactList}\small\item\em Called when the registration free list is created. \end{DoxyCompactList}\item 
static void \hyperlink{mpool__gpusm__module_8c_a794720616a739facd649002abdd9bcf5}{mca\+\_\+mpool\+\_\+gpusm\+\_\+registration\+\_\+destructor} (\hyperlink{structmca__mpool__gpusm__registration__t}{mca\+\_\+mpool\+\_\+gpusm\+\_\+registration\+\_\+t} $\ast$item)
\begin{DoxyCompactList}\small\item\em Called when the program is exiting. \end{DoxyCompactList}\item 
\hypertarget{mpool__gpusm__module_8c_aacffc922f4db795f149ad70c37c1a778}{{\bfseries O\+B\+J\+\_\+\+C\+L\+A\+S\+S\+\_\+\+I\+N\+S\+T\+A\+N\+C\+E} (\hyperlink{structmca__mpool__gpusm__registration__t}{mca\+\_\+mpool\+\_\+gpusm\+\_\+registration\+\_\+t}, \hyperlink{structmca__mpool__base__registration__t}{mca\+\_\+mpool\+\_\+base\+\_\+registration\+\_\+t}, \hyperlink{mpool__gpusm__module_8c_a32abd60c7f7fbd9a67d8589e3c9aa4f5}{mca\+\_\+mpool\+\_\+gpusm\+\_\+registration\+\_\+constructor}, \hyperlink{mpool__gpusm__module_8c_a794720616a739facd649002abdd9bcf5}{mca\+\_\+mpool\+\_\+gpusm\+\_\+registration\+\_\+destructor})}\label{mpool__gpusm__module_8c_aacffc922f4db795f149ad70c37c1a778}

\item 
\hypertarget{mpool__gpusm__module_8c_a5c2f2765cfc9c6d385ef99a4b2d60c00}{void {\bfseries mca\+\_\+mpool\+\_\+gpusm\+\_\+module\+\_\+init} (\hyperlink{structmca__mpool__gpusm__module__t}{mca\+\_\+mpool\+\_\+gpusm\+\_\+module\+\_\+t} $\ast$mpool)}\label{mpool__gpusm__module_8c_a5c2f2765cfc9c6d385ef99a4b2d60c00}

\item 
int \hyperlink{mpool__gpusm__module_8c_a1344c0b11dc40a482f4e62ec67eb05ce}{mca\+\_\+mpool\+\_\+gpusm\+\_\+find} (\hyperlink{structmca__mpool__base__module__t}{mca\+\_\+mpool\+\_\+base\+\_\+module\+\_\+t} $\ast$mpool, void $\ast$addr, size\+\_\+t size, \hyperlink{structmca__mpool__base__registration__t}{mca\+\_\+mpool\+\_\+base\+\_\+registration\+\_\+t} $\ast$$\ast$reg)
\begin{DoxyCompactList}\small\item\em Just go ahead and get a new registration. \end{DoxyCompactList}\item 
\hypertarget{mpool__gpusm__module_8c_a585b7e51663547b9293e9fbdd5914030}{int \hyperlink{mpool__gpusm__module_8c_a585b7e51663547b9293e9fbdd5914030}{mca\+\_\+mpool\+\_\+gpusm\+\_\+register} (\hyperlink{structmca__mpool__base__module__t}{mca\+\_\+mpool\+\_\+base\+\_\+module\+\_\+t} $\ast$mpool, void $\ast$addr, size\+\_\+t size, uint32\+\_\+t flags, \hyperlink{structmca__mpool__base__registration__t}{mca\+\_\+mpool\+\_\+base\+\_\+registration\+\_\+t} $\ast$$\ast$reg)}\label{mpool__gpusm__module_8c_a585b7e51663547b9293e9fbdd5914030}

\begin{DoxyCompactList}\small\item\em register block of memory \end{DoxyCompactList}\item 
\hypertarget{mpool__gpusm__module_8c_ad4af63f67023dd77a14fb35fda300339}{int \hyperlink{mpool__gpusm__module_8c_ad4af63f67023dd77a14fb35fda300339}{mca\+\_\+mpool\+\_\+gpusm\+\_\+deregister} (struct \hyperlink{structmca__mpool__base__module__t}{mca\+\_\+mpool\+\_\+base\+\_\+module\+\_\+t} $\ast$mpool, \hyperlink{structmca__mpool__base__registration__t}{mca\+\_\+mpool\+\_\+base\+\_\+registration\+\_\+t} $\ast$reg)}\label{mpool__gpusm__module_8c_ad4af63f67023dd77a14fb35fda300339}

\begin{DoxyCompactList}\small\item\em deregister memory \end{DoxyCompactList}\item 
void \hyperlink{mpool__gpusm__module_8c_ad18bb731a8d0fcef8a04f308946c3352}{mca\+\_\+mpool\+\_\+gpusm\+\_\+finalize} (struct \hyperlink{structmca__mpool__base__module__t}{mca\+\_\+mpool\+\_\+base\+\_\+module\+\_\+t} $\ast$mpool)
\begin{DoxyCompactList}\small\item\em Free up the resources. \end{DoxyCompactList}\item 
int \hyperlink{mpool__gpusm__module_8c_a68acd912c5ca70450779cdc156e5064c}{mca\+\_\+mpool\+\_\+gpusm\+\_\+ft\+\_\+event} (int state)
\begin{DoxyCompactList}\small\item\em Fault Tolerance Event Notification \hyperlink{structFunction}{Function}. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
This file implements a simple memory pool that is used by the G\+P\+U buffer on the sending side. 

It just gets a memory handle and event handle that can be sent to the remote side which can then use the handles to get access to the memory and the event to determine when it can start accessing the memory. There is no caching of the memory handles as getting new ones is fast. The event handles are cached by the cuda\+\_\+common code. 

\subsection{Function Documentation}
\hypertarget{mpool__gpusm__module_8c_ad18bb731a8d0fcef8a04f308946c3352}{\index{mpool\+\_\+gpusm\+\_\+module.\+c@{mpool\+\_\+gpusm\+\_\+module.\+c}!mca\+\_\+mpool\+\_\+gpusm\+\_\+finalize@{mca\+\_\+mpool\+\_\+gpusm\+\_\+finalize}}
\index{mca\+\_\+mpool\+\_\+gpusm\+\_\+finalize@{mca\+\_\+mpool\+\_\+gpusm\+\_\+finalize}!mpool\+\_\+gpusm\+\_\+module.\+c@{mpool\+\_\+gpusm\+\_\+module.\+c}}
\subsubsection[{mca\+\_\+mpool\+\_\+gpusm\+\_\+finalize}]{\setlength{\rightskip}{0pt plus 5cm}void mca\+\_\+mpool\+\_\+gpusm\+\_\+finalize (
\begin{DoxyParamCaption}
\item[{struct {\bf mca\+\_\+mpool\+\_\+base\+\_\+module\+\_\+t} $\ast$}]{mpool}
\end{DoxyParamCaption}
)}}\label{mpool__gpusm__module_8c_ad18bb731a8d0fcef8a04f308946c3352}


Free up the resources. 

finalize mpool 

References O\+B\+J\+\_\+\+D\+E\+S\+T\+R\+U\+C\+T.

\hypertarget{mpool__gpusm__module_8c_a1344c0b11dc40a482f4e62ec67eb05ce}{\index{mpool\+\_\+gpusm\+\_\+module.\+c@{mpool\+\_\+gpusm\+\_\+module.\+c}!mca\+\_\+mpool\+\_\+gpusm\+\_\+find@{mca\+\_\+mpool\+\_\+gpusm\+\_\+find}}
\index{mca\+\_\+mpool\+\_\+gpusm\+\_\+find@{mca\+\_\+mpool\+\_\+gpusm\+\_\+find}!mpool\+\_\+gpusm\+\_\+module.\+c@{mpool\+\_\+gpusm\+\_\+module.\+c}}
\subsubsection[{mca\+\_\+mpool\+\_\+gpusm\+\_\+find}]{\setlength{\rightskip}{0pt plus 5cm}int mca\+\_\+mpool\+\_\+gpusm\+\_\+find (
\begin{DoxyParamCaption}
\item[{{\bf mca\+\_\+mpool\+\_\+base\+\_\+module\+\_\+t} $\ast$}]{mpool, }
\item[{void $\ast$}]{addr, }
\item[{size\+\_\+t}]{size, }
\item[{{\bf mca\+\_\+mpool\+\_\+base\+\_\+registration\+\_\+t} $\ast$$\ast$}]{reg}
\end{DoxyParamCaption}
)}}\label{mpool__gpusm__module_8c_a1344c0b11dc40a482f4e62ec67eb05ce}


Just go ahead and get a new registration. 

find registration for a given block of memory

The find and register functions are the same thing for this memory pool. 

References mca\+\_\+mpool\+\_\+gpusm\+\_\+register().

\hypertarget{mpool__gpusm__module_8c_a68acd912c5ca70450779cdc156e5064c}{\index{mpool\+\_\+gpusm\+\_\+module.\+c@{mpool\+\_\+gpusm\+\_\+module.\+c}!mca\+\_\+mpool\+\_\+gpusm\+\_\+ft\+\_\+event@{mca\+\_\+mpool\+\_\+gpusm\+\_\+ft\+\_\+event}}
\index{mca\+\_\+mpool\+\_\+gpusm\+\_\+ft\+\_\+event@{mca\+\_\+mpool\+\_\+gpusm\+\_\+ft\+\_\+event}!mpool\+\_\+gpusm\+\_\+module.\+c@{mpool\+\_\+gpusm\+\_\+module.\+c}}
\subsubsection[{mca\+\_\+mpool\+\_\+gpusm\+\_\+ft\+\_\+event}]{\setlength{\rightskip}{0pt plus 5cm}int mca\+\_\+mpool\+\_\+gpusm\+\_\+ft\+\_\+event (
\begin{DoxyParamCaption}
\item[{int}]{state}
\end{DoxyParamCaption}
)}}\label{mpool__gpusm__module_8c_a68acd912c5ca70450779cdc156e5064c}


Fault Tolerance Event Notification \hyperlink{structFunction}{Function}. 


\begin{DoxyParams}{Parameters}
{\em state} & Checkpoint Stae \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
O\+M\+P\+I\+\_\+\+S\+U\+C\+C\+E\+S\+S or failure status 
\end{DoxyReturn}
\hypertarget{mpool__gpusm__module_8c_a32abd60c7f7fbd9a67d8589e3c9aa4f5}{\index{mpool\+\_\+gpusm\+\_\+module.\+c@{mpool\+\_\+gpusm\+\_\+module.\+c}!mca\+\_\+mpool\+\_\+gpusm\+\_\+registration\+\_\+constructor@{mca\+\_\+mpool\+\_\+gpusm\+\_\+registration\+\_\+constructor}}
\index{mca\+\_\+mpool\+\_\+gpusm\+\_\+registration\+\_\+constructor@{mca\+\_\+mpool\+\_\+gpusm\+\_\+registration\+\_\+constructor}!mpool\+\_\+gpusm\+\_\+module.\+c@{mpool\+\_\+gpusm\+\_\+module.\+c}}
\subsubsection[{mca\+\_\+mpool\+\_\+gpusm\+\_\+registration\+\_\+constructor}]{\setlength{\rightskip}{0pt plus 5cm}static void mca\+\_\+mpool\+\_\+gpusm\+\_\+registration\+\_\+constructor (
\begin{DoxyParamCaption}
\item[{{\bf mca\+\_\+mpool\+\_\+gpusm\+\_\+registration\+\_\+t} $\ast$}]{item}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}}\label{mpool__gpusm__module_8c_a32abd60c7f7fbd9a67d8589e3c9aa4f5}


Called when the registration free list is created. 

An event is created for each entry. \hypertarget{mpool__gpusm__module_8c_a794720616a739facd649002abdd9bcf5}{\index{mpool\+\_\+gpusm\+\_\+module.\+c@{mpool\+\_\+gpusm\+\_\+module.\+c}!mca\+\_\+mpool\+\_\+gpusm\+\_\+registration\+\_\+destructor@{mca\+\_\+mpool\+\_\+gpusm\+\_\+registration\+\_\+destructor}}
\index{mca\+\_\+mpool\+\_\+gpusm\+\_\+registration\+\_\+destructor@{mca\+\_\+mpool\+\_\+gpusm\+\_\+registration\+\_\+destructor}!mpool\+\_\+gpusm\+\_\+module.\+c@{mpool\+\_\+gpusm\+\_\+module.\+c}}
\subsubsection[{mca\+\_\+mpool\+\_\+gpusm\+\_\+registration\+\_\+destructor}]{\setlength{\rightskip}{0pt plus 5cm}static void mca\+\_\+mpool\+\_\+gpusm\+\_\+registration\+\_\+destructor (
\begin{DoxyParamCaption}
\item[{{\bf mca\+\_\+mpool\+\_\+gpusm\+\_\+registration\+\_\+t} $\ast$}]{item}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}}\label{mpool__gpusm__module_8c_a794720616a739facd649002abdd9bcf5}


Called when the program is exiting. 

This destroys the events. 