Re: [Numpy-discussion] -ffast-math

2013-12-03 Thread Francesc Alted
On 12/2/13, 12:14 AM, Dan Goodman wrote: > Dan Goodman thesamovar.net> writes: > ... >> I got around 5x slower. Using numexpr 'dumbly' (i.e. just putting the >> expression in directly) was slower than the function above, but doing a >> hybrid between the two approaches worked well: >> >> def timef

Re: [Numpy-discussion] -ffast-math

2013-12-01 Thread Dan Goodman
Dan Goodman thesamovar.net> writes: ... > I got around 5x slower. Using numexpr 'dumbly' (i.e. just putting the > expression in directly) was slower than the function above, but doing a > hybrid between the two approaches worked well: > > def timefunc_numexpr_smart(): > _sin_term = sin(2.0*fr

Re: [Numpy-discussion] -ffast-math

2013-12-01 Thread Dan Goodman
Julian Taylor googlemail.com> writes: > > On 01.12.2013 22:59, Dan Goodman wrote: > > Julian Taylor googlemail.com> writes: > >> your sin and exp calls are loop invariants, they do not depend on the > >> loop iterable. > >> This allows to move the expensive functions out of the loop and only >

Re: [Numpy-discussion] -ffast-math

2013-12-01 Thread Julian Taylor
On 01.12.2013 22:59, Dan Goodman wrote: > Julian Taylor googlemail.com> writes: >> your sin and exp calls are loop invariants, they do not depend on the >> loop iterable. >> This allows to move the expensive functions out of the loop and only >> leave some simple arithmetic in the body. > > A

Re: [Numpy-discussion] -ffast-math

2013-12-01 Thread Dan Goodman
Julian Taylor googlemail.com> writes: > your sin and exp calls are loop invariants, they do not depend on the > loop iterable. > This allows to move the expensive functions out of the loop and only > leave some simple arithmetic in the body. A! I feel extremely stupid for not realising this!

Re: [Numpy-discussion] -ffast-math

2013-12-01 Thread Julian Taylor
On 01.12.2013 21:53, Dan Goodman wrote: > Julian Taylor googlemail.com> writes: >> can you show the code that is slow in numpy? >> which version of gcc and libc are you using? >> with gcc 4.8 it uses the glibc 2.17 sin/cos with fast-math, so there >> should be no difference. > > In trying to writ

Re: [Numpy-discussion] -ffast-math

2013-12-01 Thread Dan Goodman
Julian Taylor googlemail.com> writes: > can you show the code that is slow in numpy? > which version of gcc and libc are you using? > with gcc 4.8 it uses the glibc 2.17 sin/cos with fast-math, so there > should be no difference. In trying to write some simple code to demonstrate it, I realised i

Re: [Numpy-discussion] -ffast-math

2013-11-30 Thread Julian Taylor
On 29.11.2013 21:15, Dan Goodman wrote: > Hi, > > Is it possible to get access to versions of ufuncs like sin and cos but > compiled with the -ffast-math compiler switch? > > I recently noticed that my weave.inline code was much faster for some fairly > simple operations than my pure numpy code,

Re: [Numpy-discussion] -ffast-math

2013-11-29 Thread Pauli Virtanen
29.11.2013 22:15, Dan Goodman kirjoitti: > Is it possible to get access to versions of ufuncs like sin and cos but > compiled with the -ffast-math compiler switch? You can recompile Numpy with -ffast-math in OPT environment variable. Caveat emptor. -- Pauli Virtanen

[Numpy-discussion] -ffast-math

2013-11-29 Thread Dan Goodman
Hi, Is it possible to get access to versions of ufuncs like sin and cos but compiled with the -ffast-math compiler switch? I recently noticed that my weave.inline code was much faster for some fairly simple operations than my pure numpy code, and realised after some fiddling around that it was du