From ab8b9d20e04e131eb774c30874380721ca122b86 Mon Sep 17 00:00:00 2001 From: couturie Date: Sun, 18 Sep 2011 20:00:44 +0200 Subject: [PATCH] ajout courbe --- curve_time_gpu.pdf | Bin 0 -> 7239 bytes curve_time_gpu.plot | 20 ++++++++++++++++++++ prng_gpu.tex | 37 +++++++++++++++++++++++++------------ time_gpu.txt | 13 +++++++++++++ 4 files changed, 58 insertions(+), 12 deletions(-) create mode 100644 curve_time_gpu.pdf create mode 100644 curve_time_gpu.plot create mode 100644 time_gpu.txt diff --git a/curve_time_gpu.pdf b/curve_time_gpu.pdf new file mode 100644 index 0000000000000000000000000000000000000000..bbc37162bd350fbb775d0078d233a3c68d1e4eb5 GIT binary patch literal 7239 zcmb_hdpwle*Y8xP%Q&S-h2l}krFiCU+$Q(r9->^*n0c7V+?shXq;x9ulT_$NA}6|t zl1rBhO1?}c~hhB<6~th(4OBd z+xoQ5oy^tvc(d`LvOOGj)zm>fH~(Vfk;9Zorw2ZcH*FN{$T266RlFM1*`FD!EOvah zdHv@v@1p2-aG2Ee;F}O$o&RA2sdTEMq2m2+SDnSBhRKf^;epMca&n$@Z%!$G;;0_h zqM%r*I@^N?SFDbhdBFCi&+Mekv;L%|^xEqlnJaXssgfhIp1US3K1t?Q_a0g+QcpQ{ z|EzgQppnuU@`_Bxw&*JKo)ag*u4K}*w9a#@$3(Kv-)HT&D`}_h9PWIkCLPGu3kj+9 zSN}BUnroI)%FbD7odpxec^w$1`t%u_)UDa`o4m+y~LRB;X7N%ew zrDEy6=xHkSjszp$`|0*7Xw78JQq9hM2OuU%ZuM(vpYiyx&0mkRYR<)wm6)5|{y38n zy>qeS=AxbQWkbc0jRUnW(H6r)Nyv+UYc~rrOos@s;>%pwAyLtjQoYV>U#vrxT3Bwo z$LuyKyBElOnV)wzA!(GDn^(IiD!`M?&bq=Aq_5c;E$3BGO$oWQA~R?nIjB0fp;Ey& zdI`D9eyDr>!EAfMkcmpqfmx`3g6m=_kwCt))Ps3_M3Zk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wB6bVpdwdbcYtF6L@Nl|wpjH+GgSu@CxdhH7_jU!Q}5{e#@pHiGfnz#TCk?!tc4 z>+6%DEmfbk_bTfjXuLCYdg|S|(`L@%Y9z+4sdurM+gg;@)LWr_p<4ds7peI<@Q&hmNo1z4-=@f%bpEt zW*OVTR}Zp>FTOp$c6vnU8&KxlY&&LLyFOhbck-3($IN249@{hP_uezppT-m<=BlW^ zn~~$Ws{*hR3zI@AAZs?|;AL%Is~sK2j-UiG z)$rR9)MS|ioO^>16!J#`Ieb&CH`1$G5Qk-|51U&+2DHI?AcaKnkCrN z7~vwAMPd+J0y0*@U{>}4*&8?@Iy~xtgdMPQ(4gg?Gr3Kz^&M3)yDR@8zO{2FNYx8;zR;O#1jaB4^#sg ziZz#9^11VajqNL+#^YT@x(V@Lv#_E zPXQg@F+5bn0R1Tu_>VdWcH@MD&NCT;T?L?e%9_p)yn-JffUv{>-RKookhh5yo?vZ3 zGoaX5TNoNrNd^{{22^W2#lXhE+``hFXioqCIefA1vlwNFP+5SeG&~ijscG$OgZm$L CBw1nr literal 0 HcmV?d00001 diff --git a/curve_time_gpu.plot b/curve_time_gpu.plot new file mode 100644 index 0000000..4326e12 --- /dev/null +++ b/curve_time_gpu.plot @@ -0,0 +1,20 @@ +# Analysis description +set encoding iso_8859_1 +set terminal x11 +set size 1,0.5 +set term postscript enhanced portrait "Helvetica" 12 +#set title "Performance on homogeneous cluster" +set ylabel "Random numbers generated / second" +set xlabel "Number of threads used by the GPU" +#set nologscale; +set logscale x; +set logscale y; +#set label "Taille" at -0.002,2.1 right +#set label "file" at -0.003,2 right +#set key 1500,1600 +#set xrange [20:200] +#set yrange [0:300] +#set offsets 0,0,2,2 +set key left top +plot 'time_gpu.txt' using 1:2 t "naive prng gpu" with linespoints lt 2 lw 2 ps 0 pt 5,\ +'time_gpu.txt' using 1:3 t "optimized prng gpu" with linespoints lt 1 lw 2 ps 0 pt 5 diff --git a/prng_gpu.tex b/prng_gpu.tex index fa71e5b..d1fb7a6 100644 --- a/prng_gpu.tex +++ b/prng_gpu.tex @@ -674,7 +674,7 @@ achieved out. Then in order to apply the negation on these bits we can simply apply the xor operator between the current number and the strategy. In order to obtain the strategy we also use a classical PRNG. -Here is an example with 16-bits numbers showing how the bit operations are +Here is an example with 16-bits numbers showing how the bitwise operations are applied. Suppose that $x$ and the strategy $S^i$ are defined in binary mode. Then the following table shows the result of $x$ xor $S^i$. $$ @@ -738,17 +738,18 @@ unsigned int CIprng() { -In listing~\ref{algo:seqCIprng} a sequential version of our chaotic iterations -based PRNG is presented. The xor operator is represented by \textasciicircum. This function uses three classical 64-bits PRNG: the -\texttt{xorshift}, the \texttt{xor128} and the \texttt{xorwow}. In the -following, we call them xor-like PRNGSs. These three PRNGs are presented -in~\cite{Marsaglia2003}. As each xor-like PRNG used works with 64-bits and as our PRNG -works with 32-bits, the use of \texttt{(unsigned int)} selects the 32 least -significant bits whereas \texttt{(unsigned int)(t3$>>$32)} selects the 32 most -significants bits of the variable \texttt{t}. So to produce a random number -realizes 6 xor operations with 6 32-bits numbers produced by 3 64-bits PRNG. -This version successes the BigCrush of the TestU01 battery [P. L’ecuyer and - R. Simard. Testu01]. +In listing~\ref{algo:seqCIprng} a sequential version of our chaotic iterations +based PRNG is presented. The xor operator is represented by +\textasciicircum. This function uses three classical 64-bits PRNG: the +\texttt{xorshift}, the \texttt{xor128} and the \texttt{xorwow}. In the +following, we call them xor-like PRNGSs. These three PRNGs are presented +in~\cite{Marsaglia2003}. As each xor-like PRNG used works with 64-bits and as +our PRNG works with 32-bits, the use of \texttt{(unsigned int)} selects the 32 +least significant bits whereas \texttt{(unsigned int)(t3$>>$32)} selects the 32 +most significants bits of the variable \texttt{t}. So to produce a random +number realizes 6 xor operations with 6 32-bits numbers produced by 3 64-bits +PRNG. This version successes the BigCrush of the TestU01 battery [P. L’ecuyer + and R. Simard. Testu01]. \section{Efficient prng based on chaotic iterations on GPU} @@ -835,6 +836,8 @@ which represent the indexes of the other threads for which the results are used by the current thread. In the algorithm, we consider that a 64-bits xor-like PRNG is used, that is why both 32-bits parts are used. +This version also succeed to the BigCrush batteries of tests. + \begin{algorithm} \KwIn{InternalVarXorLikeArray: array with internal variables of 1 xor-like PRNGs in global memory\; @@ -863,10 +866,20 @@ tab1, tab2: Arrays containing permutations of size permutation\_size\;} \caption{main kernel for the chaotic iterations based PRNG GPU efficient version} \label{algo:gpu_kernel2} \end{algorithm} + + + \section{Experiments} Differents experiments have been performed in order to measure the generation speed. +\begin{figure}[t] +\begin{center} + \includegraphics[scale=.5]{curve_time_gpu.pdf} +\end{center} +\caption{Number of random numbers generated per second} +\label{fig:time_naive_gpu} +\end{figure} First of all we have compared the time to generate X random numbers with both the CPU version and the GPU version. diff --git a/time_gpu.txt b/time_gpu.txt new file mode 100644 index 0000000..843bf09 --- /dev/null +++ b/time_gpu.txt @@ -0,0 +1,13 @@ +#threads naive nb rand/s opti +10240 1958396000.03 13162317203.28 +20480 2607152000.80 17544514829.35 +30720 2932438000.82 19734780759.37 +51200 2787838000.25 18772978895.58 +76800 2926940000.81 19718338110.60 +102400 2778762000.41 18800512068.39 +153600 2927902000.36 19692840251.08 +512000 2905399000.83 19605898582.49 +768000 2826752000.70 19717903047.22 +1048576 2717620000.40 19625932346.26 +2097152 2720592856.85 19571418202.69 +5242880 2542399000.19 19497621662.45 -- 2.39.5