Presentation is loading. Please wait.

Presentation is loading. Please wait.

Quasi Random Sequences Author: Stefan Ilijevski. Random sequences? 2/10.

Similar presentations


Presentation on theme: "Quasi Random Sequences Author: Stefan Ilijevski. Random sequences? 2/10."— Presentation transcript:

1 Quasi Random Sequences Author: Stefan Ilijevski

2 Random sequences? 2/10

3 Halton’s sequence Steps for creating Halton’s sequence:  Write J as a number in base B (B is a prime number)  Reverse the digits  Put a radix point in front of the sequence It’s best practice to make each component of a Halton sequence with different prime base B Steps for creating Halton’s sequence:  Write J as a number in base B (B is a prime number)  Reverse the digits  Put a radix point in front of the sequence It’s best practice to make each component of a Halton sequence with different prime base B 3/10

4 Maximally spread-out order? 4/10

5 Sobol’ sequence  Between zero and one as binary fractions  Direction numbers and XOR  Better than Halton’s?  But is it efficient?  Between zero and one as binary fractions  Direction numbers and XOR  Better than Halton’s?  But is it efficient? 5/10 SobolHalton

6 Antonov and Saleev’s variant  Problem with j-th number?  Gray code  Generating directional numbers?  Problem with j-th number?  Gray code  Generating directional numbers? 6/10

7 Algorithm on CPU Two parts of the algorithm  Initialization  Generating random number Potential for optimization? Two parts of the algorithm  Initialization  Generating random number Potential for optimization? Void sobseq(…) { if (init) { /*initialization*/... } else { /*generating random number*/... //xor operations (direction num.)... } } 7/10

8 Maxeler comes to rescue else { im = in++; for (j = 1; j <= MAXBIT; j++) { if (!(im & 1)) break; im >>= 1; } if (j > MAXBIT) nrerror("MAXBIT too small in sobseq"); im = (j-1) * MAXDIM; for (k = 1; k <= IMIN(*n, MAXDIM); k++) { ix[k] ^= iv[im+k]; x[k] = ix[k] * fac; } else { im = in++; for (j = 1; j <= MAXBIT; j++) { if (!(im & 1)) break; im >>= 1; } if (j > MAXBIT) nrerror("MAXBIT too small in sobseq"); im = (j-1) * MAXDIM; for (k = 1; k <= IMIN(*n, MAXDIM); k++) { ix[k] ^= iv[im+k]; x[k] = ix[k] * fac; } DFEVar ix = io.input("ix", dfeUInt); DFEVar iv = io.input("iv", dfeUInt); DFEVar fac = io.scalarInput("fac", dfeFloat(8,24)); //ix[k] ^= iv[im+k]; //x[k] = ix[k] * fac; DFEVar ixOut = ixOut ^ iv; DFEVar x = ix * fac; io.output("ixOut", ixOut, dfeUInt); io.output("x", x, dfeFloat(8,24)); 8/10

9 SPEED! 9/10

10 References  Press, W., Teukolsky, S., Vetterling, W., Flannery, B., “Numerical Recipes in C The Art of Scientific Computing Second Edition” Cambridge University Press; 2 edition, October 1992  Milutinovic, V. et al, Paradigm Shift in SuperComputing: DataFlow vs ControlFlow, Journal of Big Data, 2015  Milutinovic, V., et al, Guide to DataFlow SuperComputing, Springer, 2015.  -, https://en.wikipedia.org/wiki/Sobol_sequence January 2016  -, http://lancaster.ac.uk January 2016 http://lancaster.ac.uk  Press, W., Teukolsky, S., Vetterling, W., Flannery, B., “Numerical Recipes in C The Art of Scientific Computing Second Edition” Cambridge University Press; 2 edition, October 1992  Milutinovic, V. et al, Paradigm Shift in SuperComputing: DataFlow vs ControlFlow, Journal of Big Data, 2015  Milutinovic, V., et al, Guide to DataFlow SuperComputing, Springer, 2015.  -, https://en.wikipedia.org/wiki/Sobol_sequence January 2016  -, http://lancaster.ac.uk January 2016 http://lancaster.ac.uk 10/10


Download ppt "Quasi Random Sequences Author: Stefan Ilijevski. Random sequences? 2/10."

Similar presentations


Ads by Google