Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion nbody code - any suggestions for improvement?

Received: by 10.101.218.17 with SMTP id v17mr888499anq.5.1307075849641;
        Thu, 02 Jun 2011 21:37:29 -0700 (PDT)
X-BeenThere: shedskin-discuss@googlegroups.com
Received: by 10.90.58.22 with SMTP id g22ls320426aga.2.gmail; Thu, 02 Jun 2011
 21:37:29 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.91.110.3 with SMTP id n3mr187063agm.5.1307075848984; Thu, 02
 Jun 2011 21:37:28 -0700 (PDT)
Received: by e35g2000yqc.googlegroups.com with HTTP; Thu, 2 Jun 2011 21:37:28
 -0700 (PDT)
Date: Thu, 2 Jun 2011 21:37:28 -0700 (PDT)
In-Reply-To: <BANLkTiki0pwfy7-FnhFe-93sbfg+u=a5iA@mail.gmail.com>
References: <BANLkTikqX2vMJbfZQFb1RSvbj-8zzurFfg@mail.gmail.com>
 <BANLkTimYPpAe-ONO+fqa3r=i=m1menN7KA@mail.gmail.com> <BANLkTim_TgrctZZYtGVbErc7rccQbGYSFw@mail.gmail.com>
 <BANLkTinVyyyZOou-WJwK4aNi5We79fCFhQ@mail.gmail.com> <BANLkTika3i3Et2XQ3A+_sUM60R=D8UofGQ@mail.gmail.com>
 <BANLkTi=B72H-QroTOjfUnC6z9JEq7NunUQ@mail.gmail.com> <BANLkTi=zABr9nKupPZj-Y_f7j3_Xpmb9SQ@mail.gmail.com>
 <BANLkTinUMpqxmEtWr46wq0P-39pmS1-E-g@mail.gmail.com> <BANLkTi=qppyDRRXEwHNqdy3RUgLH8Abxjw@mail.gmail.com>
 <BANLkTimwTwQYowiNOzv2fjUdzptTP-ZgNw@mail.gmail.com> <BANLkTimM7KOz4Gf=ma_ivji8Rg=5VhKgXQ@mail.gmail.com>
 <BANLkTi=r3Nq4qbz-rxVjRKibfUxoBF2bBw@mail.gmail.com> <BANLkTim1V3xukTO2i-tkKFuRr764MM4oRg@mail.gmail.com>
 <BANLkTikPe7Fx0gK+w-q+mw0xffKjiVJFhw@mail.gmail.com> <BANLkTine7Vzv2maqpwaqyzV1WZgEztkqTQ@mail.gmail.com>
 <BANLkTiki0pwfy7-FnhFe-93sbfg+u=a5iA@mail.gmail.com>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12)
 Gecko/20101026 SUSE/3.6.12-0.7.1 Firefox/3.6.12,gzip(gfe)
Message-ID: <0e30b413-0ec3-4fe8-adb2-73101792284e@e35g2000yqc.googlegroups.com>
Subject: Re: nbody code - any suggestions for improvement?
From: Mark Dewing <markdew...@gmail.com>
To: shedskin-discuss <shedskin-discuss@googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

I tried it using gcc 4.5.0 (on OpenSuse 11.3) and the version of
nbody.py in the shedskin examples (0.7.1.3).
Running with the default parameters on a Core 2 Duo, I get

4.0 seconds for -march=3Dnative
0.4 seconds for -ffast-math

One potential issue is the code raises values to the power of 0.5
rather than calling sqrt.  When I change the power to sqrt (either in
the python file or in the cpp file), the -march=3Dnative time drops to
2.8s.   (The -ffast-math time is unaffected).

Mark

On Jun 2, 6:02=A0am, Ian Ozsvald <i...@ianozsvald.com> wrote:
> Mark suggested I try -march=3Dnative as it'll enable SSE2 (I confess I'd
> forgotten that - the native architecture switches did give me small
> benefits in the past on e.g. Pentium, AMD64 specific platforms).
>
> Annoyingly this switch doesn't work in my g++ (4.2.1), the suggestion
> online is to use:
> -m64 -mtune=3Dcore2
> in its place. This doesn't make it run any faster. I also added
> --fast-math but the speed didn't change.
>
> Can someone else confirm Mark's -ffast-math switch improves
> performance without changing the numerical output?
>
> Ian.
>
> On 2 June 2011 10:52, Mark Dufour <mark.duf...@gmail.com> wrote:
>
>
>
>
>
> > On Thu, Jun 2, 2011 at 11:46 AM, Ian Ozsvald <i...@ianozsvald.com> wrot=
e:
>
> >> Sadly that's a right pain on MacOS and/or might get in the way of
> >> system libs. I know people do upgrade GCC but I'd frankly be a bit
>
> > I didn't mean to upgrade GCC, but to install a nice linux distro on a
> > separate partition.. :-) this distribution will probably upgrade your G=
CC
> > every 6 months or so for you.
>
> >> scared! I've nuked this machine once, I'm not losing a day again like
> >> that :-) I hope to give the timings another go on my bigger
> >> physics-office machine in a few weeks (but that's Windows - does
> >> ShedSkin work with MSVC?).
>
> > well, it doesn't really have to, because the windows version comes with=
 GCC
> > (4.5.. :-)).. but there is a hidden (-v) flag, to generate more or less=
 MSVC
> > compatible output (including makefile). I haven't heard of anyone tryin=
g
> > this recently, so I actually just made the option hidden for 0.8.. ther=
e's
> > also a hidden 'pypy' compatibility (iirc, -p) mode that someone sent a =
patch
> > for at one point.
>
> > mark.
> > --
> >http://www.youtube.com/watch?v=3DE6LsfnBmdnk
>
> > --
> > You received this message because you are subscribed to the Google Grou=
ps
> > "shedskin-discuss" group.
> > To post to this group, send email to shedskin-discuss@googlegroups.com.
> > To unsubscribe from this group, send email to
> > shedskin-discuss+unsubscribe@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/shedskin-discuss?hl=3Den.
>
> --
> Ian Ozsvald (A.I. researcher, screencaster)
> i...@IanOzsvald.com
>
> http://IanOzsvald.comhttp://SocialTiesApp.com/http://MorConsulting.com/ht=
tp://blog.AICookbook.com/http://TheScreencastingHandbook.comhttp://FivePoun=