<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Thanks for clarifying.  Yes, I’d argue the distinct seeds on the processes is an unsafe way to handle parallel RNG.<div class=""><div class=""> <br class=""><div class="">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;  ">-gideon</span>

</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On Dec 12, 2015, at 3:17 PM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov" class="">bsmith@mcs.anl.gov</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><br class=""><blockquote type="cite" class="">On Dec 12, 2015, at 2:09 PM, Gideon Simpson <<a href="mailto:gideon.simpson@gmail.com" class="">gideon.simpson@gmail.com</a>> wrote:<br class=""><br class="">Something about this continues to confuse me.  I’m attaching two simple examples using SPRNG+PETSc, which generate the same results.  Indeed, when run with mpi with more than one process, they generate different sequences of random numbers on reach process, but how is it handling this, if it’s not using SPRNG’s parallel RNG?<br class=""></blockquote><br class="">  We just put a different seed based on the MPI rank for each process; we do this for all the random number generators we use*.  Note the PETSc code that calls sprng is very short and simple and easily understood /src/sys/classes/random/impls/sprng/sprng.c<br class=""><br class="">Barry<br class=""><br class="">* I am not claiming this is a good idea, it is just what we do.<br class=""><blockquote type="cite" class=""><br class="">-gideon<br class=""><br class=""><br class=""><blockquote type="cite" class="">On Dec 11, 2015, at 5:31 PM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov" class="">bsmith@mcs.anl.gov</a>> wrote:<br class=""><br class=""><br class="">  I believe that we compile sprng with MPI but PETSc uses sprng only as a sequential random number generator hence I believe the comment is correct and should be left.<br class=""><br class="">  Barry<br class=""><br class=""><blockquote type="cite" class="">On Dec 11, 2015, at 1:51 PM, Gideon Simpson <<a href="mailto:gideon.simpson@gmail.com" class="">gideon.simpson@gmail.com</a>> wrote:<br class=""><br class="">It seems confused.  You can compile SPRNG with/without MPI.  However, even if you compile it with MPI support, it can still be run as a serial RNG.<br class=""><br class="">-gideon<br class=""><br class=""><blockquote type="cite" class="">On Dec 11, 2015, at 2:40 PM, Hong <<a href="mailto:hzhang@mcs.anl.gov" class="">hzhang@mcs.anl.gov</a>> wrote:<br class=""><br class="">Barry :<br class=""><blockquote type="cite" class="">there is a comment:<br class=""><br class="">  This is NOT currently using a parallel random number generator. Sprng does have<br class="">  an MPI version we should investigate.<br class=""></blockquote><br class="">Shall we remove this comment? <br class="">Hong<br class=""><br class=""><blockquote type="cite" class=""><blockquote type="cite" class="">On Dec 11, 2015, at 11:30 AM, Hong <<a href="mailto:hzhang@mcs.anl.gov" class="">hzhang@mcs.anl.gov</a>> wrote:<br class=""><br class="">Gideon:<br class="">I was looking at the source files and noticed in the comments that when petsc is built with sprng, the petsc interface isn’t to the parallel sprng RNG.  But is the package built with MPI, so that I could manually use the parallel RNG?<br class="">Petsc- sprng-1.0 interface was written many years ago.<br class="">It is for parallel computation. Students contributed an example at<br class="">petsc/src/sys/classes/random/examples/tutorials/ex2.c<br class=""><br class="">Very few users have ever used this interface.<br class="">If you encounter any problem, please report to us.<br class=""><br class="">Hong<br class=""><br class=""></blockquote><br class=""></blockquote><br class=""><br class=""></blockquote><br class=""></blockquote><br class=""></blockquote><br class=""><petsc_sprng1.c><petsc_sprng2.c><br class=""></blockquote><br class=""></div></div></blockquote></div><br class=""></div></div></body></html>