100 likes | 253 Views
LFG Tutorial. Pat Burns, CSU FRCRC HPC Symposium August 14, 2012 See http://lamar.colostate.edu/~pburns/lfg.htm. Outline. Introductions and roles Introductory material r ng-intro.pdf (download from web site) Exercise #1, Buffon’s Needle problem
E N D
LFG Tutorial Pat Burns, CSU FRCRC HPC Symposium August 14, 2012 See http://lamar.colostate.edu/~pburns/lfg.htm
Outline • Introductions and roles • Introductory material • rng-intro.pdf (download from web site) • Exercise #1, Buffon’s Needle problem • Exercise #2: average and standard deviation • Lagged Fibonacci Generators • lfg.pdf (download from web site) • Exercise #3: download, review, upload, compile and run ranlf.f90 or ranlf.c (download from web site) • Parallel implementations
Advantages • Portable, no library calls • Fast • Excellent statistical properties • Use a large enough LFG to avoid issues with the ‘Birthday Spacings’ test • Easily parallelizable and scalable • Ability to checkpoint • Reproducible results
Deficiencies • Low-order bits are not random
In the Notes • X’s are (fixed point) integers • R’s are real (floating point) numbers • In the following slides, all are integers • Development is for signed, 32-bit integers • Could extend to unsigned 32- or 64-bit integers in C, or signed 64-bit integers in Fortran • Safest to initialize X array to 0 • Beware of masking a canonical bit
MPI Implementation Separate Memory Spaces 1 2 … nt-1 0 3 Task No. Each initialized separately via its Tausworthe generator
OpenMP Implementation Each column initialized separately via its Tausworthe generator Tausworthe Array LFG 2-d Array Thread No. … 1 2 nt-1 0 3 Shared Memory Space