On Sat, Jul 4, 2020, 2:39 PM Neal Becker <ndbeck...@gmail.com> wrote:

>
>
> On Sat, Jul 4, 2020 at 1:56 PM Robert Kern <robert.k...@gmail.com> wrote:
> ....
>
>>
>> 3. Is there a way of telling the number of draws a generator did?
>>>
>>> The use case is to checkpoint the number of draws and `.advance` the
>>> bit generator when resuming from the checkpoint. (The runs are longer
>>> then the batch queue limits).
>>>
>>
>> There are computations you can do on the internal state of PCG64 and
>> Philox to get this information, but not in general, no. I do recommend
>> serializing the Generator or BitGenerator (or at least the BitGenerator's
>> .state property, which is a nice JSONable dict for PCG64) for checkpointing
>> purposes. Among other things, there is a cached uint32 for when odd numbers
>> of uint32s are drawn that you might need to handle. The state of the
>> default PCG64 is much smaller than MT19937. It's less work and more
>> reliable than computing that distance and storing the original seed and the
>> distance.
>>
>> --
>> Robert Kern
>>
>
> Sorry, you lost me here.  If I want to save, restore the state of a
> generator, can I use pickle/unpickle?
>

Absolutely.
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion

Reply via email to