Hello!
I'd like to announce a new small project of mine – pibench2. It's a multi-threaded performance benchmark, written in Nim.
https://github.com/liquid600pgm/pibench2
Feel free to share your scores. Mine is 5.9649s with the default settings, on an AMD Ryzen 5 1600 (overclocked to 3.8GHz).
There might be a problem with the multithreading.
Mine is 8.2615s on a i9-9980XE (overclocked to 4.1 GHz).
32-bit system:
69.8084 s on an Intel Atom N470 @ 1.83Ghz 2 threads running on parrot Linux 4.10.0-parrot-20t-686-pae i686 with 1GB memory.
#took 641.2780 s -- oops! default nimble build is debug
took 136.6434 s
1.6 GHz Intel Core i5 (2 cores), 8 GB RAM
I noticed it taking 350% of CPU, which seems too high. Is it supposed to auto-detect?
I've done a very quick & dirty rewrite with OpenMP instead of Nim threads, and can get 0.5 seconds instead of 8 seconds.
I think there is too much lock contention when lots of cores are present on the machine.
Unfortunately it doesn't seem like OpenMP works with Channels so for progressbar display it only shows core 0 at the moment. Also the result I get is: 3.141592649989267 instead of 3.141592653489267 so it still needs some debugging work.
In any case here is the openmp branch: https://github.com/mratsim/pibench2/tree/openmp-version. It needs to be compiled with -d:openmp. Note that stacktraces should be off to avoid segfaulting (which is true in release mode), otherwise Nim will allocate strings for stacktraces on threads with no GC initialised (unless you use setupForeignThreadGc())