
On 01/25/2012 08:55 PM, John Salmon wrote:
A couple of weeks ago, I asked if there was interest in a parallel RNG in boost. Here's a pointer to my original post:.
http://lists.boost.org/Archives/boost/2012/01/189293.php
Our paper on parallel random number generators is here: http://dl.acm.org/citation.cfm?doid=2063405 also available at http://www.thesalmons.org/john/random123/papers/random123sc11.pdf
Source (non-boost) is available here: http://deshawresearch.com/resources_random123.html
And software that might be a starting point for a boost contribution is here: http://thesalmons.org/john/random123/prf_boost/prf_boost.zip
Feedback is appreciated.
The above code seems quite more readable than the one from the deshawresearch website, but also a bit shorter. Does it do everything the deshawresearch does? I see you're using inline asm for mulq on GCC, but you don't use __umulh for MSVC. I can't see any hit for _mm_clmulepi64_si128 (which I assume would be useful). Your cpuid code won't work with gcc -m32 -fPIC, and also doesn't appear to take care of register trashing properly. I also don't really think the code should do any cpuid check at all, since emitting AESNI instructions requires -maes, and whenever you use -maes the compiler is free to emit AESNI instructions whenever it wants. From what I see, you only use SSE instructions if AESNI is available. Is that really desirable? There is a library proposed for Boost that abstracts SIMD instructions and scalar built-ins (Boost.SIMD), it might be interesting to use it / extend it to take care of all the platform-specific bits. In any case I think this would be a very interesting contribution to Boost and the open-source community in general.