\hypertarget{classnntrainer_1_1CacheElem}{}\doxysection{nntrainer\+::Cache\+Elem Class Reference}
\label{classnntrainer_1_1CacheElem}\index{nntrainer::CacheElem@{nntrainer::CacheElem}}


Cache element containing swap address.  




{\ttfamily \#include $<$cache\+\_\+elem.\+h$>$}

\doxysubsection*{Public Types}
\begin{DoxyCompactItemize}
\item 
enum \mbox{\hyperlink{classnntrainer_1_1CacheElem_a5d2d1b78658bed7cffcbca8d551cb530}{Options}} \{ \mbox{\hyperlink{classnntrainer_1_1CacheElem_a5d2d1b78658bed7cffcbca8d551cb530a0b2a73623aac99ecca9f5fbc00676745}{N\+O\+NE}} = 0b0000, 
\mbox{\hyperlink{classnntrainer_1_1CacheElem_a5d2d1b78658bed7cffcbca8d551cb530a5057b3ca10daebd312c82bc0f2280154}{F\+I\+R\+S\+T\+\_\+\+A\+C\+C\+E\+SS}} = 0x0001, 
\mbox{\hyperlink{classnntrainer_1_1CacheElem_a5d2d1b78658bed7cffcbca8d551cb530a1e689f3cf4b465032ae3eb0eac272629}{L\+A\+S\+T\+\_\+\+A\+C\+C\+E\+SS}} = 0x0010
 \}
\end{DoxyCompactItemize}
\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{classnntrainer_1_1CacheElem_a2f92c22f6ede1fc4be8f86e559f2ada8}{Cache\+Elem}} (std\+::shared\+\_\+ptr$<$ \mbox{\hyperlink{classnntrainer_1_1SwapDevice}{Swap\+Device}} $>$ dev, unsigned int mem\+\_\+id, size\+\_\+t off, size\+\_\+t len, std\+::shared\+\_\+ptr$<$ \mbox{\hyperlink{classnntrainer_1_1MemoryData}{Memory\+Data}}$<$ float $>$$>$ data, \mbox{\hyperlink{namespacenntrainer_aa82a5a0874fed058056879c555555d78}{Cache\+Policy}} pol=Cache\+Policy\+::\+A\+L\+W\+A\+Y\+S\+\_\+\+S\+Y\+N\+C\+ED)
\begin{DoxyCompactList}\small\item\em \mbox{\hyperlink{classnntrainer_1_1CacheElem}{Cache\+Elem}} default constructor. \end{DoxyCompactList}\item 
virtual \mbox{\hyperlink{classnntrainer_1_1CacheElem_a61bcb1268d58f6830505c5bf3fa48ddf}{$\sim$\+Cache\+Elem}} ()
\begin{DoxyCompactList}\small\item\em \mbox{\hyperlink{classnntrainer_1_1CacheElem}{Cache\+Elem}} destructor. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classnntrainer_1_1CacheElem_ab48f733aae152756b6bdab91730b5a17}{swap\+In}} (\mbox{\hyperlink{classnntrainer_1_1CacheElem_a5d2d1b78658bed7cffcbca8d551cb530}{Options}} opt=Options\+::\+N\+O\+NE)
\begin{DoxyCompactList}\small\item\em load data from swap device \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classnntrainer_1_1CacheElem_a67df52eeaeeddda6e64fc26b84bb3318}{swap\+Out}} (\mbox{\hyperlink{classnntrainer_1_1CacheElem_a5d2d1b78658bed7cffcbca8d551cb530}{Options}} opt=Options\+::\+N\+O\+NE)
\begin{DoxyCompactList}\small\item\em unload data to swap device \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{classnntrainer_1_1CacheElem_ad51872eb06a9135fab178635a80ffc6f}{is\+Active}} () const
\begin{DoxyCompactList}\small\item\em unload data to swap device \end{DoxyCompactList}\item 
size\+\_\+t \mbox{\hyperlink{classnntrainer_1_1CacheElem_a411a100c35b9492b53c63246bfb30964}{get\+Length}} () const
\begin{DoxyCompactList}\small\item\em get length of cache element \end{DoxyCompactList}\item 
unsigned int \mbox{\hyperlink{classnntrainer_1_1CacheElem_af4e813c365f7b556233a25e4af95d0d8}{get\+Id}} () const
\begin{DoxyCompactList}\small\item\em get id of cache element \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classnntrainer_1_1CacheElem_a77ecd555e3e140eb3ef1f5aa0975e4e6}{reset}} ()
\begin{DoxyCompactList}\small\item\em reset access count \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Cache element containing swap address. 

Definition at line 45 of file cache\+\_\+elem.\+h.



\doxysubsection{Member Enumeration Documentation}
\mbox{\Hypertarget{classnntrainer_1_1CacheElem_a5d2d1b78658bed7cffcbca8d551cb530}\label{classnntrainer_1_1CacheElem_a5d2d1b78658bed7cffcbca8d551cb530}} 
\index{nntrainer::CacheElem@{nntrainer::CacheElem}!Options@{Options}}
\index{Options@{Options}!nntrainer::CacheElem@{nntrainer::CacheElem}}
\doxysubsubsection{\texorpdfstring{Options}{Options}}
{\footnotesize\ttfamily enum \mbox{\hyperlink{classnntrainer_1_1CacheElem_a5d2d1b78658bed7cffcbca8d551cb530}{nntrainer\+::\+Cache\+Elem\+::\+Options}}}

\begin{DoxyEnumFields}{Enumerator}
\raisebox{\heightof{T}}[0pt][0pt]{\index{NONE@{NONE}!nntrainer::CacheElem@{nntrainer::CacheElem}}\index{nntrainer::CacheElem@{nntrainer::CacheElem}!NONE@{NONE}}}\mbox{\Hypertarget{classnntrainer_1_1CacheElem_a5d2d1b78658bed7cffcbca8d551cb530a0b2a73623aac99ecca9f5fbc00676745}\label{classnntrainer_1_1CacheElem_a5d2d1b78658bed7cffcbca8d551cb530a0b2a73623aac99ecca9f5fbc00676745}} 
N\+O\+NE&No option \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{FIRST\_ACCESS@{FIRST\_ACCESS}!nntrainer::CacheElem@{nntrainer::CacheElem}}\index{nntrainer::CacheElem@{nntrainer::CacheElem}!FIRST\_ACCESS@{FIRST\_ACCESS}}}\mbox{\Hypertarget{classnntrainer_1_1CacheElem_a5d2d1b78658bed7cffcbca8d551cb530a5057b3ca10daebd312c82bc0f2280154}\label{classnntrainer_1_1CacheElem_a5d2d1b78658bed7cffcbca8d551cb530a5057b3ca10daebd312c82bc0f2280154}} 
F\+I\+R\+S\+T\+\_\+\+A\+C\+C\+E\+SS&First Access \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{LAST\_ACCESS@{LAST\_ACCESS}!nntrainer::CacheElem@{nntrainer::CacheElem}}\index{nntrainer::CacheElem@{nntrainer::CacheElem}!LAST\_ACCESS@{LAST\_ACCESS}}}\mbox{\Hypertarget{classnntrainer_1_1CacheElem_a5d2d1b78658bed7cffcbca8d551cb530a1e689f3cf4b465032ae3eb0eac272629}\label{classnntrainer_1_1CacheElem_a5d2d1b78658bed7cffcbca8d551cb530a1e689f3cf4b465032ae3eb0eac272629}} 
L\+A\+S\+T\+\_\+\+A\+C\+C\+E\+SS&Last Access \\
\hline

\end{DoxyEnumFields}


Definition at line 47 of file cache\+\_\+elem.\+h.



\doxysubsection{Constructor \& Destructor Documentation}
\mbox{\Hypertarget{classnntrainer_1_1CacheElem_a2f92c22f6ede1fc4be8f86e559f2ada8}\label{classnntrainer_1_1CacheElem_a2f92c22f6ede1fc4be8f86e559f2ada8}} 
\index{nntrainer::CacheElem@{nntrainer::CacheElem}!CacheElem@{CacheElem}}
\index{CacheElem@{CacheElem}!nntrainer::CacheElem@{nntrainer::CacheElem}}
\doxysubsubsection{\texorpdfstring{CacheElem()}{CacheElem()}}
{\footnotesize\ttfamily nntrainer\+::\+Cache\+Elem\+::\+Cache\+Elem (\begin{DoxyParamCaption}\item[{std\+::shared\+\_\+ptr$<$ \mbox{\hyperlink{classnntrainer_1_1SwapDevice}{Swap\+Device}} $>$}]{dev,  }\item[{unsigned int}]{mem\+\_\+id,  }\item[{size\+\_\+t}]{off,  }\item[{size\+\_\+t}]{len,  }\item[{std\+::shared\+\_\+ptr$<$ \mbox{\hyperlink{classnntrainer_1_1MemoryData}{Memory\+Data}}$<$ float $>$$>$}]{data,  }\item[{\mbox{\hyperlink{namespacenntrainer_aa82a5a0874fed058056879c555555d78}{Cache\+Policy}}}]{pol = {\ttfamily CachePolicy\+:\+:ALWAYS\+\_\+SYNCED} }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [explicit]}}



\mbox{\hyperlink{classnntrainer_1_1CacheElem}{Cache\+Elem}} default constructor. 



Definition at line 57 of file cache\+\_\+elem.\+h.

\mbox{\Hypertarget{classnntrainer_1_1CacheElem_a61bcb1268d58f6830505c5bf3fa48ddf}\label{classnntrainer_1_1CacheElem_a61bcb1268d58f6830505c5bf3fa48ddf}} 
\index{nntrainer::CacheElem@{nntrainer::CacheElem}!````~CacheElem@{$\sim$CacheElem}}
\index{````~CacheElem@{$\sim$CacheElem}!nntrainer::CacheElem@{nntrainer::CacheElem}}
\doxysubsubsection{\texorpdfstring{$\sim$CacheElem()}{~CacheElem()}}
{\footnotesize\ttfamily virtual nntrainer\+::\+Cache\+Elem\+::$\sim$\+Cache\+Elem (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [virtual]}}



\mbox{\hyperlink{classnntrainer_1_1CacheElem}{Cache\+Elem}} destructor. 



Definition at line 74 of file cache\+\_\+elem.\+h.



\doxysubsection{Member Function Documentation}
\mbox{\Hypertarget{classnntrainer_1_1CacheElem_af4e813c365f7b556233a25e4af95d0d8}\label{classnntrainer_1_1CacheElem_af4e813c365f7b556233a25e4af95d0d8}} 
\index{nntrainer::CacheElem@{nntrainer::CacheElem}!getId@{getId}}
\index{getId@{getId}!nntrainer::CacheElem@{nntrainer::CacheElem}}
\doxysubsubsection{\texorpdfstring{getId()}{getId()}}
{\footnotesize\ttfamily unsigned int nntrainer\+::\+Cache\+Elem\+::get\+Id (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



get id of cache element 

\begin{DoxyReturn}{Returns}
cache element id 
\end{DoxyReturn}


Definition at line 109 of file cache\+\_\+elem.\+h.

\mbox{\Hypertarget{classnntrainer_1_1CacheElem_a411a100c35b9492b53c63246bfb30964}\label{classnntrainer_1_1CacheElem_a411a100c35b9492b53c63246bfb30964}} 
\index{nntrainer::CacheElem@{nntrainer::CacheElem}!getLength@{getLength}}
\index{getLength@{getLength}!nntrainer::CacheElem@{nntrainer::CacheElem}}
\doxysubsubsection{\texorpdfstring{getLength()}{getLength()}}
{\footnotesize\ttfamily size\+\_\+t nntrainer\+::\+Cache\+Elem\+::get\+Length (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



get length of cache element 

\begin{DoxyReturn}{Returns}
length of cache element in byte 
\end{DoxyReturn}


Definition at line 102 of file cache\+\_\+elem.\+h.

\mbox{\Hypertarget{classnntrainer_1_1CacheElem_ad51872eb06a9135fab178635a80ffc6f}\label{classnntrainer_1_1CacheElem_ad51872eb06a9135fab178635a80ffc6f}} 
\index{nntrainer::CacheElem@{nntrainer::CacheElem}!isActive@{isActive}}
\index{isActive@{isActive}!nntrainer::CacheElem@{nntrainer::CacheElem}}
\doxysubsubsection{\texorpdfstring{isActive()}{isActive()}}
{\footnotesize\ttfamily bool nntrainer\+::\+Cache\+Elem\+::is\+Active (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



unload data to swap device 

\begin{DoxyReturn}{Returns}
active status 
\end{DoxyReturn}


Definition at line 95 of file cache\+\_\+elem.\+h.

\mbox{\Hypertarget{classnntrainer_1_1CacheElem_a77ecd555e3e140eb3ef1f5aa0975e4e6}\label{classnntrainer_1_1CacheElem_a77ecd555e3e140eb3ef1f5aa0975e4e6}} 
\index{nntrainer::CacheElem@{nntrainer::CacheElem}!reset@{reset}}
\index{reset@{reset}!nntrainer::CacheElem@{nntrainer::CacheElem}}
\doxysubsubsection{\texorpdfstring{reset()}{reset()}}
{\footnotesize\ttfamily void nntrainer\+::\+Cache\+Elem\+::reset (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



reset access count 



Definition at line 115 of file cache\+\_\+elem.\+h.

\mbox{\Hypertarget{classnntrainer_1_1CacheElem_ab48f733aae152756b6bdab91730b5a17}\label{classnntrainer_1_1CacheElem_ab48f733aae152756b6bdab91730b5a17}} 
\index{nntrainer::CacheElem@{nntrainer::CacheElem}!swapIn@{swapIn}}
\index{swapIn@{swapIn}!nntrainer::CacheElem@{nntrainer::CacheElem}}
\doxysubsubsection{\texorpdfstring{swapIn()}{swapIn()}}
{\footnotesize\ttfamily void nntrainer\+::\+Cache\+Elem\+::swap\+In (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classnntrainer_1_1CacheElem_a5d2d1b78658bed7cffcbca8d551cb530}{Options}}}]{opt = {\ttfamily Options\+:\+:NONE} }\end{DoxyParamCaption})}



load data from swap device 


\begin{DoxyParams}{Parameters}
{\em alloc\+\_\+only} & only allocate buffer without reading data \\
\hline
\end{DoxyParams}


Definition at line 45 of file cache\+\_\+elem.\+cpp.

\mbox{\Hypertarget{classnntrainer_1_1CacheElem_a67df52eeaeeddda6e64fc26b84bb3318}\label{classnntrainer_1_1CacheElem_a67df52eeaeeddda6e64fc26b84bb3318}} 
\index{nntrainer::CacheElem@{nntrainer::CacheElem}!swapOut@{swapOut}}
\index{swapOut@{swapOut}!nntrainer::CacheElem@{nntrainer::CacheElem}}
\doxysubsubsection{\texorpdfstring{swapOut()}{swapOut()}}
{\footnotesize\ttfamily void nntrainer\+::\+Cache\+Elem\+::swap\+Out (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classnntrainer_1_1CacheElem_a5d2d1b78658bed7cffcbca8d551cb530}{Options}}}]{opt = {\ttfamily Options\+:\+:NONE} }\end{DoxyParamCaption})}



unload data to swap device 


\begin{DoxyParams}{Parameters}
{\em dealloc\+\_\+only} & only deallocate buffer without writing data \\
\hline
\end{DoxyParams}


Definition at line 64 of file cache\+\_\+elem.\+cpp.



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