[Numpy-svn] [numpy/numpy] 94172e: ENH: replace GIL of random module with a per state...

GitHub noreply at github.com
Sun May 4 13:51:44 EDT 2014


  Branch: refs/heads/master
  Home:   https://github.com/numpy/numpy
  Commit: 94172e1bbaf48e121f90d0252e33dc9f433b1534
      https://github.com/numpy/numpy/commit/94172e1bbaf48e121f90d0252e33dc9f433b1534
  Author: Julian Taylor <jtaylor.debian at googlemail.com>
  Date:   2014-05-02 (Fri, 02 May 2014)

  Changed paths:
    M doc/release/1.9.0-notes.rst
    M numpy/random/mtrand/mtrand.pyx
    M numpy/random/mtrand/numpy.pxd
    M numpy/random/tests/test_random.py

  Log Message:
  -----------
  ENH: replace GIL of random module with a per state lock

The random module currently relies on the GIL for the state
synchronization which hampers threading performance.
Instead add a lock to the RandomState object and take it for all
operations calling into randomkit while releasing the GIL.
This allows parallizing random number generation using multiple states
or asynchronous generation in a worker thread.

Note that with a large number of threads the standard mersenne twister
used may exhibit overlap if the number of parallel streams is large
compared to the size of the state space, though due to the limited
scalability of Python in regards to threads this is likely not a big
issue.


  Commit: 34fc091a28c62102522c6edc3015beb424d781a9
      https://github.com/numpy/numpy/commit/34fc091a28c62102522c6edc3015beb424d781a9
  Author: Charles Harris <charlesr.harris at gmail.com>
  Date:   2014-05-04 (Sun, 04 May 2014)

  Changed paths:
    M doc/release/1.9.0-notes.rst
    M numpy/random/mtrand/mtrand.pyx
    M numpy/random/mtrand/numpy.pxd
    M numpy/random/tests/test_random.py

  Log Message:
  -----------
  Merge pull request #4609 from juliantaylor/random-gil

ENH: replace GIL of random module with a per state lock


Compare: https://github.com/numpy/numpy/compare/19feb8849392...34fc091a28c6


More information about the Numpy-svn mailing list