ichbinstudent opened a new pull request, #2186:
URL: https://github.com/apache/systemds/pull/2186

   # Summary
   Adding counter based RNG which improves random quality and speed
   
   # Details
   The PRNG uses Philox4x64_10 to generate batches of random double values with 
a 64 bit randomness. The algorithm was tested for correctness by comparing its 
output for certain counters and keys with an existing implementation in c.
   This reference implementation called 
[openRAND](https://github.com/msu-sparta/OpenRAND) was tested by the authors 
using various statistical methods described 
[here](https://www.sciencedirect.com/science/article/pii/S2352711024001444).
   
   ## Advantages
   - Quality: Instead of 32 bits in java.util.Random, Philox4_64 produces 64 
bits of randomness. While java.util.Random has a period of only (2^48), while 
the period of Philox4_64 is 2^256 - 1. 
   - Speed: While the Java version of Philox4x64_10 is only about half as fast 
as java.util.Random, there is a Cuda kernel version available producing the 
exact same sequence of random numbers. This means that the Cuda and Java 
versions can be used interchangeably. If a system has support for Cuda, the 
kernel ist used, if not, the Java version can be used as a fallback. The kernel 
version is around 200 times faster than java.util.Random, and even faster, if 
the results are not copied to the CPU but kept in the GPU's memory.
   - Parallelisation: When using state based PRNGs, it is impossible to 
generate the same random matrix when changing the block size. With counter 
based PRNGs it is possible to change the block size but still compute the same 
random matrix by using the global index (row * row_size + col) as the counter.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@systemds.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to