out-of-line and arch-specific random_device
Marc Glisse
marc.glisse@inria.fr
Tue Aug 28 07:47:00 GMT 2012
On Mon, 27 Aug 2012, Ulrich Drepper wrote:
> This is done in the attached patch. It's rather ugly because of the
> business with the TR1 support. Is this really still needed? Can't we
> remove that? It really makes not much sense for a random_device to be
> predictable.
Er, I haven't read the context, but for simulations physicists usually
require that random generators can be repeated, so 2 simulations with the
same seed give the same results. But that may not be what you meant with
predictable.
> Anyway, another change in the patch is support for a less expensive
> implementation on Ivy Bridge processors. That processor has the
> rdrand instruction. The code uses it if the instruction is usable.
> Has been tested on real hardware. This is not the type of
> arch-specific code I meant earlier. Will get to that tomorrow.
>
> There are other architectures with similar instructions. Adding
> support for those will be simple.
I assume they are different enough that they can't all be abstracted
behind a nice common builtin (with default implementation in libgcc
and/or a macro advertising fast implementations of it) :-(
--
Marc Glisse
More information about the Libstdc++
mailing list