[Numpy-discussion] eighteen bourbon

2006-06-13 Thread Nolly Sosa









___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Any Numeric or numarray users on this list?

2006-06-13 Thread konrad . hinsen
On 10.06.2006, at 01:57, Travis Oliphant wrote:

 You may be interested to note that I just added the RNG interface  
 to numpy for back-wards compatibility.  It can be accessed and used  
 by re-placing

 import RNG

 with

 import numpy.random.oldrng as RNG

Thanks, that will facilitate the transition. Is this just a  
compatible interface, or actually the same algorithm as in the  
original RNG module?

Konrad.
--
-
Konrad Hinsen
Centre de Biophysique Moléculaire, CNRS Orléans
Synchrotron Soleil - Division Expériences
Saint Aubin - BP 48
91192 Gif sur Yvette Cedex, France
Tel. +33-1 69 35 97 15
E-Mail: [EMAIL PROTECTED]
-




___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Any Numeric or numarray users on this list?

2006-06-13 Thread Robert Kern
[EMAIL PROTECTED] wrote:
 On 10.06.2006, at 01:57, Travis Oliphant wrote:
 
You may be interested to note that I just added the RNG interface  
to numpy for back-wards compatibility.  It can be accessed and used  
by re-placing

import RNG

with

import numpy.random.oldrng as RNG
 
 Thanks, that will facilitate the transition. Is this just a  
 compatible interface, or actually the same algorithm as in the  
 original RNG module?

Just the interface. Do you actually want to use the old algorithm, or are you
primarily concerned about matching old test results? The old algorithms are not
very good, so I really don't want to put them back into numpy. It should be easy
to roll out a separate RNG module that simply uses numpy instead of Numeric, 
though.

-- 
Robert Kern

I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth.
  -- Umberto Eco



___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Back to numexpr

2006-06-13 Thread Francesc Altet
A Dimarts 13 Juny 2006 19:47, Francesc Altet va escriure:
  - Support for both numpy and numarray (use the flag --force-numarray
  in setup.py).
 
  At first glance this looks like it doesn't make things to messy, so I'm
  in favor of incorporating this.

 Yeah. I thing you are right. It's only that we need this for our own things
 :)

Ooops! small correction here. I thought that you were saying that you were 
*not* in favour of supporting numarray as well, but you clearly was. Sorry 
about the misunderstanding.

Anyway, if David's idea of providing a thin numpy-compatible numarray layer is 
easy to implement, then great.

Cheers,

-- 
0,0   Francesc Altet     http://www.carabos.com/
V   V   Cárabos Coop. V.   Enjoy Data
 -


___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Back to numexpr

2006-06-13 Thread Tim Hochberg
Francesc Altet wrote:

Ei, numexpr seems to be back, wow! :-D

A Dimarts 13 Juny 2006 18:56, Tim Hochberg va escriure:
  

I've finally got around to looking at numexpr again. Specifically, I'm
looking at Francesc Altet's numexpr-0.2, with the idea of harmonizing
the two versions. Let me go through his list of enhancements and comment
(my comments are dedented):



Well, as David already said, he committed most of my additions some days 
ago :-)

  

- Enhanced performance for strided and unaligned data, specially for
lightweigth computations (e.g. 'a10'). With this and the addition of
the boolean type, we can get up to 2x better times than previous
versions. Also, most of the supported computations goes faster than
with numpy or numarray, even the simplest one.

Francesc, if you're out there, can you briefly describe what this
support consists of? It's been long enough since I was messing with this
that it's going to take me a while to untangle NumExpr_run, where I
expect it's lurking, so any hints would be appreciated.



This is easy. When dealing with strided or unaligned vectors, instead of 
copying them completely to well-behaved arrays, they are copied only when the 
virtual machine needs the appropriate blocks. With this, there is no need to 
write the well-behaved array back into main memory, which can bring an 
important bottleneck, specially when dealing with large arrays. This allows a 
better use of the processor caches because data is catched and used only when 
the VM needs it. Also, I see that David has added support for byteswapped 
arrays, which is great! 
  

I'm looking at this now. I imagine it will become clear eventually. I've 
clearly forgotten some stuff over the last few months. Sigh.

First I need to get it to compile here. It seems that a few GCCisms have 
crept back in.


[SNIP]

rarely used.



Uh, I'm afraid that yes. In PyTables, int64, while being a bit bizarre for 
some users (specially in 32-bit platforms), is a type with the same rights 
than the others and we would like to give support for it in numexpr. In fact, 
Ivan Vilata already has implemented this suport in our local copy of numexpr, 
so perhaps (I say perhaps because we are in the middle of a big project now 
and are a bit scarce of time resources) we can provide the patch against the 
latest version of David for your consideration. With this we can solve the 
problem with int64 support in 32-bit platforms (although addmittedly, the VM 
gets a bit more complicated, I really think that this is worth the effort)
  

In addition to complexity, I worry that we'll overflow the code cache at 
some point and slow everything down. To be honest I have no idea at what 
point that is likely to happen, but I know they worry about it with the 
Python interpreter mainloop. Also, it becomes much, much slower to 
compile past a certain number of case statements under VC7, not sure 
why. That's mostly my problem though.

One idea that might be worth trying for int64 is to special case them 
using functions. That is using OP_FUNC_LL and OP_FUNC_LLL and some 
casting opcodes. This could support int64 with relatively few new 
opcodes. There's obviously some exta overhead introduced here by the 
function call. How much this matters is probably a function of how well 
the compiler / hardware supports int64 to begin with.

That brings up another point. We probably don't want to have casting 
opcodes from/to everything. Given that there are 8 types on the table 
now, if we support every casting opcode we're going to have 56(?) 
opcodes just for casting. I imagine what we'll have to do is write a 
cast from int16 to float as OP_CAST_Ii; OP_CAST_FI; trading an extra 
step in these cases for keeping the number of casting opcodes under 
control. Once again, int64 is problematic since you lose precision 
casting to int. I guess in this case you could get by with being able to 
cast back and forth to float and int. No need to cast directly to 
booleans, etc as two stage casting should suffice for this.

-tim





___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Back to numexpr

2006-06-13 Thread Tim Hochberg
Francesc Altet wrote:

A Dimarts 13 Juny 2006 20:46, Tim Hochberg va escriure:
  

Uh, I'm afraid that yes. In PyTables, int64, while being a bit bizarre for
some users (specially in 32-bit platforms), is a type with the same rights
than the others and we would like to give support for it in numexpr. In
fact, Ivan Vilata already has implemented this suport in our local copy
of numexpr, so perhaps (I say perhaps because we are in the middle of a
big project now and are a bit scarce of time resources) we can provide
the patch against the latest version of David for your consideration.
With this we can solve the problem with int64 support in 32-bit platforms
(although addmittedly, the VM gets a bit more complicated, I really think
that this is worth the effort)
  

In addition to complexity, I worry that we'll overflow the code cache at
some point and slow everything down. To be honest I have no idea at what
point that is likely to happen, but I know they worry about it with the
Python interpreter mainloop.



That's true. I didn't think about this :-/

  

Also, it becomes much, much slower to 
compile past a certain number of case statements under VC7, not sure
why. That's mostly my problem though.



No, this is a general problem (I'd say much more in GCC, because the optimizer 
runs so slow). However, this should only affect to poor developers, not 
users and besides, we should find a solution for int64 in 32-bit platforms.
  

Yeah. This is just me whining. Under VC7, there is a very sudden change 
when adding more cases where compile times go from seconds to minutes. I 
think we're already past that now anyway, so slowing that down more 
isn't going to hurt me. Overflowing the cache is the real thing I worry 
about.

One idea that might be worth trying for int64 is to special case them
using functions. That is using OP_FUNC_LL and OP_FUNC_LLL and some
casting opcodes. This could support int64 with relatively few new
opcodes. There's obviously some exta overhead introduced here by the
function call. How much this matters is probably a function of how well
the compiler / hardware supports int64 to begin with.



Mmm, in my experience int64 operations are reasonable well supported by modern 
32-bit processors (IIRC they normally take twice of the time than int32 ops).

The problem with using a long for representing ints in numexpr is that we have 
the duality of being represented differently in 32/64-bit platforms and that 
could a headache in the long term (int64 support in 32-bit platforms is only 
one issue, but there should be more). IMHO, it is much better to assign the 
role for ints in numexpr to a unique datatype, and this should be int64, for 
the sake of wide int64 support, but also for future (and present!) 64-bit 
processors. The problem would be that operations with 32-bit ints in 32-bit 
processors can be slowed-down by a factor 2x (or more, because there is a 
casting now), but in exchange, whe have full portable code and int64 support. 
  

This certainly makes things simpler. I think that this would be fine 
with me since I mostly use float and complex, so the speed issue 
wouldn't hit me much. But that's 'cause I'm selfish that way ;-)

In case we consider entering this way, we have two options here: keep VM 
simple and advertise that int32 arithmetic in numexpr in 32-bit platforms 
will be sub-optimal, or, as we already have done, add the proper machinery to 
support both integer separately (at the expense of making the VM more 
complex).  Or perhaps David can come with a better solution (vmgen from 
gforth? no idea what this is, but the name sounds sexy;-) 
  

Yeah!

That brings up another point. We probably don't want to have casting
opcodes from/to everything. Given that there are 8 types on the table
now, if we support every casting opcode we're going to have 56(?)
opcodes just for casting. I imagine what we'll have to do is write a
cast from int16 to float as OP_CAST_Ii; OP_CAST_FI; trading an extra
step in these cases for keeping the number of casting opcodes under
control. Once again, int64 is problematic since you lose precision
casting to int. I guess in this case you could get by with being able to
cast back and forth to float and int. No need to cast directly to
booleans, etc as two stage casting should suffice for this.



Well, we already thought about this. Not only you can't safely cast an int64 
to an int32 without loosing precistion, but what is worse, you can't even 
cast it to any other commonly available datatype (casting to a float64 will 
also loose precision). And, although you can afford loosing precision when 
dealing with floating data in some scenarios (but not certainly with a 
general-purpose library like numexpr tries to be), it is by any means 
unacceptable loosing 'precision' in ints. So, to my mind, the only solution 
is completely avoiding casting int64 to any type.
  

I forgot that the various OP_CAST_xy opcodes only do safe 

Re: [Numpy-discussion] Atlas missing dgeev

2006-06-13 Thread Robert Kern
Mathew Yeates wrote:
 I finally got things linked with libg2c but now I get
 import linalg - failed: ld.so.1: python: fatal: relocation error: file 
 /u/fuego0/myeates/lib/python2.4/site-packages/numpy/linalg/lapack_lite.so: 
 symbol dgeev_: referenced symbol not found
 
 I looked all through my ATLAS source and I see no dgeenv anywhere.No 
 file of that name and no refernces to that function. Anybody know what 
 up with this?

ATLAS itself only provides optimized versions of some LAPACK routines. You need
to combine it with the full LAPACK to get full coverage. Please read the ATLAS
FAQ for instructions:

http://math-atlas.sourceforge.net/errata.html#completelp

-- 
Robert Kern

I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth.
  -- Umberto Eco



___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion