You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Examples are very useful to comprehend a concept of running mkl_random using multiprocessing. However, writing a multi-processing orchestration code is labor intensive and error prone.
I am suggesting to design proper API for generalized MC runner with:
Capability to request independent random states/streams for a given number of workers. Follow NumPy recommended methods under the hood
n_streams: The number of independent streams brng: One of basic RNG available in mkl_random method: One of the following "default", "seed-sequencing", "leapfrog", "jump_ahead", "key-counter". The "leapfrog" method is applicable only for brng that supports the Leap Frogging technique of sub-sequencing random streams. The "key-counter" method is applicable for counter-based brng. Respectively, "jump_ahead" will be applicable to only brng that supports the Jumping/Skipping Ahead technique. The "seed-sequencing" will be universally supported by all brng.
The "default" method is brng specific. It will use seed sequencing technique for brng like MT19937. For MCG59 it will use the "leapfrog". For counter-based brng it will use unique the "key-counter" technique. The "seed-sequencing" will be the default method for the rest of brng.
The function will return the list [stream[0], ..., stream[n_streams-1] of size n_streams containing independent streams which can later be accessed by respective process's worker_id.
Capability to spawn the required number of processes from multiprocessing.Pool and perform a map operation for a user-supplied function local_task(worker_id, stream, *args, **kwargs).
The text was updated successfully, but these errors were encountered:
Examples are very useful to comprehend a concept of running
mkl_random
using multiprocessing. However, writing a multi-processing orchestration code is labor intensive and error prone.I am suggesting to design proper API for generalized MC runner with:
Possible API:
n_streams
: The number of independent streamsbrng
: One of basic RNG available in mkl_randommethod
: One of the following"default"
,"seed-sequencing"
,"leapfrog"
,"jump_ahead"
,"key-counter
". The"leapfrog"
method is applicable only forbrng
that supports the Leap Frogging technique of sub-sequencing random streams. The"key-counter"
method is applicable for counter-basedbrng
. Respectively, "jump_ahead" will be applicable to onlybrng
that supports the Jumping/Skipping Ahead technique. The"seed-sequencing"
will be universally supported by allbrng
.The
"default"
method isbrng
specific. It will use seed sequencing technique forbrng
like MT19937. For MCG59 it will use the"leapfrog"
. For counter-basedbrng
it will use unique the"key-counter"
technique. The"seed-sequencing"
will be the default method for the rest ofbrng
.The function will return the list
[stream[0], ..., stream[n_streams-1]
of sizen_streams
containing independent streams which can later be accessed by respective process'sworker_id
.multiprocessing.Pool
and perform a map operation for a user-supplied functionlocal_task(worker_id, stream, *args, **kwargs)
.The text was updated successfully, but these errors were encountered: