\hypertarget{classnntrainer_1_1SwapDevice}{}\doxysection{nntrainer\+::Swap\+Device Class Reference}
\label{classnntrainer_1_1SwapDevice}\index{nntrainer::SwapDevice@{nntrainer::SwapDevice}}


A device used to storing data with long access time.  




{\ttfamily \#include $<$swap\+\_\+device.\+h$>$}

\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{classnntrainer_1_1SwapDevice_a0e3a0af1d140bcd65b22ff13c783035d}{Swap\+Device}} (const std\+::string \&name)
\begin{DoxyCompactList}\small\item\em \mbox{\hyperlink{classnntrainer_1_1SwapDevice}{Swap\+Device}} default constructor. \end{DoxyCompactList}\item 
\mbox{\hyperlink{classnntrainer_1_1SwapDevice_a58180ea419f295ae859a8c824aba5238}{Swap\+Device}} (const std\+::string \&path, const std\+::string \&name)
\begin{DoxyCompactList}\small\item\em \mbox{\hyperlink{classnntrainer_1_1SwapDevice}{Swap\+Device}} default constructor. \end{DoxyCompactList}\item 
virtual \mbox{\hyperlink{classnntrainer_1_1SwapDevice_a1bd5e39ac8f645a2904b50f8d322d43c}{$\sim$\+Swap\+Device}} ()=default
\begin{DoxyCompactList}\small\item\em \mbox{\hyperlink{classnntrainer_1_1SwapDevice}{Swap\+Device}} destructor. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classnntrainer_1_1SwapDevice_a7cabdbbb842bb6ff8454336134d3bfa1}{start}} (size\+\_\+t size)
\begin{DoxyCompactList}\small\item\em Start device. \end{DoxyCompactList}\item 
void $\ast$ \mbox{\hyperlink{classnntrainer_1_1SwapDevice_a969e741fb38670f8417face92fe52e51}{get\+Buffer}} (off\+\_\+t offset, size\+\_\+t size, bool alloc\+\_\+only=false)
\begin{DoxyCompactList}\small\item\em Allocate and get data. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classnntrainer_1_1SwapDevice_abd599d8ea8c1cf1f8016e2d0a0d54527}{put\+Buffer}} (void $\ast$ptr, bool dealloc\+\_\+only=false)
\begin{DoxyCompactList}\small\item\em Deallocate and put data. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classnntrainer_1_1SwapDevice_a7c1bbdb45994833f351c879b55ed9a7a}{finish}} ()
\begin{DoxyCompactList}\small\item\em Close device. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{classnntrainer_1_1SwapDevice_a49b274c4e0777d3fb70c34df385b2408}{is\+Operating}} () const
\begin{DoxyCompactList}\small\item\em Check device is operating. \end{DoxyCompactList}\item 
const std\+::string \mbox{\hyperlink{classnntrainer_1_1SwapDevice_a74bb6cdfd7ef036720329b7b32139ee9}{get\+Device\+Path}} () const
\begin{DoxyCompactList}\small\item\em Get device path. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Public Attributes}
\begin{DoxyCompactItemize}
\item 
const std\+::string \mbox{\hyperlink{classnntrainer_1_1SwapDevice_a71a37d0f94ccd93177bce106e887c28d}{swap\+\_\+device\+\_\+default\+\_\+path}} = \char`\"{}.\char`\"{}
\begin{DoxyCompactList}\small\item\em swap device default path \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
A device used to storing data with long access time. 

Definition at line 37 of file swap\+\_\+device.\+h.



\doxysubsection{Constructor \& Destructor Documentation}
\mbox{\Hypertarget{classnntrainer_1_1SwapDevice_a0e3a0af1d140bcd65b22ff13c783035d}\label{classnntrainer_1_1SwapDevice_a0e3a0af1d140bcd65b22ff13c783035d}} 
\index{nntrainer::SwapDevice@{nntrainer::SwapDevice}!SwapDevice@{SwapDevice}}
\index{SwapDevice@{SwapDevice}!nntrainer::SwapDevice@{nntrainer::SwapDevice}}
\doxysubsubsection{\texorpdfstring{SwapDevice()}{SwapDevice()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily nntrainer\+::\+Swap\+Device\+::\+Swap\+Device (\begin{DoxyParamCaption}\item[{const std\+::string \&}]{name }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [explicit]}}



\mbox{\hyperlink{classnntrainer_1_1SwapDevice}{Swap\+Device}} default constructor. 



Definition at line 49 of file swap\+\_\+device.\+h.

\mbox{\Hypertarget{classnntrainer_1_1SwapDevice_a58180ea419f295ae859a8c824aba5238}\label{classnntrainer_1_1SwapDevice_a58180ea419f295ae859a8c824aba5238}} 
\index{nntrainer::SwapDevice@{nntrainer::SwapDevice}!SwapDevice@{SwapDevice}}
\index{SwapDevice@{SwapDevice}!nntrainer::SwapDevice@{nntrainer::SwapDevice}}
\doxysubsubsection{\texorpdfstring{SwapDevice()}{SwapDevice()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily nntrainer\+::\+Swap\+Device\+::\+Swap\+Device (\begin{DoxyParamCaption}\item[{const std\+::string \&}]{path,  }\item[{const std\+::string \&}]{name }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [explicit]}}



\mbox{\hyperlink{classnntrainer_1_1SwapDevice}{Swap\+Device}} default constructor. 



Definition at line 57 of file swap\+\_\+device.\+h.

\mbox{\Hypertarget{classnntrainer_1_1SwapDevice_a1bd5e39ac8f645a2904b50f8d322d43c}\label{classnntrainer_1_1SwapDevice_a1bd5e39ac8f645a2904b50f8d322d43c}} 
\index{nntrainer::SwapDevice@{nntrainer::SwapDevice}!````~SwapDevice@{$\sim$SwapDevice}}
\index{````~SwapDevice@{$\sim$SwapDevice}!nntrainer::SwapDevice@{nntrainer::SwapDevice}}
\doxysubsubsection{\texorpdfstring{$\sim$SwapDevice()}{~SwapDevice()}}
{\footnotesize\ttfamily virtual nntrainer\+::\+Swap\+Device\+::$\sim$\+Swap\+Device (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}, {\ttfamily [default]}}



\mbox{\hyperlink{classnntrainer_1_1SwapDevice}{Swap\+Device}} destructor. 



\doxysubsection{Member Function Documentation}
\mbox{\Hypertarget{classnntrainer_1_1SwapDevice_a7c1bbdb45994833f351c879b55ed9a7a}\label{classnntrainer_1_1SwapDevice_a7c1bbdb45994833f351c879b55ed9a7a}} 
\index{nntrainer::SwapDevice@{nntrainer::SwapDevice}!finish@{finish}}
\index{finish@{finish}!nntrainer::SwapDevice@{nntrainer::SwapDevice}}
\doxysubsubsection{\texorpdfstring{finish()}{finish()}}
{\footnotesize\ttfamily void nntrainer\+::\+Swap\+Device\+::finish (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Close device. 



Definition at line 157 of file swap\+\_\+device.\+cpp.

\mbox{\Hypertarget{classnntrainer_1_1SwapDevice_a969e741fb38670f8417face92fe52e51}\label{classnntrainer_1_1SwapDevice_a969e741fb38670f8417face92fe52e51}} 
\index{nntrainer::SwapDevice@{nntrainer::SwapDevice}!getBuffer@{getBuffer}}
\index{getBuffer@{getBuffer}!nntrainer::SwapDevice@{nntrainer::SwapDevice}}
\doxysubsubsection{\texorpdfstring{getBuffer()}{getBuffer()}}
{\footnotesize\ttfamily void $\ast$ nntrainer\+::\+Swap\+Device\+::get\+Buffer (\begin{DoxyParamCaption}\item[{off\+\_\+t}]{offset,  }\item[{size\+\_\+t}]{size,  }\item[{bool}]{alloc\+\_\+only = {\ttfamily false} }\end{DoxyParamCaption})}



Allocate and get data. 


\begin{DoxyParams}{Parameters}
{\em offset} & Requested offset of swap device file \\
\hline
{\em size} & Requested size. \\
\hline
{\em alloc\+\_\+only} & only allocate buffer without reading data\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The pointer of the swap space 
\end{DoxyReturn}


Definition at line 54 of file swap\+\_\+device.\+cpp.

\mbox{\Hypertarget{classnntrainer_1_1SwapDevice_a74bb6cdfd7ef036720329b7b32139ee9}\label{classnntrainer_1_1SwapDevice_a74bb6cdfd7ef036720329b7b32139ee9}} 
\index{nntrainer::SwapDevice@{nntrainer::SwapDevice}!getDevicePath@{getDevicePath}}
\index{getDevicePath@{getDevicePath}!nntrainer::SwapDevice@{nntrainer::SwapDevice}}
\doxysubsubsection{\texorpdfstring{getDevicePath()}{getDevicePath()}}
{\footnotesize\ttfamily const std\+::string nntrainer\+::\+Swap\+Device\+::get\+Device\+Path (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get device path. 

\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{classnntrainer_1_1Device}{Device}} path 
\end{DoxyReturn}


Definition at line 115 of file swap\+\_\+device.\+h.

\mbox{\Hypertarget{classnntrainer_1_1SwapDevice_a49b274c4e0777d3fb70c34df385b2408}\label{classnntrainer_1_1SwapDevice_a49b274c4e0777d3fb70c34df385b2408}} 
\index{nntrainer::SwapDevice@{nntrainer::SwapDevice}!isOperating@{isOperating}}
\index{isOperating@{isOperating}!nntrainer::SwapDevice@{nntrainer::SwapDevice}}
\doxysubsubsection{\texorpdfstring{isOperating()}{isOperating()}}
{\footnotesize\ttfamily bool nntrainer\+::\+Swap\+Device\+::is\+Operating (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Check device is operating. 

\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{classnntrainer_1_1Device}{Device}} operating status 
\end{DoxyReturn}


Definition at line 107 of file swap\+\_\+device.\+h.

\mbox{\Hypertarget{classnntrainer_1_1SwapDevice_abd599d8ea8c1cf1f8016e2d0a0d54527}\label{classnntrainer_1_1SwapDevice_abd599d8ea8c1cf1f8016e2d0a0d54527}} 
\index{nntrainer::SwapDevice@{nntrainer::SwapDevice}!putBuffer@{putBuffer}}
\index{putBuffer@{putBuffer}!nntrainer::SwapDevice@{nntrainer::SwapDevice}}
\doxysubsubsection{\texorpdfstring{putBuffer()}{putBuffer()}}
{\footnotesize\ttfamily void nntrainer\+::\+Swap\+Device\+::put\+Buffer (\begin{DoxyParamCaption}\item[{void $\ast$}]{ptr,  }\item[{bool}]{dealloc\+\_\+only = {\ttfamily false} }\end{DoxyParamCaption})}



Deallocate and put data. 


\begin{DoxyParams}{Parameters}
{\em ptr} & The pointer obtained from get\+Buffer \\
\hline
{\em dealloc\+\_\+only} & only deallocate buffer without writing data \\
\hline
\end{DoxyParams}


Definition at line 101 of file swap\+\_\+device.\+cpp.

\mbox{\Hypertarget{classnntrainer_1_1SwapDevice_a7cabdbbb842bb6ff8454336134d3bfa1}\label{classnntrainer_1_1SwapDevice_a7cabdbbb842bb6ff8454336134d3bfa1}} 
\index{nntrainer::SwapDevice@{nntrainer::SwapDevice}!start@{start}}
\index{start@{start}!nntrainer::SwapDevice@{nntrainer::SwapDevice}}
\doxysubsubsection{\texorpdfstring{start()}{start()}}
{\footnotesize\ttfamily void nntrainer\+::\+Swap\+Device\+::start (\begin{DoxyParamCaption}\item[{size\+\_\+t}]{size }\end{DoxyParamCaption})}



Start device. 


\begin{DoxyParams}{Parameters}
{\em size} & The size of requested swap device space \\
\hline
\end{DoxyParams}


Definition at line 28 of file swap\+\_\+device.\+cpp.



\doxysubsection{Member Data Documentation}
\mbox{\Hypertarget{classnntrainer_1_1SwapDevice_a71a37d0f94ccd93177bce106e887c28d}\label{classnntrainer_1_1SwapDevice_a71a37d0f94ccd93177bce106e887c28d}} 
\index{nntrainer::SwapDevice@{nntrainer::SwapDevice}!swap\_device\_default\_path@{swap\_device\_default\_path}}
\index{swap\_device\_default\_path@{swap\_device\_default\_path}!nntrainer::SwapDevice@{nntrainer::SwapDevice}}
\doxysubsubsection{\texorpdfstring{swap\_device\_default\_path}{swap\_device\_default\_path}}
{\footnotesize\ttfamily const std\+::string nntrainer\+::\+Swap\+Device\+::swap\+\_\+device\+\_\+default\+\_\+path = \char`\"{}.\char`\"{}}



swap device default path 



Definition at line 43 of file swap\+\_\+device.\+h.



The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
\item 
tensor/swap\+\_\+device.\+h\item 
tensor/\mbox{\hyperlink{swap__device_8cpp}{swap\+\_\+device.\+cpp}}\end{DoxyCompactItemize}
