4 4 77048696 12 4 77048696 419002361 20 4 419002361 359536365 28 4 359536365 1352033326 36 4 1352033326 110641741 44 4 110641741 381785820 52 4 381785820 1285567426 60 4 1285567426 1431563226 68 4 1431563226 209567120 76 4 209567120 1253505579 5 5 24794531 13 5 24794531 573802814 21 5 573802814 1856187544 7 7 1644515420 15 7 1644515420 2112876142 23 7 2112876142 1968503915 31 7 1968503915 1955611126 39 7 1955611126 765630357 47 7 765630357 1139444001 55 7 1139444001 270947015 63 7 270947015 1340655074 71 7 1340655074 491956703 79 7 491956703 1918919825 11 January 2017 9:18:26.470 PM RANDOM_MPI - Master process: FORTRAN90 version The number of processors is P = 8 This program shows how a stream of random numbers 2 2 1790989824 10 2 1790989824 1683198519 18 2 1683198519 73248040 26 2 73248040 2009527797 34 2 2009527797 2038867620 42 2 2038867620 1252591377 50 2 1252591377 1071170776 58 2 1071170776 1217317213 66 2 1217317213 305320879 74 2 305320879 163898678 can be computed "in parallel" in an MPI program. We assume we are using a linear congruential random number generator or "LCRG", which takes 3 3 2035175616 11 3 2035175616 715426902 19 3 715426902 571678549 27 3 571678549 658367810 35 3 658367810 1999017808 43 3 1999017808 521081698 51 3 521081698 811819431 59 3 811819431 373693922 29 5 1856187544 1099641175 37 5 1099641175 1982386332 45 5 1982386332 2140623151 53 5 2140623151 698756315 an integer input and returns a new integer output: U = ( A * V + B ) mod C We assume that we want the MPI program to produce the same sequence of random values as a sequential program would - but we want each processor to compute one part of that sequence. We do this by computing a new LCRG which can compute every P'th entry of the original one. Our LCRG works with integers, but it is easy to turn each integer into a real number between [0,1]. LCRG parameters: A = 16807 B = 0 C = 2147483647 Let processor 0 generate the entire random number sequence. K ID Input Output 0 0 12345 1 0 12345 207482415 2 0 207482415 1790989824 67 3 373693922 1189580670 75 3 1189580670 1571045692 61 5 698756315 2023842041 1 1 207482415 9 1 207482415 1963079340 17 1 1963079340 728311420 25 1 728311420 1997725285 33 1 1997725285 2109273007 41 1 2109273007 1492592912 49 1 1492592912 1298239128 57 1 1298239128 122606898 65 1 122606898 208032885 73 1 208032885 1234426335 6 6 109854999 14 6 109854999 1702319868 22 6 1702319868 449112039 30 6 449112039 424962143 38 6 424962143 1905782366 46 6 1905782366 659760666 54 6 659760666 1556804409 62 6 1556804409 719698254 70 6 719698254 928429115 78 6 928429115 615853074 3 0 1790989824 2035175616 4 0 2035175616 77048696 5 0 77048696 24794531 6 0 24794531 109854999 7 0 109854999 1644515420 8 0 1644515420 1256127050 9 0 1256127050 1963079340 10 0 1963079340 1683198519 11 0 1683198519 715426902 12 0 715426902 419002361 13 0 419002361 573802814 14 0 573802814 1702319868 15 0 1702319868 2112876142 16 0 2112876142 319731802 17 0 319731802 728311420 18 0 728311420 73248040 19 0 73248040 571678549 20 0 571678549 359536365 21 0 359536365 1856187544 22 0 1856187544 449112039 23 0 449112039 1968503915 24 0 1968503915 512233723 25 0 512233723 1997725285 26 0 1997725285 2009527797 27 0 2009527797 658367810 28 0 658367810 1352033326 29 0 1352033326 1099641175 30 0 1099641175 424962143 31 0 424962143 1955611126 32 0 1955611126 718977347 33 0 718977347 2109273007 34 0 2109273007 2038867620 35 0 2038867620 1999017808 36 0 1999017808 110641741 37 0 110641741 1982386332 38 0 1982386332 1905782366 39 0 1905782366 765630357 40 0 765630357 227397275 41 0 227397275 1492592912 42 0 1492592912 1252591377 43 0 1252591377 521081698 44 0 521081698 381785820 45 0 381785820 2140623151 46 0 2140623151 659760666 47 0 659760666 1139444001 48 0 1139444001 1523644508 49 0 1523644508 1298239128 50 0 1298239128 1071170776 51 0 1071170776 811819431 52 0 811819431 1285567426 53 0 1285567426 698756315 54 0 698756315 1556804409 55 0 1556804409 270947015 56 0 270947015 1141149465 57 0 1141149465 122606898 58 0 122606898 1217317213 59 0 1217317213 373693922 60 0 373693922 1431563226 61 0 1431563226 2023842041 62 0 2023842041 719698254 63 0 719698254 1340655074 64 0 1340655074 991404394 65 0 991404394 208032885 66 0 208032885 305320879 67 0 305320879 1189580670 68 0 1189580670 209567120 69 0 209567120 321404760 70 0 321404760 928429115 71 0 928429115 491956703 72 0 491956703 504266371 73 0 504266371 1234426335 74 0 1234426335 163898678 75 0 163898678 1571045692 76 0 1571045692 1253505579 77 0 1253505579 853689183 78 0 853689183 615853074 79 0 615853074 1918919825 80 0 1918919825 376088129 LCRG parameters for P processors: AN = 1457850878 BN = 0 C = 2147483647 Have ALL the processors participate in computing the same random number sequence. K ID Input Output 0 0 12345 8 0 12345 1256127050 16 0 1256127050 319731802 24 0 319731802 512233723 32 0 512233723 718977347 40 0 718977347 227397275 48 0 227397275 1523644508 56 0 1523644508 1141149465 64 0 1141149465 991404394 72 0 991404394 504266371 80 0 504266371 376088129 69 5 2023842041 321404760 77 5 321404760 853689183 RANDOM_MPI - Master process: Normal end of execution. 11 January 2017 9:18:26.472 PM