Abstract
SummarySeveral software efforts have been produced over the past few years in various programming languages to help developers handle pseudorandom streams partitioning. Parallel and distributed stochastic simulations can obviously benefit from this kind of high‒level tools. The latest release of the Java Development Kit (JDK 7) tries to tackle this problem by providing facilities to partition a pseudorandom stream across various threads thanks to the new class ThreadLocalRandom. Meanwhile, Java 7 offers a framework to split a problem in a divide and conquer way through the new class called ForkJoinPool. As any other Java thread pool, ForkJoin exploits threads as workers and manipulates the tasks that will be run on the workers. In ThreadLocalRandom, pseudorandom number generation is handled at a thread level. As a consequence, a scientific application taking advantage of a Java thread pool to parallelize its computation may suffer from a bad pseudorandom stream partitioning due to the behavior of ThreadLocalRandom. The present work introduces TaskLocalRandom, a task‒level alternative to ThreadLocalRandom that solves this partitioning problem and assigns an independent pseudorandom stream to each task run in the thread pool. TaskLocalRandom is compatible with existing Java thread pools such as Executors or ForkJoin. Copyright © 2014 John Wiley & Sons, Ltd.
Highlights
At the manycore era, simulation practitioners must take advantage of such powerful architectures
As we did not want to take any risks with our Pseudorandom Number Generator (PRNG) choice as a replacement to the LCG of ThreadLocalRandom, we focused on Crush-resistant PRNGs such as MRG32k3a
These results shows that TaskLocalRandom is about twice as fast as ThreadLocalRandom, requiring about 0.5 ms to pick up a random number whereas ThreadLocalRandom requires about 0.8 ms
Summary
Simulation practitioners must take advantage of such powerful architectures. The new release of the Java Development Kit 7 (JDK 7) addresses this need by focusing on the concurrency features of Java. Java 7 offers a couple of new tools to enhance the already existing concurrent package. A new framework called Fork/Join appears [Lea, 2000]. It provides an easy-to-use implementation of the divide and conquer paradigm through lightweight tasks. The divide and conquer paradigm suggests to split an important workload among several Processing Elements (PEs). Each PE will compute a subset of the whole workload. The results will be gathered when all the subtasks have returned their results
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have
More From: Concurrency and Computation: Practice and Experience
Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.