Presentation is loading. Please wait.

Presentation is loading. Please wait.

Idan Zaguri Ran Tayeb 2014 Parallel Random Number Generator.

Similar presentations


Presentation on theme: "Idan Zaguri Ran Tayeb 2014 Parallel Random Number Generator."— Presentation transcript:

1 Idan Zaguri Ran Tayeb 2014 Parallel Random Number Generator

2 Outline  Random Numbers Why To Prefer Pseudo- Random Numbers Application Areas The Linear Congruential Generators - LGC  Approaches to the Generation of Random Numbers on Parallel Computers Centralized Replicated Distributed  GPUs  SPRNG

3 Random Numbers  Well-known sequential techniques exist for generating, in a deterministic fashion.  The number sequences are largely indistinguishable from true random sequences

4 Why To Prefer Pseudo- Random Numbers  True random numbers are rarely used in computing because: difficult to generate There is no way to reproduce the same sequence again.  Computers use pseudo-random numbers: finite sequences generated by a deterministic process but indistinguishable, by some set of statistical tests, from a random sequence.

5 The Linear Congruential Generators (LGC)  Generator is a function, when applied to a number, yields the next number in the sequence. For example:  X k+1 = (a X k + c) mod m X 0, a, c, and m define the generator.  The length of the repeated cycle is called the period of the generator.

6 LGC  Bad example: X k +1 = (3*X k + 4) mod 8 Seq. = {1, 7, 1, 7, …}  Good example: X k +1 = (7*X k + 5) mod 18 Seq. = {1, 12, 17, 16, 9, 14, 13, 6, 11, 10, 3, 8, 7, 0, 5, 4, 15, 2, 1,…}

7 Approaches to the Generation of Random Numbers on Parallel Computers  Centralized  Replicated  Distributed

8 I. Centralized Approach  A sequential generator is encapsulated in a task from which other tasks request random numbers.  Advantages: Avoids the problem of generating multiple independent random sequences  Disadvantages: Unlikely to provide good performance Makes reproducibility hard to achieve

9 II. Replicated Approach  Multiple instances of the same generator are created (one per task).  Each generator uses either the same seed or a unique seed, derived, for example, from a task identifier.  Advantages: Efficiency Ease of implementation  Disadvantages: Not guaranteed to be independent and, can suffer from serious correlation problems.

10 III. Distributed Approach  Responsibility for generating a single sequence is partitioned among many generators, which can then be parcelled out to different tasks.  Advantages: Efficiency  Disadvantages: Difficult to implement

11 Distributed Approaches Random Tree Method  The random tree method employs two LGCs, L and R, that differ only in the values used for a.  L k+1 = a L L k mod m  R k+1 = a R R k mod m R1 L R0 R2

12  The same seed on both Left & Right Generators generates different random sequences.  By applying the right generator to elements of the left generator's sequence (or vice versa), a tree of random numbers can be generated.  By convention, the right generator R is used to generate random values for use in computation, while the left generator L is applied to values computed by R to obtain the starting points R0, R1, etc., for new right sequences.

13  Advantages: Useful to generate new random sequences. This is valuable, in applications in which new tasks and hence new random generators must be created dynamically.  Disadvantages: There is no guarantee that different right sequences will not overlap. If two starting points happen to be close to each other, the two right sequences that are generated will be highly correlated. Distributed Approaches Random Tree Method

14  A variant of the random tree method  Used to generate sequences that can be guaranteed not to overlap for a certain period. Distributed Approaches The Leapfrog Method

15 L0L0 L1L1 L2L2 L3L3 L4L4 L5L5 L6L6 L7L7 L8L8 R0R0 R1R1 R2R2 The leapfrog method with n=3. Each of the right generators selects a disjoint subsequence of the sequence constructed by the left generator’s sequence.

16 GPUs- Gaining Speedup Dependence on Random Number Generation

17 Performance on Nvidia Tesla  http://software.intel.com/en-us/articles/gaining-speedup-in-a-parallelizable-workload- with-dependence-on-random-number-generation

18 SPRNG  A “Scalable Library for Pseudorandom Number Generation”,  Designed to use parametrized pseudorandom number generators to provide random number streams to parallel processes.  Includes Reproducibility controlled by a single “global” seed A uniform C, C++, Fortran and MPI interface

19 ?


Download ppt "Idan Zaguri Ran Tayeb 2014 Parallel Random Number Generator."

Similar presentations


Ads by Google