1 / 23

Algorithm 806: SPRNG

Algorithm 806: SPRNG. A scalable Library for pseudorandom number generation. About: Pseudo-random Libraries. Many Libraries Parameterization – based libraries Erroneous => Real world applications New Library – SPRNG Purpose of SPRNG ?. Introduction. Problems:

Download Presentation

Algorithm 806: SPRNG

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. Algorithm 806: SPRNG A scalable Library for pseudorandom number generation

  2. About: Pseudo-random Libraries • Many Libraries • Parameterization – based libraries • Erroneous => Real world applications • New Library – SPRNG • Purpose of SPRNG ?

  3. Introduction • Problems: • Erroneous => Monte Carlo Applications • High Performance Cycles • Parallelism – More Complicates • Solution: • SPRNG – Scalable and Distributed Architecture

  4. PARALLEL Pseudorandom-number generation • Methods - Parameterization • Linear Congruential Generators: • Commonly used generator • Linear Recursion : • Periodic Sequence

  5. Prime modulus • ‘m’ is prime • Determine family of a’s • Obtain Maximal period • ‘i ’ relatively prime to Produce Primitive element ‘j’: PROBLEM: Overall efficiency of PPRNG ? • Cost of Computing or • cost of modular multiplication

  6. Exponential Sum: • Full period • Partially period • Upper Bounds: Equidistributed • Parallel: • Exponential Sum Correlation is :

  7. Upper Bound: • Open Questions: • Choosing ‘m’ ? A. Fast modular multiplication or fast calculation of jth integer • Good intrastream correlation also ensure good intrastream independence to performance ? • Hence  Such techniques are less attractive for parallel Pseudo random number generation.

  8. Lagged- Fibonacci Generator • Previous: Varying parameters - recursion • Now: Parameterized – Initial Value • ALFG Equation: • Popular : Serial and Scalable Parallel Machines • Reasons: • 1. Easy to implement • 2. Cheap to compute • It does well on statistical tests

  9. Maximal Period : • Template :

  10. O(K*K) Template : • Advantage: • Optimal Disadvantage : No proof and improvement of this analytical is open challenge

  11. Advantage: Good for Floating point • However, care must be taken to maintain the uniqueness of the parallel streams

  12. SPRNG • Random Number streams to parallel processes • Advantages: • 1. Several, Distinct, Well tested, Scalable PRNGs • 2. Initailization without Inter process communication • 3. Reproducibility • 4. Minimization of Interprocesscorrealtion • 5. Uniformity • 6. Integrated Test Suites • 7. Extensibility

  13. Generators • Additive lagged Fibonacci • Multiplicative Lagged Fibonacci • Prime Modules Multiplicative Congruential • Power-of-two modules linear Congruential • Combined Multiplicative Recursive generator

  14. Examples • Download: • http://sprng.cs.fsu.edu • Definition: init_sprng routine • int *init_sprng(int streamnum, int nstreams, int seed, int param)

  15. #include <cstdio> • #define SIMPLE_SPRNG /* simple interface */ • #include "sprng.h" /* SPRNG header file */ • using namespace std; • int main() • { • double rn; • int i; • printf(" Printing 3 random numbers in [0,1):\n"); • for (i=0;i<3;i++) • { • rn = sprng(); /* generate double precision random number */ • printf("%f\n",rn); • } • return 0; • }

  16. Execution • $> ./simple-simple • Printing 3 random numbers in [0,1): • 0.014267 • 0.749392 • 0.007316

  17. SPRNG TEST SUITE • Intrastream Correlation • Interstream Correlation • Statistical Test

  18. Example: • test.lib nstreamsncombine seed paramnblocks skip • Ex: eqi-distance.lcg 4 2 0 0 3 1 2 100 • mpirun -np 2 equidistnce.lcg 4 2 0 0 3 1 2 100 • Result: • mpirun -np 2 eqidist.lcg 4 2 0 0 3 1 2 1 00 • eqidistance.lcg 4 2 0 0 3 1 2 100 • KS value : 0.601252 • KS value prob : 17.50 • Hence, It is b/w 2.5% and 97.5% It is passed

  19. There are different tests that are described by Knuth are described in SPRNG library such as • Collision tests • Coupons Collector tests • Equidistance tests • Gap test • Permutation tests • Poker tests • Serial test

  20. Physically Based Tests: • Ising Model : • Random Walk Test:

  21. CONCLUSION • Comprehensive Library • Recursions are simple • Reusable • Extensibility • Uniformity : C, C++, MPI and FORTRAN

  22. REFERENCES • http://sprng.cs.fsu.edu • http://www.naadsm.org/opensource/sprng • http://www.cs.sunysb.edu/~algorith/implement/sprng/implement.shtml • https://computing.llnl.gov/LCdocs/math/index.jsp?show=s4.6 • http://www.berniepope.id.au/sprng.html

More Related