X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/book_gpu.git/blobdiff_plain/1b27427d56ddc474598ea928b11c31bcaf3f1e12..1ab765e98ab35b9396ce7f485d3e1121910ba320:/BookGPU/Chapters/chapter3/ch3.tex diff --git a/BookGPU/Chapters/chapter3/ch3.tex b/BookGPU/Chapters/chapter3/ch3.tex index 83bb339..e04a36c 100755 --- a/BookGPU/Chapters/chapter3/ch3.tex +++ b/BookGPU/Chapters/chapter3/ch3.tex @@ -115,15 +115,15 @@ However, so as to propose concise and more readable code, we will assume the fol \begin{algorithm} \SetNlSty{}{}{:} - allocate and populate CPU memory \textbf{h\_in}\;\\ - allocate CPU pinned-memory \textbf{h\_out}\;\\ - allocate GPU global memory \textbf{d\_out}\;\\ - declare GPU texture reference \textbf{tex\_img\_in}\;\\ - allocate GPU array in global memory \textbf{array\_img\_in}\;\\ - bind GPU array \textbf{array\_img\_in} to texture \textbf{tex\_img\_in}\;\\ - copy data from \textbf{h\_in} to \textbf{array\_img\_in}\label{algo:memcopy:H2D}\;\\ - kernel\kl gridDim,blockDim\kr()\tcc*[f]{outputs to d\_out}\label{algo:memcopy:kernel}\;\\ - copy data from \textbf{d\_out} to \textbf{h\_out} \label{algo:memcopy:D2H}\;\\ + allocate and populate CPU memory \textbf{h\_in}\; + allocate CPU pinned-memory \textbf{h\_out}\; + allocate GPU global memory \textbf{d\_out}\; + declare GPU texture reference \textbf{tex\_img\_in}\; + allocate GPU array in global memory \textbf{array\_img\_in}\; + bind GPU array \textbf{array\_img\_in} to texture \textbf{tex\_img\_in}\; + copy data from \textbf{h\_in} to \textbf{array\_img\_in}\label{algo:memcopy:H2D}\; + kernel\kl gridDim,blockDim\kr()\tcc*[f]{outputs to d\_out}\label{algo:memcopy:kernel}\; + copy data from \textbf{d\_out} to \textbf{h\_out} \label{algo:memcopy:D2H}\; \caption{Global memory management on CPU and GPU sides.} \label{algo:memcopy} \end{algorithm} @@ -238,13 +238,13 @@ On the GPU's side, we note high dependence on window size due to the redundancy %\SetNlSty{}{}{:} % \SetLine %\linesnumbered - copy data from CPU to GPU texture memory\label{algoMedianGeneric:memcpyH2D}\;\\ + copy data from CPU to GPU texture memory\label{algoMedianGeneric:memcpyH2D}\; \ForEach(\tcc*[f]{in parallel}){pixel at position $(x, y)$}{ - Read gray-level values of the n$\times$n neighborhood\label{algoMedianGeneric:cptstart}\;\\ - Selects the median value among those n$\times$n values\;\\ - Outputs the new gray-level value \label{algoMedianGeneric:cptend}\;\\ + Read gray-level values of the n$\times$n neighborhood\label{algoMedianGeneric:cptstart}\; + Selects the median value among those n$\times$n values\; + Outputs the new gray-level value \label{algoMedianGeneric:cptend}\; } -copy data from GPU global memory to CPU memory\label{algoMedianGeneric:memcpyD2H}\;\\ +copy data from GPU global memory to CPU memory\label{algoMedianGeneric:memcpyD2H}\; \caption{\label{algoMedianGeneric}generic n$\times$n median filter} \end{algorithm}