gmpbench -- how to utilize all CPU cores?

Gabriel Risterucci cleyfaye at gmail.com
Fri Sep 27 12:37:52 CEST 2013


Unless I'm wrong, the GMP library itself doesn't take advantage of
multicores systems, so it don't "perform" better or worse in these cases.
The best you can get is multiple independant computations running on
different CPU as well as they would have been run sequentially on one core,
much like launching your code multiple time on different CPU. In this case,
parallel usages of GMP won't interfere with eachother.

-- 
Cley Faye
http://cleyfaye.net


2013/9/27 . <dcMhOYBdpZkH at web.de>

> The point is that almost all new Desktop-CPUs have multiple cores and to
> test how they perform parallel under load, including overhead, a multie
> threaded benchmark would be good. Also people could then see in the
> benchmark source code how to (proper) program for multiple CPU cores
> using the GMP library.
>
> On 26.09.2013 23:47, Mike Mohr wrote:
> > What would be the point?  Your benchmark would be an apples-to-oranges
> > comparison since you would need to take threading overhead into account
> and
> > other, older benchmarks would still represent single-threaded
> performance.
> > I haven't looked at the benchmark code recently, but I can't imagine that
> > it would be too hard to write some pthreads wrappers if you really wanted
> > to.
> >
> >
> > On Thu, Sep 26, 2013 at 12:18 PM, . <dcMhOYBdpZkH at web.de> wrote:
> >
> >> http://gmplib.org/gmpbench.html
> >>
> >> Good open source benchmark, but if I run it, it uses only one CPU core.
> >> Is it possible to use all CPU cores?
> >>
> >> My results for fun and info ("model name    : Intel(R) Core(TM)2 Duo
> >> CPU     T5450  @ 1.66GHz")
> >>
> >>     gmpbench-0.2$ ./runbench
> >>     ***** GMPbench version 0.2 *****
> >>     Using default CFLAGS = "-O3 -fomit-frame-pointer"
> >>     Using default CC = "gcc"
> >>     Using default LIBS = "-static -lgmp"
> >>     Using compilation command: gcc -O3 -fomit-frame-pointer foo.c -o foo
> >>     -static -lgmp
> >>     You may want to override CC, CFLAGS, and LIBS
> >>     Using gmp version: 5.1.2
> >>     Compiling benchmarks
> >>     Running benchmarks (propagated score accuracy exceeds printed
> >>     intermediates)
> >>       Category base
> >>         Program multiply (weight=1)
> >>           GMPbench.base.multiply(128)                        1.448e+07
> >>           GMPbench.base.multiply(512)                          2.4e+06
> >>           GMPbench.base.multiply(8192)                        2.37e+04
> >>           GMPbench.base.multiply(131072)                           505
> >>           GMPbench.base.multiply(2097152)                         18.5
> >>           GMPbench.base.multiply(128,128)                    1.036e+07
> >>           GMPbench.base.multiply(512,512)                    1.592e+06
> >>           GMPbench.base.multiply(8192,8192)                  1.694e+04
> >>           GMPbench.base.multiply(131072,131072)                    358
> >>           GMPbench.base.multiply(2097152,2097152)                 12.6
> >>           GMPbench.base.multiply(15000,10000)                     8551
> >>           GMPbench.base.multiply(20000,10000)                     6989
> >>           GMPbench.base.multiply(30000,10000)                     4383
> >>           GMPbench.base.multiply(16777216,512)                    44.7
> >>           GMPbench.base.multiply(16777216,262144)                 3.01
> >>         GMPbench.base.multiply                        5873.6
> >>         Program divide (weight=1)
> >>           GMPbench.base.divide(8192,32)                      3.055e+05
> >>           GMPbench.base.divide(8192,64)                      2.332e+05
> >>           GMPbench.base.divide(8192,128)                      1.09e+05
> >>           GMPbench.base.divide(8192,4096)                    3.065e+04
> >>           GMPbench.base.divide(131072,65536)                       448
> >>           GMPbench.base.divide(8388608,4194304)                   2.59
> >>           GMPbench.base.divide(8192,8064)                    3.026e+06
> >>           GMPbench.base.divide(16777216,262144)                   1.56
> >>         GMPbench.base.divide                          5812.8
> >>         Program gcd (weight=0.5)
> >>           GMPbench.base.gcd(128,128)                         6.351e+05
> >>           GMPbench.base.gcd(512,512)                         9.725e+04
> >>           GMPbench.base.gcd(8192,8192)                            1661
> >>           GMPbench.base.gcd(131072,131072)                        23.7
> >>           GMPbench.base.gcd(1048576,1048576)                      1.31
> >>         GMPbench.base.gcd                             1260.7
> >>         Program gcdext (weight=0.5)
> >>           GMPbench.base.gcdext(128,128)                      4.373e+05
> >>           GMPbench.base.gcdext(512,512)                      7.215e+04
> >>           GMPbench.base.gcdext(8192,8192)                         1073
> >>           GMPbench.base.gcdext(131072,131072)                     16.4
> >>           GMPbench.base.gcdext(1048576,1048576)                  0.816
> >>         GMPbench.base.gcdext                          853.54
> >>       GMPbench.base                           3284
> >>       Category app
> >>         Program rsa (weight=1)
> >>           GMPbench.app.rsa(512)                                   3824
> >>           GMPbench.app.rsa(1024)                                   675
> >>           GMPbench.app.rsa(2048)                                  98.5
> >>         GMPbench.app.rsa                              633.51
> >>         Program pi (weight=1)
> >>           GMPbench.app.pi(10000)                                   163
> >>           GMPbench.app.pi(100000)                                 7.26
> >>           GMPbench.app.pi(1000000)                               0.379
> >>         GMPbench.app.pi                               7.6546
> >>       GMPbench.app                          69.636
> >>     GMPbench:         478.21
> >>
> >> --
> >> OpenPGP key:
> >>
> https://keyserver2.pgp.com/vkd/DownloadKey.event?keyid=0xCDDFDD67A48E0139
> >>
> >> _______________________________________________
> >> gmp-discuss mailing list
> >> gmp-discuss at gmplib.org
> >> https://gmplib.org/mailman/listinfo/gmp-discuss
> >>
> > _______________________________________________
> > gmp-discuss mailing list
> > gmp-discuss at gmplib.org
> > https://gmplib.org/mailman/listinfo/gmp-discuss
>
>
> --
> OpenPGP key:
> https://keyserver2.pgp.com/vkd/DownloadKey.event?keyid=0xCDDFDD67A48E0139
>
> _______________________________________________
> gmp-discuss mailing list
> gmp-discuss at gmplib.org
> https://gmplib.org/mailman/listinfo/gmp-discuss
>


More information about the gmp-discuss mailing list