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)
Received: by 10.90.58.22 with SMTP id g22ls320426aga.2.gmail; Thu, 02 Jun 2011
21:37:29 -0700 (PDT)
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
Date: Thu, 2 Jun 2011 21:37:28 -0700 (PDT)
X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:184.108.40.206)
Gecko/20101026 SUSE/3.6.12-0.7.1 Firefox/3.6.12,gzip(gfe)
Subject: Re: nbody code - any suggestions for improvement?
From: Mark Dewing <markdew...@gmail.com>
To: shedskin-discuss <firstname.lastname@example.org>
Content-Type: text/plain; charset=ISO-8859-1
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).
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?
> 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=
> >> 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=
> > 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=
> > (4.5.. :-)).. but there is a hidden (-v) flag, to generate more or less=
> > compatible output (including makefile). I haven't heard of anyone tryin=
> > this recently, so I actually just made the option hidden for 0.8.. ther=
> > also a hidden 'pypy' compatibility (iirc, -p) mode that someone sent a =
> > for at one point.
> > mark.
> > --
> > --
> > You received this message because you are subscribed to the Google Grou=
> > "shedskin-discuss" group.
> > To post to this group, send email to email@example.com.
> > To unsubscribe from this group, send email to
> > firstname.lastname@example.org.
> > For more options, visit this group at
> Ian Ozsvald (A.I. researcher, screencaster)