[Numpy-discussion] numpy revision 3056 will not build on RHE3 or Solaris

2006-08-24 Thread Christopher Hanley
Good Morning,

Numpy revision 3056 will not build on either Red Hat Enterprise 3 or 
Solaris 8.  The relevant syntax errors are below:

For RHE3:
-

creating build/temp.linux-i686-2.4
creating build/temp.linux-i686-2.4/numpy
creating build/temp.linux-i686-2.4/numpy/core
creating build/temp.linux-i686-2.4/numpy/core/src
compile options: '-Ibuild/src.linux-i686-2.4/numpy/core/src 
-Inumpy/core/include -Ibuild/src.linux-i686-2.4/numpy/core 
-Inumpy/core/src -Inumpy/core/include 
-I/usr/stsci/pyssgdev/Python-2.4.2/include/python2.4 -c'
gcc: numpy/core/src/multiarraymodule.c
In file included from numpy/core/include/numpy/arrayobject.h:19,
  from numpy/core/src/multiarraymodule.c:25:
numpy/core/include/numpy/npy_interrupt.h:95: syntax error before 
_NPY_SIGINT_BUF
numpy/core/include/numpy/npy_interrupt.h:95: warning: type defaults to 
`int' in declaration of `_NPY_SIGINT_BUF'
numpy/core/include/numpy/npy_interrupt.h:95: warning: data definition 
has no type or storage class
numpy/core/include/numpy/npy_interrupt.h: In function `_npy_sighandler':
numpy/core/include/numpy/npy_interrupt.h:100: `SIG_IGN' undeclared 
(first use in this function)
numpy/core/include/numpy/npy_interrupt.h:100: (Each undeclared 
identifier is reported only once
numpy/core/include/numpy/npy_interrupt.h:100: for each function it 
appears in.)
numpy/core/include/numpy/npy_interrupt.h:101: warning: implicit 
declaration of function `longjmp'
numpy/core/src/multiarraymodule.c: In function `test_interrupt':
numpy/core/src/multiarraymodule.c:6441: `SIGINT' undeclared (first use 
in this function)
numpy/core/src/multiarraymodule.c:6441: warning: implicit declaration of 
function `setjmp'
In file included from numpy/core/include/numpy/arrayobject.h:19,
  from numpy/core/src/multiarraymodule.c:25:
numpy/core/include/numpy/npy_interrupt.h:95: syntax error before 
_NPY_SIGINT_BUF
numpy/core/include/numpy/npy_interrupt.h:95: warning: type defaults to 
`int' in declaration of `_NPY_SIGINT_BUF'
numpy/core/include/numpy/npy_interrupt.h:95: warning: data definition 
has no type or storage class
numpy/core/include/numpy/npy_interrupt.h: In function `_npy_sighandler':
numpy/core/include/numpy/npy_interrupt.h:100: `SIG_IGN' undeclared 
(first use in this function)
numpy/core/include/numpy/npy_interrupt.h:100: (Each undeclared 
identifier is reported only once
numpy/core/include/numpy/npy_interrupt.h:100: for each function it 
appears in.)
numpy/core/include/numpy/npy_interrupt.h:101: warning: implicit 
declaration of function `longjmp'
numpy/core/src/multiarraymodule.c: In function `test_interrupt':
numpy/core/src/multiarraymodule.c:6441: `SIGINT' undeclared (first use 
in this function)
numpy/core/src/multiarraymodule.c:6441: warning: implicit declaration of 
function `setjmp'
error: Command gcc -fno-strict-aliasing -DNDEBUG -g -O3 -Wall 
-Wstrict-prototypes -fPIC -Ibuild/src.linux-i686-2.4/numpy/core/src 
-Inumpy/core/include -Ibuild/src.linux-i686-2.4/numpy/core 
-Inumpy/core/src -Inumpy/core/include 
-I/usr/stsci/pyssgdev/Python-2.4.2/include/python2.4 -c 
numpy/core/src/multiarraymodule.c -o 
build/temp.linux-i686-2.4/numpy/core/src/multiarraymodule.o failed with 
exit status 1


For Solaris 8:
--

creating build/temp.solaris-2.8-sun4u-2.4
creating build/temp.solaris-2.8-sun4u-2.4/numpy
creating build/temp.solaris-2.8-sun4u-2.4/numpy/core
creating build/temp.solaris-2.8-sun4u-2.4/numpy/core/src
compile options: '-Ibuild/src.solaris-2.8-sun4u-2.4/numpy/core/src 
-Inumpy/core/include -Ibuild/src.solaris-2.8-sun4u-2.4/numpy/core 
-Inumpy/core/src -Inumpy/core/include 
-I/usr/ra/pyssg/Python-2.4.2/include/python2.4 -c'
cc: numpy/core/src/multiarraymodule.c
numpy/core/include/numpy/npy_interrupt.h, line 95: warning: old-style 
declaration or incorrect type for: jmp_buf
numpy/core/include/numpy/npy_interrupt.h, line 95: syntax error before 
or at: _NPY_SIGINT_BUF
numpy/core/include/numpy/npy_interrupt.h, line 95: warning: old-style 
declaration or incorrect type for: _NPY_SIGINT_BUF
numpy/core/include/numpy/npy_interrupt.h, line 100: undefined symbol: 
SIG_IGN
numpy/core/include/numpy/npy_interrupt.h, line 100: warning: improper 
pointer/integer combination: arg #2
numpy/core/src/scalartypes.inc.src, line 70: warning: statement not 
reached
numpy/core/src/arraytypes.inc.src, line 1045: warning: pointer to void 
or function used in arithmetic
numpy/core/src/arraytypes.inc.src, line 1045: warning: pointer to void 
or function used in arithmetic
numpy/core/src/arraytypes.inc.src, line 1045: warning: pointer to void 
or function used in arithmetic
numpy/core/src/arrayobject.c, line 4338: warning: assignment type 
mismatch:
pointer to function(pointer to void, pointer to void, int, int) 
returning int = pointer to void
numpy/core/src/arrayobject.c, line : warning: argument #4 is 
incompatible with prototype:
prototype: pointer to void : numpy/core/src/arrayobject.c, line 4326

Re: [Numpy-discussion] users point of view and ufuncs

2006-08-24 Thread Sasha
On 8/24/06, Bill Baxter [EMAIL PROTECTED] wrote:
[snip] it would be
 nice to add a concise definition of ufunc to the numpy glossary:
 http://www.scipy.org/Numpy_Glossary.


done

 Can anyone come up with such a definition?

I copied the definition from the old Numeric manual.

  Here's my stab at it:

ufunc:  A function that operates element-wise on arrays.

This is not entirely correct.  Ufuncs operate on anything that can be
passed to asarray: arrays, python lists, tuples or scalars.

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy-1.0b3 under windows

2006-08-24 Thread Frank Conradie




Thanks Travis - that did the trick. Is this an issue specifically with
mingw and Windows?

- Frank

Travis Oliphant wrote:

  Travis Oliphant wrote:
  
  
Frank Conradie wrote:
  


  Hi Sven and Jordan

I wish to add my name to this list ;-) I just got the same error 
trying to compile for Python 2.3 with latest candidate mingw32, 
following the instructions at 
http://www.scipy.org/Installing_SciPy/Windows .

Hopefully someone can shed some light on this error - what I've been 
able to find on the net explains something about C not allowing 
dynamic initializing of global variables, whereas C++ does...?


  

Edit line 690 of ndarrayobject.h to read

#define NPY_USE_PYMEM 0

Hopefully that should fix the error.
  

  
  
You will also have to alter line 11189 so that

_Py_HashPointer is replaced by 0 or NULL




-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion

  



-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy-1.0b3 under windows

2006-08-24 Thread Travis Oliphant
Frank Conradie wrote:
 Thanks Travis - that did the trick. Is this an issue specifically with 
 mingw and Windows?

Yes,  I keep forgetting that Python functions are not necessarily 
defined at compile time on Windows.  It may also be a problem with MSVC 
on Windows but I'm not sure. 

The real fix is now in SVN where these function pointers are initialized 
before calling PyType_Ready

-Travis


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy revision 3056 will not build on RHE3 or Solaris

2006-08-24 Thread Travis Oliphant
Christopher Hanley wrote:
 Good Morning,

 Numpy revision 3056 will not build on either Red Hat Enterprise 3 or 
 Solaris 8.  The relevant syntax errors are below:

   
I'd like to see which platforms do not work with the npy_interrupt.h 
stuff.  If you have a unique platform please try the latest SVN. 

There is a NPY_NO_SIGNAL define that will turn off support for 
interrupts which we can define on platforms that won't work.

-Travis


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy revision 3056 will not bu ild on RHE3 or Solaris

2006-08-24 Thread Darren Dale
Hi Travis,

On Thursday 24 August 2006 12:24, you wrote:
 Christopher Hanley wrote:
  Good Morning,
 
  Numpy revision 3056 will not build on either Red Hat Enterprise 3 or
  Solaris 8.  The relevant syntax errors are below:

 I'd like to see which platforms do not work with the npy_interrupt.h
 stuff.  If you have a unique platform please try the latest SVN.


I am able to build on an amd64/gentoo with python 2.4.3 and gcc-4.1.1. I am 
not able to build on 32bit RHEL4:

-
In file included from numpy/core/include/numpy/arrayobject.h:19,
 from numpy/core/src/multiarraymodule.c:25:
numpy/core/include/numpy/npy_interrupt.h: In function `_npy_sighandler':
numpy/core/include/numpy/npy_interrupt.h:102: error: `SIG_IGN' undeclared 
(first use in this function)
numpy/core/include/numpy/npy_interrupt.h:102: error: (Each undeclared 
identifier is reported only once
numpy/core/include/numpy/npy_interrupt.h:102: error: for each function it 
appears in.)
numpy/core/src/multiarraymodule.c: In function `test_interrupt':
numpy/core/src/multiarraymodule.c:6439: error: `SIGINT' undeclared (first use 
in this function)
In file included from numpy/core/include/numpy/arrayobject.h:19,
 from numpy/core/src/multiarraymodule.c:25:
numpy/core/include/numpy/npy_interrupt.h: In function `_npy_sighandler':
numpy/core/include/numpy/npy_interrupt.h:102: error: `SIG_IGN' undeclared 
(first use in this function)
numpy/core/include/numpy/npy_interrupt.h:102: error: (Each undeclared 
identifier is reported only once
numpy/core/include/numpy/npy_interrupt.h:102: error: for each function it 
appears in.)
numpy/core/src/multiarraymodule.c: In function `test_interrupt':
numpy/core/src/multiarraymodule.c:6439: error: `SIGINT' undeclared (first use 
in this function)
error: 
Command gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -m32 
-march=i386 -mtune=pentium4 -D_GNU_SOURCE -fPIC -fPIC 
-Ibuild/src.linux-i686-2.3/numpy/core/src -Inumpy/core/include 
-Ibuild/src.linux-i686-2.3/numpy/core -Inumpy/core/src -Inumpy/core/include 
-I/usr/include/python2.3 -c 
numpy/core/src/multiarraymodule.c -o 
build/temp.linux-i686-2.3/numpy/core/src/multiarraymodule.o failed with exit 
status 1

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy-1.0b3 under windows

2006-08-24 Thread kortmann
Sorry for my ignorance, but I have not ever heard of or used mingw32.  I
am also using python 2.3.

Is there any way someone could possibly send me a brief walk through of
how to install 1.0b3 on windows32?

Also I am not sure that I know how to manipulate the code that you guys
said that you have to so that it will work so if that is needed could you
post a walk through of that also?


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy-1.0b3 under windows

2006-08-24 Thread Sebastian Haase
On Thursday 24 August 2006 09:50, [EMAIL PROTECTED] wrote:
 Sorry for my ignorance, but I have not ever heard of or used mingw32.  I
 am also using python 2.3.
http://en.wikipedia.org/wiki/Mingw  explains in detail.


 Is there any way someone could possibly send me a brief walk through of
 how to install 1.0b3 on windows32?

do you know about the (awesome wiki website at scipy.org)
try your luck at
http://www.scipy.org/Build_for_Windows


 Also I am not sure that I know how to manipulate the code that you guys
 said that you have to so that it will work so if that is needed could you
 post a walk through of that also?


To my knowledge there is no need to manipulate code 

Maybe you should try getting per-build  versions first.

Sebastian Haase

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy-1.0b3 under windows

2006-08-24 Thread Travis Oliphant
Albert Strasheim wrote:

Dialog pops up:

---
python.exe - Application Error
---
The exception unknown software exception (0xc029) occurred in the
application at location 0x7c86d474.


Click on OK to terminate the program
Click on CANCEL to debug the program
---
OK   Cancel   
---

In the Python console it prints:

-2147483648

If you can give me some idea of what should be happening, I can take a look
at fixing it.
  


When does the crash happen?  Does it happen when you press Ctrl-C? 

What's supposed to be happening is that we are registering a handler for 
Ctrl-C that longjmps back to just after the code between NPY_SIGINT_ON 
and NPY_SIGINT_OFF.

I'm not sure how to actually accomplish something like that under 
windows as I've heard mention that longjmp should not be used with 
signals under win32.  

The easy fix is to just define NPY_NO_SIGNAL in setup.py when on a 
platform that doesn't support using signals and longjmp (like apparently 
win32).

If you could figure out what to do instead on windows that would be 
preferrable.

-Travis


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] (no subject)

2006-08-24 Thread Travis Oliphant
[EMAIL PROTECTED] wrote:

On Thursday 24 August 2006 09:50, [EMAIL PROTECTED] wrote:


Sorry for my ignorance, but I have not ever heard of or used mingw32.  I
am also using python 2.3.
  

http://en.wikipedia.org/wiki/Mingw  explains in detail.



$HOME=C:\Documents and Settings\Administrator
CONFIGDIR=C:\Documents and Settings\Administrator\.matplotlib
loaded ttfcache file C:\Documents and
Settings\Administrator\.matplotlib\ttffont
.cache
matplotlib data path c:\python23\lib\site-packages\matplotlib\mpl-data
backend WXAgg version 2.6.3.2
Overwriting info=function info at 0x01FAF3F0 from scipy.misc.helpmod
(was fun
ction info at 0x01F896F0 from numpy.lib.utils)
Overwriting who=function who at 0x01FA46B0 from scipy.misc.common (was
functi
on who at 0x01F895F0 from numpy.lib.utils)
Overwriting source=function source at 0x01FB2530 from scipy.misc.helpmod
(was
function source at 0x01F89730 from numpy.lib.utils)
RuntimeError: module compiled against version 100 of C-API but this
version
of numpy is 102
Fatal Python error: numpy.core.multiarray failed to import... exiting.


abnormal program termination
  



You have a module built against an older version of NumPy.  What modules 
are being loaded?  Perhaps it is matplotlib or SciPy

-Travis


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Handling interrupts in NumPy extensions

2006-08-24 Thread Travis Oliphant
David Cournapeau wrote:

I'm working on some macros that will allow extensions to be 
interruptable (i.e. with Ctrl-C).  The idea came from SAGE but the 
implementation is complicated by the possibility of threads and making 
sure to handle clean-up code correctly when the interrupt returns.

  

This is funny, I was just thinking about that yesterday. This is a major 
problem when writing C extensions in matlab (the manual says use the 
matlab allocator instead of malloc/new/whatever, but when you call a 
library, you cannot do that...).
  

I'm glad many people are thinking about it.There is no reason we 
can't have a few ways to handle the situation.

Currently in SVN, the simple

NPY_SIGINT_ON
[code]
NPY_SIGINT_OFF

approach is implemented (for platforms with sigsetjmp/siglongjmp).

You can already use the approach suggested:

if (PyOS_InterruptOccurred()) goto error

to handle interrupts.  The drawback of this approach is that the loop 
executes more slowly because a check for the interrupt occurs many times 
in the loop which costs time.

The advantage is that it may work with threads (I'm not clear on whether 
or not PyOS_InterruptOccurred can be called without the GIL, though).

I think the case proposer by Perry is too restrictive: it is really 
common to use external libraries which we do not know whether they use 
memory allocation inside the processing, and there is a need to clean 
that too.
  


If nothing is known about memory allocation of the external library, 
then I don't see how it can be safely interrupted using any mechanism.

What is available now is sufficient.  I played far too long with how to 
handle threads, but was not able to come up with a solution, so for now 
I've punted.

-Travis




-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy-1.0b3 under windows

2006-08-24 Thread Rob Hetland

In compiling matplotlib and scipy, I get errors complaining about  
multiply defined symbols (See below).  I tried to fix this with - 
multiply_defined suppress but this did not work.  Is there a way to  
make this go away?

-Rob


Scipy error:

c++ -bundle -undefined dynamic_lookup build/temp.macosx-10.4-i386-2.4/ 
Lib/sandbox/delaunay/_delaunay.o build/temp.macosx-10.4-i386-2.4/Lib/ 
sandbox/delaunay/VoronoiDiagramGenerator.o build/temp.macosx-10.4- 
i386-2.4/Lib/sandbox/delaunay/delaunay_utils.o build/temp.macosx-10.4- 
i386-2.4/Lib/sandbox/delaunay/natneighbors.o -Lbuild/temp.macosx-10.4- 
i386-2.4 -o build/lib.macosx-10.4-i386-2.4/scipy/sandbox/delaunay/ 
_delaunay.so
/usr/bin/ld: multiple definitions of symbol __NPY_SIGINT_BUF
build/temp.macosx-10.4-i386-2.4/Lib/sandbox/delaunay/_delaunay.o  
definition of __NPY_SIGINT_BUF in section (__DATA,__common)
build/temp.macosx-10.4-i386-2.4/Lib/sandbox/delaunay/ 
VoronoiDiagramGenerator.o definition of __NPY_SIGINT_BUF in section  
(__DATA,__common)
collect2: ld returned 1 exit status
/usr/bin/ld: multiple definitions of symbol __NPY_SIGINT_BUF
build/temp.macosx-10.4-i386-2.4/Lib/sandbox/delaunay/_delaunay.o  
definition of __NPY_SIGINT_BUF in section (__DATA,__common)
build/temp.macosx-10.4-i386-2.4/Lib/sandbox/delaunay/ 
VoronoiDiagramGenerator.o definition of __NPY_SIGINT_BUF in section  
(__DATA,__common)
collect2: ld returned 1 exit status
error: Command c++ -bundle -undefined dynamic_lookup build/ 
temp.macosx-10.4-i386-2.4/Lib/sandbox/delaunay/_delaunay.o build/ 
temp.macosx-10.4-i386-2.4/Lib/sandbox/delaunay/ 
VoronoiDiagramGenerator.o build/temp.macosx-10.4-i386-2.4/Lib/sandbox/ 
delaunay/delaunay_utils.o build/temp.macosx-10.4-i386-2.4/Lib/sandbox/ 
delaunay/natneighbors.o -Lbuild/temp.macosx-10.4-i386-2.4 -o build/ 
lib.macosx-10.4-i386-2.4/scipy/sandbox/delaunay/_delaunay.so failed  
with exit status 1


matplotlib error:

c++ -bundle -undefined dynamic_lookup build/temp.macosx-10.4-i386-2.4/ 
agg23/src/agg_trans_affine.o build/temp.macosx-10.4-i386-2.4/agg23/ 
src/agg_path_storage.o build/temp.macosx-10.4-i386-2.4/agg23/src/ 
agg_bezier_arc.o build/temp.macosx-10.4-i386-2.4/agg23/src/ 
agg_curves.o build/temp.macosx-10.4-i386-2.4/agg23/src/ 
agg_vcgen_dash.o build/temp.macosx-10.4-i386-2.4/agg23/src/ 
agg_vcgen_stroke.o build/temp.macosx-10.4-i386-2.4/agg23/src/ 
agg_rasterizer_scanline_aa.o build/temp.macosx-10.4-i386-2.4/agg23/ 
src/agg_image_filters.o build/temp.macosx-10.4-i386-2.4/src/_image.o  
build/temp.macosx-10.4-i386-2.4/src/ft2font.o build/temp.macosx-10.4- 
i386-2.4/src/mplutils.o build/temp.macosx-10.4-i386-2.4/CXX/ 
cxx_extensions.o build/temp.macosx-10.4-i386-2.4/CXX/cxxsupport.o  
build/temp.macosx-10.4-i386-2.4/CXX/IndirectPythonInterface.o build/ 
temp.macosx-10.4-i386-2.4/CXX/cxxextensions.o build/temp.macosx-10.4- 
i386-2.4/src/_ns_backend_agg.o -L/usr/local/lib -L/usr/lib -L/usr/ 
local/lib -L/usr/lib -lpng -lz -lstdc++ -lm -lfreetype -lz -lstdc++ - 
lm -o build/lib.macosx-10.4-i386-2.4/matplotlib/backends/ 
_ns_backend_agg.so
/usr/bin/ld: multiple definitions of symbol __NPY_SIGINT_BUF
build/temp.macosx-10.4-i386-2.4/src/_image.o definition of  
__NPY_SIGINT_BUF in section (__DATA,__common)
build/temp.macosx-10.4-i386-2.4/src/_ns_backend_agg.o definition of  
__NPY_SIGINT_BUF in section (__DATA,__common)
collect2: ld returned 1 exit status
/usr/bin/ld: multiple definitions of symbol __NPY_SIGINT_BUF
build/temp.macosx-10.4-i386-2.4/src/_image.o definition of  
__NPY_SIGINT_BUF in section (__DATA,__common)
build/temp.macosx-10.4-i386-2.4/src/_ns_backend_agg.o definition of  
__NPY_SIGINT_BUF in section (__DATA,__common)
collect2: ld returned 1 exit status
error: Command c++ -bundle -undefined dynamic_lookup build/ 
temp.macosx-10.4-i386-2.4/agg23/src/agg_trans_affine.o build/ 
temp.macosx-10.4-i386-2.4/agg23/src/agg_path_storage.o build/ 
temp.macosx-10.4-i386-2.4/agg23/src/agg_bezier_arc.o build/ 
temp.macosx-10.4-i386-2.4/agg23/src/agg_curves.o build/ 
temp.macosx-10.4-i386-2.4/agg23/src/agg_vcgen_dash.o build/ 
temp.macosx-10.4-i386-2.4/agg23/src/agg_vcgen_stroke.o build/ 
temp.macosx-10.4-i386-2.4/agg23/src/agg_rasterizer_scanline_aa.o  
build/temp.macosx-10.4-i386-2.4/agg23/src/agg_image_filters.o build/ 
temp.macosx-10.4-i386-2.4/src/_image.o build/temp.macosx-10.4- 
i386-2.4/src/ft2font.o build/temp.macosx-10.4-i386-2.4/src/mplutils.o  
build/temp.macosx-10.4-i386-2.4/CXX/cxx_extensions.o build/ 
temp.macosx-10.4-i386-2.4/CXX/cxxsupport.o build/temp.macosx-10.4- 
i386-2.4/CXX/IndirectPythonInterface.o build/temp.macosx-10.4- 
i386-2.4/CXX/cxxextensions.o build/temp.macosx-10.4-i386-2.4/src/ 
_ns_backend_agg.o -L/usr/local/lib -L/usr/lib -L/usr/local/lib -L/usr/ 
lib -lpng -lz -lstdc++ -lm -lfreetype -lz -lstdc++ -lm -o build/ 
lib.macosx-10.4-i386-2.4/matplotlib/backends/_ns_backend_agg.so  
failed with exit status 1



On Aug 24, 2006, at 2:18 PM, Travis Oliphant wrote:

 Albert Strasheim wrote:

 Dialog pops up:

 

Re: [Numpy-discussion] numpy-1.0b3 under windows

2006-08-24 Thread Travis Oliphant
Rob Hetland wrote:

In compiling matplotlib and scipy, I get errors complaining about  
multiply defined symbols (See below).  I tried to fix this with - 
multiply_defined suppress but this did not work.  Is there a way to  
make this go away?
  

Can you try current SVN again, to see if it now works?

-Travis


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Handling interrupts in NumPy extensions

2006-08-24 Thread David M. Cooke

On Aug 24, 2006, at 18:38 , Travis Oliphant wrote:


 You can already use the approach suggested:

 if (PyOS_InterruptOccurred()) goto error

 to handle interrupts.  The drawback of this approach is that the loop
 executes more slowly because a check for the interrupt occurs many  
 times
 in the loop which costs time.

 The advantage is that it may work with threads (I'm not clear on  
 whether
 or not PyOS_InterruptOccurred can be called without the GIL, though).

It should be; it's pure C code:

int
PyOS_InterruptOccurred(void)
{
 if (!interrupted)
 return 0;
 interrupted = 0;
 return 1;
}

(where interrupted is a static int).

-- 
||\/|
/--\
|David M. Cooke  http://arbutus.physics.mcmaster.ca/dmc/
|[EMAIL PROTECTED]


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


[Numpy-discussion] hstack(arr_Int32, arr_float32) fails because of casting rules

2006-08-24 Thread Sebastian Haase
Hi,
I get
TypeError: array cannot be safely cast to required type

when calling hstack()  ( which calls  concatenate() )
on two arrays being a int32 and a float32 respectively.

I understand now that a int32 cannot be safely converted into a float32
but why does  concatenate  not automatically
up(?) cast to float64  ??

Is this really required to be done *explicitly* every time ?  
** In general it makes float32 cubersome to use. **

(
Background:  my large image data is float32 (float64 would require too much 
memory)  and the hstack call happens inside scipy plt module when I try to 
get a 1d line profile and the y_data is hstack'ed with the x-axis values 
(int32))
)

Thanks,
Sebastian Haase

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] users point of view and ufuncs

2006-08-24 Thread Bill Baxter
On 8/24/06, Sasha [EMAIL PROTECTED] wrote:
 On 8/24/06, Bill Baxter [EMAIL PROTECTED] wrote:
 [snip] it would be
  nice to add a concise definition of ufunc to the numpy glossary:
  http://www.scipy.org/Numpy_Glossary.
 

 done

  Can anyone come up with such a definition?

 I copied the definition from the old Numeric manual.

   Here's my stab at it:
 
 ufunc:  A function that operates element-wise on arrays.
 
 This is not entirely correct.  Ufuncs operate on anything that can be
 passed to asarray: arrays, python lists, tuples or scalars.

Hey Sasha.  Your defnition may be more correct, but I have to confess
I don't understand it.

   Universal function. Universal functions follow similar rules for
broadcasting, coercion and element-wise operation.

What is coercion? (Who or what is being coerced to do what?) and
what does it mean to follow similar rules for ... coercion?  Similar
to what?

--bill

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] (no subject)

2006-08-24 Thread megu
:―― INFORMATION  ―:
 不正・悪質なサイトを一切排除しておりますので
 安心してご利用ください。   http://love-match.bz/pc/?06
:――:

*・゜゜・*:.。. .。.:*・゜゜・*:.。..。:*・゜゜・*:.。..。:**・゜゜・*

お金と時間を持て余している人妻の間で、噂になってるあのサイト
  [登録・利用料全て無料] http://love-match.bz/pc/?03
━━━
 □■ 不倫・ワリキリ専門の無料出会いサイト『Love☆Match』
 -
  登録料・利用料 ・【無料】
  メールの送受信 ・【無料】
  ユーザーの検索 ・【無料】
  掲示板の閲覧・書込み ・・【無料】
  画像交換・アップロード ・【無料】
  アドレス交換・電話番号交換 ・・・【無料】
 -
  どれだけ使っても全て無料! http://love-match.bz/pc/?06

━━━
 □■ いつでも女性ユーザーがいっぱい。その理由は?

 -
 PC&モバイルに対応!いつでもどこでも気軽に楽しめる!
 -
 仕事中は携帯電話から、プライベートは自宅からのんびりと。
 気になる相手といつでも繋がっているから、新密度も急速にUP。
 http://love-match.bz/pc/?06

 -
 PCから簡単プロフィール作成。ネット初心者でもラクラク参加OK
 -
 面倒な登録は一切不要。パソコンから簡単なプロフィールを作成して
 初心者の方や女性でもすぐに参加できます。
 http://love-match.bz/pc/?06
 -
 自由恋愛対応!直電・直メ交換支援ツール
 -
 基本的にメールアドレスや電話番号は非公開ですが
 仲良くなった人だけにメールアドレスや電話番号を教える事ができます。
 http://love-match.bz/pc/?06

 -
 写真アップロードに対応!好みの相手を素早くCHECK!
 -
 待ち合わせ場所にイメージとまったく違う人が来たら…。
 ピュアックスなら会う前に写真交換ができるから、そんな不安も解消。
 http://love-match.bz/pc/?06

 -
 スレッド掲示板で秘密のパートナー検索も効率UP!
 -
 メインの掲示板のほかにスレッド型の掲示板を設置。
 メル友から秘密のパートナーまで目的別のユーザーが集う掲示板です。
 http://love-match.bz/pc/?06


━━━
 □■ 毎日500人近くのユーザーが続々参加中!!

□-

 リエ(21歳/会社員)
 いつも1人でエッチなことを考えてます。
 メールだといろいろ話せるんだけど、実際に会うとあまりしゃべれなく
 なっちゃうので、盛り上げてくれるような楽しい男の人いないかな?
 引っ込み思案のせいか、男性経験はあまり無いんです。
 優しく&楽しくリードしてくれる男性からのメール待ってます。
 [写真有り] http://love-match.bz/pc/?06

□-

 真菜(24歳/フリーター)
 彼氏が浮気してて超アタマきたっ!まなだって遊びたい盛りだし、ずっと
 ガマンしてたのにさ!かっこいい人見つけて思いっきりふってやるつもりで
 登録してみた(笑)
 [写真有り] http://love-match.bz/pc/?06

□-

 みさ(34歳/専業主婦)
 殆ど家に帰ってこない仕事人間のだんなさまと二人きりの毎日で、ほんと
 寂しい思いをしています。年下の男の子がいれば仲良くなりたいな。
 年下の人とは付き合ったことがないので興味津々です(^^)
 [写真無し] http://love-match.bz/pc/?06

□-

 恭子(28歳/会社員)
 彼氏とはいつも同じようなセックスばかりでかなり冷め気味です。
 誰かあたしと熱いセックスを楽しみませんか?めんどくさい事は
 言いません。ただ、いつもと違うドキドキするような事がしたい
 だけなんです。
 [写真無し] http://love-match.bz/pc/?06

□-

 ななこ(28歳/主婦)
 半年前にだんなと別れて今は×1です。
 夜のお仕事なので、昼間まったりと過ごしませんか?
 心身ともに疲れ気味で、今、激しく癒されたいです。
 [写真有り] http://love-match.bz/pc/?06

□-

 祥子(31歳/クリエイター)
 平日は18時くらいまでは大体仕事してるので、その後に食事したり
 楽しく飲んだりできるパートナー希望です。年上でも年下でも
 かまいませんので気軽にメールを送って頂けると嬉しいです。
 [写真有り] http://love-match.bz/pc/?06

□-

 ゅヵ`(20歳/学生)
 まずゎ会ってみないとはじまらなぃょね?!
 横浜近辺の人で、いろんな意味でオトナな人は
 プロフ付きでめぇる送って☆
 [写真有り] http://love-match.bz/pc/?06

□-


   出会いサイトのサクラに騙されないように↓
 ┏━━━┓
  【裏】無料の出会い情報
  -
  お金と時間を持て余している人妻の間で、噂になってるあのサイト
  [登録・利用料全て無料] http://love-match.bz/pc/?06
  -
  彼女達が求めているのはこんな男性です。
  ?年上女性にリードしてもらいたい、経験少なめの男性
  ?体力・テクニックに自信が有る男性
  男性会員が不足しています。我こそは、と思う方は今すぐ参加!
  [登録・利用料全て無料] http://love-match.bz/pc/?06
 ┗━━━┛

広東省茂名市人民大街3-6-4-533
友誼網絡公司
139-3668-7892




-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


[Numpy-discussion] tensor dot ?

2006-08-24 Thread Simon Burton

 numpy.dot.__doc__
matrixproduct(a,b)
Returns the dot product of a and b for arrays of floating point types.
Like the generic numpy equivalent the product sum is over
the last dimension of a and the second-to-last dimension of b.
NB: The first argument is not conjugated.

Does numpy support summing over arbitrary dimensions,
as in tensor calculus ?

I could cook up something that uses transpose and dot, but it's
reasonably tricky i think :)

Simon.

-- 
Simon Burton, B.Sc.
Licensed PO Box 8066
ANU Canberra 2601
Australia
Ph. 61 02 6249 6940
http://arrowtheory.com 

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Handling interrupts in NumPy extensions

2006-08-24 Thread David Cournapeau
Travis Oliphant wrote:
 I'm glad many people are thinking about it.There is no reason we
 can't have a few ways to handle the situation.

 Currently in SVN, the simple

 NPY_SIGINT_ON
 [code]
 NPY_SIGINT_OFF

 approach is implemented (for platforms with sigsetjmp/siglongjmp).

 You can already use the approach suggested:

 if (PyOS_InterruptOccurred()) goto error

 to handle interrupts.  The drawback of this approach is that the loop 
 executes more slowly because a check for the interrupt occurs many times 
 in the loop which costs time.
   
I am not sure whether there are other solutions... This is the way I saw 
signal handling done in common programs when I looked for a solution for 
my matlab extensions.
 The advantage is that it may work with threads (I'm not clear on whether 
 or not PyOS_InterruptOccurred can be called without the GIL, though).

   
 I think the case proposer by Perry is too restrictive: it is really 
 common to use external libraries which we do not know whether they use 
 memory allocation inside the processing, and there is a need to clean 
 that too.
  

 

 If nothing is known about memory allocation of the external library, 
 then I don't see how it can be safely interrupted using any mechanism.
   
If the library does nothing w.r.t signals, then you just have to clean 
all the things related to the library once
you caught a signal. This is no different than cleaning your own code. 
Actually, cleaning libraries is the main reason why I implemented this 
signal scheme in matlab extensions, since they cannot use the matlab 
memory allocator, and because they live in the same memory space, 
calling several times the same extension can corrupt really quickly most 
of matlab memory space.

Maybe there are some problems I am not aware of ?

David

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] hstack(arr_Int32, arr_float32) fails because of casting rules

2006-08-24 Thread Travis Oliphant
Sebastian Haase wrote:
 On Thursday 24 August 2006 17:28, Travis Oliphant wrote:
   
 Are you saying the  ufunc-rules  would convert int32-float32 to float64  
 and 
 hence make my code just work !?
   
Yes.  That's what I'm saying (but you would get float64 out --- but if 
you didn't want that then you would have to be specific).

 And why are there two sets of rules ?
   
Because there are two modules (multiarray and umath) where the 
functionality is implemented.

 Are the Numeric rules used at many places ?
   
Not that many.  I did abstract the notion to a C-API:  
PyArray_ConvertToCommonType and implemented the 
scalars-don't-cause-upcasting part of the ufunc rules in that code.   
But, I followed the old-style Numeric coercion rules for the rest of it 
(because I was adapting Numeric).

Right now, unless there are strong objections, I'm leaning to changing 
that so that the same coercion rules are used whenever a common type is 
needed. 

It would not be that difficult of a change.

-Travis




-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] users point of view and ufuncs

2006-08-24 Thread Sasha
On 8/24/06, Bill Baxter [EMAIL PROTECTED] wrote:
[snip]
 Hey Sasha.  Your defnition may be more correct, but I have to confess
 I don't understand it.

Universal function. Universal functions follow similar rules for
 broadcasting, coercion and element-wise operation.

 What is coercion? (Who or what is being coerced to do what?) and
 what does it mean to follow similar rules for ... coercion?  Similar
 to what?

This is not my definition, I just rephrased the introductory paragraph
from the ufunc section of the Numerical Python
http://numpy.scipy.org/numpydoc/numpy-7.html#pgfId-36127.  Feel free
to edit it so that it makes more sense.

Please note that I originally intended the Numpy Glossary not as a
place to learn new terms, but as a guide for those who know more than
one meaning of the terms or more than one way to call something. (See
the preamble.)   This may explain why I did not include ufunc to
begin with.  (I remember deciding not to include ufunc, but I don't
remember the exact reason anymore.)

I would welcome an effort to make the glossary more novice friendly,
but not at the expense of oversimplifying things.

BTW, do you think Rank ... (2) number of orthogonal dimensions of a
matrix is clear?  Considering that matrix is defined a an array of
rank 2?  Is rank in  linear algebra sense common enough in numpy
documentation to be included in the glossary?

For comparison, here are a few alternative formulations of matrix rank
definition:

The rank of a matrix or a linear map is the dimension of the image of
the matrix or the linear map, corresponding to the number of linearly
independent rows or columns of the matrix, or to the number of nonzero
singular values of the map.
http://mathworld.wolfram.com/MatrixRank.html

In linear algebra, the column rank (row rank respectively) of a
matrix A with entries in some field is defined to be the maximal
number of columns (rows respectively) of A which are linearly
independent.
http://en.wikipedia.org/wiki/Rank_(linear_algebra)

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Handling interrupts in NumPy extensions

2006-08-24 Thread Travis Oliphant
David Cournapeau wrote:
 
   
 If nothing is known about memory allocation of the external library, 
 then I don't see how it can be safely interrupted using any mechanism.
   
 
 If the library does nothing w.r.t signals, then you just have to clean 
 all the things related to the library once
 you caught a signal. This is no different than cleaning your own code. 
   

Right, as long as you know what to do you are O.K.  I was just thinking 
about a hypothetical situation where the library allocated some 
temporary memory that it was going to free at the end of the subroutine 
but then an interrupt jumped out back to your code before it could 
finish.   In a case like this, you would have to use the check if 
interrupt has occurred approach before and after the library call. 

But, then that library call is not interruptable.  I could also see 
wanting to be able to interrupt a library calculation when you know it 
isn't allocating memory.   So, I like having both possibilities available.

So far we haven't actually put anything in the numpy code itself.   I'm 
leaning to putting PyOS_InterruptOccurred-style checks in a few places 
at some point down the road.

-Travis


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] hstack(arr_Int32, arr_float32) fails because of casting rules

2006-08-24 Thread Sebastian Haase
Travis Oliphant wrote:
 Sebastian Haase wrote:
 On Thursday 24 August 2006 17:28, Travis Oliphant wrote:
   
 Are you saying the  ufunc-rules  would convert int32-float32 to float64  
 and 
 hence make my code just work !?
   
 Yes.  That's what I'm saying (but you would get float64 out --- but if 
 you didn't want that then you would have to be specific).
 
 And why are there two sets of rules ?
   
 Because there are two modules (multiarray and umath) where the 
 functionality is implemented.
 
 Are the Numeric rules used at many places ?
   
 Not that many.  I did abstract the notion to a C-API:  
 PyArray_ConvertToCommonType and implemented the 
 scalars-don't-cause-upcasting part of the ufunc rules in that code.   
 But, I followed the old-style Numeric coercion rules for the rest of it 
 (because I was adapting Numeric).
 
 Right now, unless there are strong objections, I'm leaning to changing 
 that so that the same coercion rules are used whenever a common type is 
 needed. 

If you mean keeping the ufunc rules (which seem more liberal, fix my 
problem ;-) and might make using float32 in general more painless) - I 
would be all for it ...   simplifying is always good in the long term ...

Cheers,
Sebastian

 
 It would not be that difficult of a change.




-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Handling interrupts in NumPy extensions

2006-08-24 Thread David Cournapeau
Travis Oliphant wrote:

 Right, as long as you know what to do you are O.K.  I was just thinking 
 about a hypothetical situation where the library allocated some 
 temporary memory that it was going to free at the end of the subroutine 
 but then an interrupt jumped out back to your code before it could 
 finish.   In a case like this, you would have to use the check if 
 interrupt has occurred approach before and after the library call. 
Indeed.

By the way, I tried something for python.thread + signals. This is posix 
specific, and it works as expected on linux:

 - first, a C extension which implements the signal handling. It has a 
function called hello, which is the entry point of the C module, and 
calls the function process (which does random computation). It checks if 
it got a SIGINT signal, and returns -1 if caught. Returns 0 if no SIGINT 
called:
 - extension compiled into python module (I used boost python because I 
am too lazy to find how to do it in C :) )
 - python script which creates several threads running the hello 
function. They run in parallel, and ctrl+C is correctly handled. I think 
this is signal specific, and this needs to be improved (this is just 
meant as a toy example):

import threading
import hello
import time

class mythread(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
def run(self):
print Starting thread, self.getName()
st  = 0
while st == 0:
st  = hello.foo(self.getName())
# sleep to force the python interpreter to run
# other threads if available
time.sleep(1)
if st == -1:
print self.getName() +  got signal
print Ending thread, self.getName()

nthread = 5
t   = [mythread() for i in range(nthread)]
[i.start() for i in t]

Then, you have something like:

tarting thread Thread-1
Thread-1 processing... done
clean called
Starting thread Thread-5
Thread-5 processing... done
clean called
Starting thread Thread-3
Thread-3 processing... done
clean called
Starting thread Thread-2
Thread-2 processing... done
hello.c:hello signal caught line 56 for thread Thread-2
clean called
Thread-1 processing... done
clean called
Starting thread Thread-4
Thread-4 processing... done
clean called
Thread-5 processing... done
clean called
Thread-3 processing... done
hello.c:hello signal caught line 56 for thread Thread-3
clean called
Thread-2 got signal
Ending thread Thread-2
Thread-1 processing... done
clean called
Thread-4 processing... done
clean called
Thread-5 processing... done
clean called
Thread-3 got signal
Ending thread Thread-3
Thread-1 processing... done
hello.c:hello signal caught line 56 for thread Thread-1
clean called
Thread-4 processing... done
clean called
Thread-5 processing... done
hello.c:hello signal caught line 56 for thread Thread-5
clean called
Thread-1 got signal
Ending thread Thread-1
Thread-4 processing... done
clean called
Thread-5 got signal
Ending thread Thread-5
Thread-4 processing... done
clean called
Thread-4 processing... done
clean called
Thread-4 processing... done
hello.c:hello signal caught line 56 for thread Thread-4
clean called
Thread-4 got signal
Ending thread Thread-4

(SIGINT are received when Ctrl+C on linux)

You can find all sources here:

http://www.ar.media.kyoto-u.ac.jp/members/david/numpysig/

Please note that I know almost nothing about all this stuff, I just 
naively implemented from the example of GNU C library, and it always 
worked for me on matlab on my machine. I do not know if this is 
portable, if this can work for other signals, etc...

David

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion