1 / 19

# Idan Zaguri Ran Tayeb 2014 - PowerPoint PPT Presentation

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

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## PowerPoint Slideshow about ' Idan Zaguri Ran Tayeb 2014' - gino

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

ParallelRandomNumberGenerator

IdanZaguri

Ran Tayeb

2014

• 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

• Well-known sequential techniques exist for generating, in a deterministicfashion.

• The number sequences are largely indistinguishable from true random sequences

• 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.

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.

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,…}

• Centralized

• Replicated

• Distributed

I. Computers Centralized Approach

• A sequential generator is encapsulated in a task from which other tasks request random numbers.

• Avoids the problem of generating multiple independent random sequences

• Unlikely to provide good performance

• Makes reproducibility hard to achieve

II. ComputersReplicated 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.

• Efficiency

• Ease of implementation

• Not guaranteed to be independent and, can suffer from serious correlation problems.

III Computers. Distributed Approach

• Responsibility for generating a single sequence is partitioned among many generators, which can then be parcelled out to different tasks.

• Efficiency

• Difficult to implement

L Computers

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

• T Computershe 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.

Distributed ComputersApproachesRandom Tree Method

• Useful to generate new random sequences.

• This is valuable, in applications in which new tasks and hence new random generators must be created dynamically.

• 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 Computers 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.

R Computers1

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.

GPUs- ComputersGaining Speedup Dependence on Random Number Generation

Performance on ComputersNvidia Tesla

SPRNG Computers

• 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

? Computers