IBM / discrete-gaussian-differential-privacy

Code for Canonne-Kamath-Steinke paper https://arxiv.org/abs/2004.00010

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

can we sample large number of samples in parallel to enhance speed?

roy-ch opened this issue · comments

Our code itself can be run in parallel (since it is just a few functions with no global state). However, the underlying random number generator needs to be threadsafe.

I believe that the default RNG - random.SystemRandom() - is threadsafe as long as you have a different instance per thread (which is the default). However, each thread will be reading from the same /dev/urandom device, which could become a bottleneck, since I believe the generator for that is single-threaded.

You would need to consult the documentation and/or source code for the RNG to determine if it is threadsafe.

Our code itself can be run in parallel (since it is just a few functions with no global state). However, the underlying random number generator needs to be threadsafe.

I believe that the default RNG - random.SystemRandom() - is threadsafe as long as you have a different instance per thread (which is the default). However, each thread will be reading from the same /dev/urandom device, which could become a bottleneck, since I believe the generator for that is single-threaded.

You would need to consult the documentation and/or source code for the RNG to determine if it is threadsafe.

Could you give a code in a parallel version regardless of threadsafe? Thank you

Hi Roy, this seems like it shouldn't be hard to implement from a user's side, and is not something we plan to support at the moment.