Re: [Numpy-discussion] Python ctypes and OpenMP mystery

2011-02-16 Thread Eric Carlson
Hello Francesc, The problem appears to related to my lack of optimization in the compilation. If I use gcc -O3 -c my_lib.c -fPIC -fopenmp -ffast-math the C executable and ctypes/python versions behave almost identically. Getting decent behavior takes some thought, though, far from the incredi

Re: [Numpy-discussion] OT: performance in C extension; OpenMP, or SSE ?

2011-02-16 Thread Eric Carlson
Sebastian, Optimization appears to be important here. I used no optimization in my previous post, so you could try the -O3 compile option: gcc -O3 -c my_lib.c -fPIC -fopenmp -ffast-math for na=329 and nb=340 I get (about 7.5 speedup) c_threads 1 time 0.00103106021881 c_threads 2 time 0.000

Re: [Numpy-discussion] Python ctypes and OpenMP mystery

2011-02-16 Thread Francesc Alted
A Saturday 12 February 2011 21:19:39 Eric Carlson escrigué: > Hello All, > I have been toying with OpenMP through f2py and ctypes. On the whole, > the results of my efforts have been very encouraging. That said, some > results are a bit perplexing. > > I have written identical routines that I run

Re: [Numpy-discussion] OT: performance in C extension; OpenMP, or SSE ?

2011-02-16 Thread Sebastian Haase
Update: I just noticed that using Eric's OpenMP code gave me only a 1.35x speedup when comparing 3 threads vs. my non OpenMP code. However, when comparing 3 threads vs. 1 thread, I could call this a 2.55x speedup. This obviously sounds much better, but is obviously not the number that matters... (E

[Numpy-discussion] Get the index of a comparison of two lists

2011-02-16 Thread FRENK Andreas
Hi, Thanks for the two solutions. Indeed, there are much faster than the brute force method using in. The setmember1d is deprecate din newer python releases, therefore I already switched to in1d(). (Thanks Josef.) Andreas ___ NumPy-Discussion mailing

Re: [Numpy-discussion] OT: performance in C extension; OpenMP, or SSE ?

2011-02-16 Thread Sebastian Haase
Eric, this is amazing !! Thanks very much, I have rarely seen such a compact source example that just worked. The timings I get are: c_threads 1 time 0.00155731916428 c_threads 2 time 0.000829789638519 c_threads 3 time 0.00061688839 c_threads 4 time 0.000704760551453 c_threads 5 t

[Numpy-discussion] unwrap enhancement?

2011-02-16 Thread Neal Becker
I want to use unwrap to process a sequence of segments, such that the sequence appears continous. That is, unwrap maintains a state which represents a multiple of 2\pi. I want to continue that state with the next call to unwrap. Or in other words, I'd like to specify an initial phase for the st

Re: [Numpy-discussion] OT: performance in C extension; OpenMP, or SSE ?

2011-02-16 Thread Sebastian Haase
Matthieu, I got it to run in valgrind (using the options from your blog). For dist2d() it says under "Types": -- Event Type Incl.SelfShort Formula -

[Numpy-discussion] SOLVED: f2py "target file xxx not generated"

2011-02-16 Thread Thomas Ingeman-Nielsen
Found a solution myself: I tried to compile the fib1.f file directly using the gfortran compiler, and found that indentation in the (fixed format) file was wrong. Correcting this took care of the "target file xxx not generated" error, but still an error resulted: ... ... error: Unable to find vcv

[Numpy-discussion] [ANN] New package: SpaceFuncs (2D, 3D, ND geometric modeling, optimization, solving)

2011-02-16 Thread Dmitrey
Hi all, I'm glad to inform you about new, 4th OpenOpt Suite module: SpaceFuncs - a tool for 2D, 3D, N-dimensional geometric modeling with possibilities of parametrized calculations, numerical optimization and solving systems of geometrical equations with automatic differentiation.

Re: [Numpy-discussion] OT: performance in C extension; OpenMP, or SSE ?

2011-02-16 Thread Sebastian Haase
Chris, OK, sorry -- I miss read (cdist doc says A and B must have same number of "columns"(!) not "rows"). On my machine I got the exact same timing as my (non OpenMP) C code. That is really got, compared to normal ufunc based numpy code. But my question in this thread is, how to get better than th

Re: [Numpy-discussion] convolving (or correlating) with sliding windows (Jonathan Hilmer)

2011-02-16 Thread Davide Cittaro
On 16/feb/2011, at 00:04, numpy-discussion-requ...@scipy.org wrote: > > I'm sorry that I don't have some example code for you, but you > probably need to break down the problem if you can't fit it into > memory: http://en.wikipedia.org/wiki/Overlap-add_method > > Jonathan Thanks! You saved my