1 / 19

Idan Zaguri Ran Tayeb 2014

Parallel Random Number Generator. Idan Zaguri Ran Tayeb 2014. 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

gino
Télécharger la présentation

Idan Zaguri Ran Tayeb 2014

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ParallelRandomNumberGenerator IdanZaguri Ran Tayeb 2014

  2. Outline • Random Numbers • Why To Prefer Pseudo- Random Numbers • Application Areas • The Linear CongruentialGenerators - 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 deterministicfashion. • 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 CongruentialGenerators(LGC) • Generator is a function, when applied to a number, yields the next number in the sequence. For example: • Xk+1 = (a Xk + c) mod m X0, a, c , and m define the generator. • The   length of the repeated cycle is called the period of the generator.

  6. LGC • Bad example: Xk+1= (3*Xk+ 4) mod 8 Seq. = {1, 7, 1, 7, …} • Good example: Xk+1= (7*Xk+ 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. L R0 R1 R2 Distributed ApproachesRandom Tree Method • The random tree method employs two LGCs, L and R , that differ only in the values used for a. • Lk+1= aLLkmod m • Rk+1= aRRkmod m

  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. Distributed ApproachesRandom Tree Method • 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.

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

  15. R1 R0 L0 L1 L2 L3 L4 L5 L6 L7 L8 R2 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. ?

More Related