Lars Buitinck <larsm...@gmail.com> wrote:

> Liblinear uses bad old rand() for its random numbers. That's known to
> vary per platform and hard to correctly seed (it's not even
> thread-safe).

Few PRNGs are thread-safe: 

- If you protect the PRNG with a mutex, you will still get a race condition
from non-deterministic thread scheduling in the operating system. That
means you don't get a deterministic simulation from a fixed random seed.
I.e. the PRNG is not algorithmically thread-safe, even though access to the
PRNG is serialized. A rand() function might be re-entrant, but that it not
sufficient to call it thread-safe! (Ignoring this is a common programming
mistake!) 

- If you provide each thread with its own PRNG, you must make sure the
sequences don't overlap. Just using a different seed for each thread is not
safe either. 

You would need something like DCMT to get a really thread-safe PRNG. There
are also some PRNGs that allows you to jump ahead to the n-th state in the
sequence in O(1) time.  Those can be used for multithreading as well. 

http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/DC/dc.html


Sturla


------------------------------------------------------------------------------
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to