2 ms·
Hey, are you interested in a faster way of doing Monte Carlo simulations using the GPU? Demo here: https://james.darpinian.com/money/ https://james.darpinian.co
by modeless 3y ago
Hey, are you interested in a faster way of doing Monte Carlo simulations using the GPU? Demo here: https://james.darpinian.com/money/ https://james.darpinian.com/money/
It runs a million scenarios in a few milliseconds which is fast enough to update the results (the percentage at the bottom) in real time as you drag sliders. It's several orders of magnitude faster than other Monte Carlo retirement simulators; so fast that it may not even feel like it's doing anything. But it really does run a million scenarios instantly.
- orangepurple 3y agoI don't trust your random number generator. It takes some effort to get extreme speeds out of them.
- modeless 3y agoThe speed comes from running thousands of simulations in parallel on the GPU. The random number generator doesn't have to be any faster for this to be a huge speedup. It's possible to use any one you like. I did validate the one I'm using against various others and found equivalent results. I also have the simulation implemented on the CPU as well to validate the correctness of the results.
- orangepurple 3y agoAre you suggesting you compared the result using Math.random() on CPU to the accelerated hash functions from https://www.shadertoy.com/view/XlGcRh https://www.shadertoy.com/view/XlGcRh (linked from your source code comments)?
- modeless 3y agoI believe that was one of the tests that I ran, yes. It was a long time ago. Obviously the results are not numerically identical when different RNGs are used but they converge as the number of iterations is increased. That said, I think you are right that the RNG could be improved, even if it doesn't affect the results right now.