[Lemon-devel] Strange running time results again
Alpár Jüttner
alpar at cs.elte.hu
Wed Jun 27 10:41:22 CEST 2007
Hi,
I managed attached the source instead of the results in my last mail.
Sorry for the confusion, I send the right attachment now.
On Wed, 2007-06-27 at 10:27 +0200, Alpár Jüttner wrote:
> Hi,
>
> I compiled the code you can see below. I used g++-4.1.2 with
> optimization flag -O2. The attached picture shows the running times of
> the iterations.
>
> Could anyone explain that strange "forking" tendency in the running
> times?
>
> Regards,
> Alpar
>
> #include <lemon/time_measure.h>
> #include <iostream>
>
> double mpower_sum(int size,double *m)
> {
> double s=0;
> for(int i=0;i<size;i++)
> for(int j=0;j<size;j++)
> for(int k=0;k<size;k++)
> s+=m[i*size+k]*m[k*size+j];
> return s;
> }
>
> int main(int argc,char **argv)
> {
> int size=1000;
> int step=10;
>
> double *m = (double *)malloc(sizeof(double)*(size*size+3));
> for(int i=0;i<size*size;i++) m[i]=i;
> for(int i=step;i<=size;i+=step)
> {
> lemon::Timer t;
> mpower_sum(i,m);
> std::cout << i << ' ' << t.realTime() << std::endl;
> }
> free(p);
> }
>
> _______________________________________________
> Lemon-devel mailing list
> Lemon-devel at lemon.cs.elte.hu
> http://lemon.cs.elte.hu/mailman/listinfo/lemon-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mpower.png
Type: image/png
Size: 4710 bytes
Desc: not available
URL: <http://lemon.cs.elte.hu/pipermail/lemon-devel/attachments/20070627/8b64788b/attachment.png>
More information about the Lemon-devel
mailing list