X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/book_gpu.git/blobdiff_plain/ccff43db77ed9a71b6d9fc52aaf03585104713ce..c08513a856650905e4751c8b52c7cbb661368a5f:/BookGPU/Chapters/chapter18/ch18.tex?ds=inline diff --git a/BookGPU/Chapters/chapter18/ch18.tex b/BookGPU/Chapters/chapter18/ch18.tex index 71d2b84..7c2a393 100755 --- a/BookGPU/Chapters/chapter18/ch18.tex +++ b/BookGPU/Chapters/chapter18/ch18.tex @@ -93,7 +93,7 @@ with basic notions on topology (see for instance~\cite{Devaney}). Chaos theory studies the behavior of dynamical systems that are perfectly predictable, yet appear to be wildly amorphous and meaningless. -Chaotic systems\index{chaotic systems} are highly sensitive to initial conditions, +Chaotic systems\index{chaotic!systems} are highly sensitive to initial conditions, which is popularly referred to as the butterfly effect. In other words, small differences in initial conditions (such as those due to rounding errors in numerical computation) yield widely diverging outcomes, in general rendering long-term prediction impossible \cite{kellert1994wake}. This happens even though these systems are deterministic, meaning that their future behavior is fully determined by their initial conditions, with no random elements involved \cite{kellert1994wake}. That is, the deterministic nature of these systems does not make them predictable \cite{kellert1994wake,Werndl01032009}. This behavior is known as deterministic chaos, or simply chaos. It has been well-studied in mathematics and @@ -149,7 +149,7 @@ When $f$ is chaotic, then the system $(\mathcal{X}, f)$ is chaotic and quoting D -\subsection{Chaotic iterations}\index{chaotic iterations} +\subsection{Chaotic iterations}\index{chaotic!iterations} \label{subsection:Chaotic iterations} Let us now introduce an example of a dynamical systems family that has @@ -247,26 +247,7 @@ satisfies the Devaney's definition of chaos. -\lstset{language=C,caption={C code of the sequential PRNG based on chaotic iterations},label={algo:seqCIPRNG}} -\begin{small} -\begin{lstlisting} - -unsigned int CIPRNG() { - static unsigned int x = 123123123; - unsigned long t1 = xorshift(); - unsigned long t2 = xor128(); - unsigned long t3 = xorwow(); - x = x^(unsigned int)t1; - x = x^(unsigned int)(t2>>32); - x = x^(unsigned int)(t3>>32); - x = x^(unsigned int)t2; - x = x^(unsigned int)(t1>>32); - x = x^(unsigned int)t3; - return x; -} -\end{lstlisting} -\end{small} - +\lstinputlisting[label=algo:seqCIPRNG,caption={C code of the sequential PRNG based on chaotic iterations}]{Chapters/chapter18/code2.cu} In Listing~\ref{algo:seqCIPRNG} a sequential version of the proposed PRNG based @@ -298,8 +279,7 @@ simultaneously. In general, the larger the number of threads is, the more local memory is used, and the less branching instructions are used (if, while, etc.) and so, the better the performances on GPU are. Obviously, having these requirements in mind, it is possible to build -a program similar to the one presented in Listing -\ref{algo:seqCIPRNG}, which computes pseudorandom numbers on GPU. To +a program similar to the one presented in Listing~\ref{algo:seqCIPRNG}, which computes pseudorandom numbers on GPU. To do so, we must first recall that in the CUDA~\cite{Nvid10} environment, threads have a local identifier called \texttt{ThreadIdx}, which is relative to the block containing @@ -337,7 +317,7 @@ NumThreads: number of threads\;} \If{threadIdx is concerned by the computation} { retrieve data from InternalVarXorLikeArray[threadIdx] in local variables\; \For{i=1 to n} { - compute a new PRNG as in Listing\ref{algo:seqCIPRNG}\; + compute a new PRNG as in Listing~\ref{algo:seqCIPRNG}\; store the new PRNG in NewNb[NumThreads*threadIdx+i]\; } store internal variables in InternalVarXorLikeArray[threadIdx]\;