standard libraries
-
- Posts: 4313
- Joined: Jan 02, 2017 0:34
- Location: UK
- Contact:
Re: standard libraries
The easy part is over. I am now testing MsWsII.bas.
Most PRNGs are single sequenced, that is, the period can be represented as a circle of random numbers. All the FB generators are single sequenced and my implementations are as well except for PCG32II which has 2^63 different 'circles'. The original MsWs is also single sequenced. MsWsII has 16384 'circles' and one is chosen randomly for the 32-bit generator and two different 'circles' for the 64-bit generator. The 'circles' are pre-computed and loaded via "Mysvalues.bi" which can be easily cropped if needs be.
The Help file is the hard part and will take more than a rainy weekend to knock that out.
If anyone is champing at the bit to play with MsWsII.bas send me a private message and I will let you have a copy. If you have experience with PCG32II.bas or RomuTrio.bas then you should find MsWsII.bas straightforward. Treat it as a beta – I will be testing it for a few days yet.
Most PRNGs are single sequenced, that is, the period can be represented as a circle of random numbers. All the FB generators are single sequenced and my implementations are as well except for PCG32II which has 2^63 different 'circles'. The original MsWs is also single sequenced. MsWsII has 16384 'circles' and one is chosen randomly for the 32-bit generator and two different 'circles' for the 64-bit generator. The 'circles' are pre-computed and loaded via "Mysvalues.bi" which can be easily cropped if needs be.
The Help file is the hard part and will take more than a rainy weekend to knock that out.
If anyone is champing at the bit to play with MsWsII.bas send me a private message and I will let you have a copy. If you have experience with PCG32II.bas or RomuTrio.bas then you should find MsWsII.bas straightforward. Treat it as a beta – I will be testing it for a few days yet.
Re: standard libraries
I tried concatenating two 32 bit to get 64 bit output in the past, even with fb #5 generator.
I didn't get very far with pract rand if I remember, and anyway I had my own 64 bit generator to 2T so I didn't need to proceed with the idea.
But never mind, this is about fbmath, which confused me at first because member jdebord has an fbmath library, which is what I thought at first had been integrated.
I didn't get very far with pract rand if I remember, and anyway I had my own 64 bit generator to 2T so I didn't need to proceed with the idea.
But never mind, this is about fbmath, which confused me at first because member jdebord has an fbmath library, which is what I thought at first had been integrated.
-
- Posts: 4313
- Joined: Jan 02, 2017 0:34
- Location: UK
- Contact:
Re: standard libraries
I would like to see fbmath.bi disintegrated.
MsWsII will not put the kettle on and make us a cup of tea, but I am working on that.
MsWsII will not put the kettle on and make us a cup of tea, but I am working on that.
Re: standard libraries
I see j debord's library uses the 'fbmath.bi' file header too. Since fbc's is likely not used I will rename it. There was a discord discussion (I think) about adding in j debord's math library to the distribution.
-
- Posts: 4313
- Joined: Jan 02, 2017 0:34
- Location: UK
- Contact:
Re: standard libraries
MsWsII now has 16 procedures if used in 64-bit mode and is still being tested. One procedure which, I thought, had the potential to increase the throughput was removed because it did not come up to expectations. The Help file has been started.
I have several benchmark applications and one gave for a 32-bit [0,1) value, RND in FB's parlance, in a 64-bit mode request a throughput of 773MHz. The same test saw Mersenne Twister come in at 151MHz. So MsWsII is no slouch, being over five times faster. MsWsII passes PractRand to at least 16TB and needless to say MsWsII is thread safe as well.
I have several benchmark applications and one gave for a 32-bit [0,1) value, RND in FB's parlance, in a 64-bit mode request a throughput of 773MHz. The same test saw Mersenne Twister come in at 151MHz. So MsWsII is no slouch, being over five times faster. MsWsII passes PractRand to at least 16TB and needless to say MsWsII is thread safe as well.
Re: standard libraries
To many folk prng is meaningless.
There has to be some hint of random in the name.
FB Mersenne twister returns a double, so it has to be converted back to long or ulong for practrand or whatever, so no wonder it is slow.
To be fair a benchmark requiring doubles should be used to compare the fb random generators to others, if you have do not already have one.
There has to be some hint of random in the name.
FB Mersenne twister returns a double, so it has to be converted back to long or ulong for practrand or whatever, so no wonder it is slow.
To be fair a benchmark requiring doubles should be used to compare the fb random generators to others, if you have do not already have one.
-
- Posts: 4313
- Joined: Jan 02, 2017 0:34
- Location: UK
- Contact:
Re: standard libraries
For PractRand purposes, Mersenne Twister's source code should be used, allowing access to the 32-bit output; which is what I did some years ago. The author of PractRand V0.94 noticed that Mersenne Twister did not do as well as with V0.93. He didn't use FB's generator converting the double to 32-bit. In any case, PractRand is not interested in speed, so I did not understand your “so no wonder it is slow” comment. PractRand is not a benchmarking program.dodicat wrote:FB Mersenne twister returns a double, so it has to be converted back to long or ulong for practrand or whatever, so no wonder it is slow.
I have a few ways of benchmarking generators, but they differ in their determination of MHz throughput. That is not important. What is important is that we use the same test when comparing generators. In my last post, I mentioned MHz, but the significant remark was “being over five times faster” because every one can relate to that, no matter how fast their computer is.
Re: standard libraries
deltarho
It was you that said the twister was slow.
I said "for practrand or whatever".
It was you that said the twister was slow.
I said "for practrand or whatever".
-
- Posts: 4313
- Joined: Jan 02, 2017 0:34
- Location: UK
- Contact:
Re: standard libraries
@dodicat
Sorry, but I have no idea what you are getting at.
When I talk about being slow, I am referring to benchmarking. MsWsII is five times faster than Mersenne Twister in 64-bit mode. PractRand doesn't come into it.
When we talk about PractRand, speed doesn't come into it – it is solely concerned with randomness. Admittedly, if we convert Mersenne Twister's double output to 32-bit output then that will slow down PractRand's execution time, but PractRand doesn't know what we have done - it simply analyses data being fed to it.
The conversion may upset the randomness, so it is best to use a Mersenne Twister which outputs 32-bit. I did that years ago, and so did the author of PractRand.
You seem to be talking about randomness and speed in the same breath – they are separate issues.
Sorry, but I have no idea what you are getting at.
When I talk about being slow, I am referring to benchmarking. MsWsII is five times faster than Mersenne Twister in 64-bit mode. PractRand doesn't come into it.
When we talk about PractRand, speed doesn't come into it – it is solely concerned with randomness. Admittedly, if we convert Mersenne Twister's double output to 32-bit output then that will slow down PractRand's execution time, but PractRand doesn't know what we have done - it simply analyses data being fed to it.
The conversion may upset the randomness, so it is best to use a Mersenne Twister which outputs 32-bit. I did that years ago, and so did the author of PractRand.
You seem to be talking about randomness and speed in the same breath – they are separate issues.
Re: standard libraries
When you benchmarked along with the fb twister did you benchmark in doubles?
That is MsWsII converted to double. [0,1)
fb twister does not output a 32 bit integer.
That's all I wanted to know.
Sorry I mentioned practrand.
That is MsWsII converted to double. [0,1)
fb twister does not output a 32 bit integer.
That's all I wanted to know.
Sorry I mentioned practrand.
-
- Posts: 4313
- Joined: Jan 02, 2017 0:34
- Location: UK
- Contact:
Re: standard libraries
Oh dear, of course I did. Some people may compare apples with oranges, but you will never catch me doing that.dodicat wrote:When you benchmarked along with the fb twister did you benchmark in doubles?
Just for the record, in 32-bit mode, MsWsII is almost six times faster than Mersenne Twister.
Of course, if an application only needs a handful of random numbers, the speed advantage of MsWsII may not be noticeable.
With a complex statement, where the random number generation time is small compared to the execution time of the rest of the statement, the speed advantage of MsWsII may not be noticeable there either.
So if speed is not an issue, then why use MsWsII? MsWsII's quality of randomness is superior to Mersene Twister. MsWsII does not need a warm-up. Mersenne Twister requires a considerable warm-up. Scarcely any people are aware of that and do not do a warm-up. I rejected many generators because they required a warm-up. If they required a warm-up, then the generator may go through one or more 'bad patches' later. I am surprised that so-called pundits do not seem to be aware of that. By making such a statement, I am not putting myself forward as a pundit, but I do regard myself as a well-informed amateur.
-
- Posts: 4313
- Joined: Jan 02, 2017 0:34
- Location: UK
- Contact:
Re: standard libraries
When I refer to a “complex statement” that is a bit like asking how long is a piece of string. Without a thorough analysis, we will have no idea how relevant the random number generation time is. What we do know is that a statement, using random numbers, will execute faster with a faster generator, but by how much is anyone's guess.
Re: standard libraries
Your pcg32.randse() is much faster than rnd (with #2 or #3) if compiled 64 bits _Wc -O3.
And a bit slower with 32 bits.
And a bit slower with 32 bits.