Parallel
This presentation is the property of its rightful owner.
Sponsored Links
1 / 19

Idan Zaguri Ran Tayeb 2014 PowerPoint PPT Presentation


  • 56 Views
  • Uploaded on
  • Presentation posted in: General

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

Download Presentation

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


Idan zaguri ran tayeb 2014

ParallelRandomNumberGenerator

IdanZaguri

Ran Tayeb

2014


Outline

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


Random numbers

Random Numbers

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

  • The number sequences are largely indistinguishable from true random sequences


Why to prefer pseudo random numbers

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.


The linear congruential generators lgc

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.


Idan zaguri ran tayeb 2014

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


Approaches to the generation of random numbers on parallel computers

Approaches to the Generation of Random Numbers on Parallel Computers

  • Centralized

  • Replicated

  • Distributed


I centralized approach

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


Ii replicated approach

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.


Iii distributed approach

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


Distributed approaches random tree method

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


Idan zaguri ran tayeb 2014

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


Distributed approaches random tree method1

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.


Idan zaguri ran tayeb 2014

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.


Idan zaguri ran tayeb 2014

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.


Gpus gaining speedup dependence on random number generation

GPUs-Gaining Speedup Dependence on Random Number Generation


Performance on nvidia tesla

Performance on Nvidia Tesla

  • http://software.intel.com/en-us/articles/gaining-speedup-in-a-parallelizable-workload-with-dependence-on-random-number-generation


Sprng

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


Idan zaguri ran tayeb 2014

?


  • Login