[Numpy-discussion] lock in LinearAlgebra when embedding

Sebastien.deMentendeHorne at electrabel.com Sebastien.deMentendeHorne at electrabel.com
Tue Jun 22 05:44:04 CDT 2004

It looks like it is a similar problem. However, it is not yet resolved as
the patch is from may/2003 and I have this problem in the latest Numeric

Moreover, my problem lies in the embedded/not embedded difference when
running the same script.
In fact, I notice it when using Python embedded in Excel via VBA. Testing
the same script from the command-line is OK while from Excel it hangs.
And the python/numeric I use is the "native windows" version (i.e. compiled
with VC++ and not cygwin/mingw). So, Numeric embedded works if lapack_lite
is compile with mingw32 but NOT with VC++.

Looks like this lapack interface is delicate...


-----Original Message-----
From: Michiel Jan Laurens de Hoon [mailto:mdehoon at ims.u-tokyo.ac.jp]
Sent: mardi 22 juin 2004 14:21
To: Sebastien.deMentendeHorne at electrabel.com
Cc: numpy-discussion at lists.sourceforge.net
Subject: Re: [Numpy-discussion] lock in LinearAlgebra when embedding

This may be related to patch 732520. The problem is that lapack_lite is not 
compiled correctly by setup.py; one part of it should be compiled without 
optimization, but is compiled with. On many platforms, this doesn't cause
problems, but on Cygwin (and therefore probably also on MinGW) the
function hangs as a result. You can get more information by looking up the
on sourceforge.

This issue has come up a couple of times. Maybe we should fix the 
Numeric/numarray source code with this patch or something similar?

--Michiel, U Tokyo.

Sebastien.deMentendeHorne at electrabel.com wrote:

> Hi,
> There is a nasty behaviour in the LinearAlgebra package under windows NT.
> When I run the following script from the command-line (python2.3 on
> Enthought edition but I had the same problem with the original python2.3 +
> Numeric 23.3), it returns without problem.
> #####################
> from LinearAlgebra import eigenvalues
> from Numeric import array
> a = array([[3,4],[1,6]])
> print eigenvalues(a)
> #####################
> Output
> [ 2.  7.]
> However, when I evaluate the same script embedded in C, it hangs while
> consuming 100% of the CPU:
> /* C Code */
> #include <Python.h>
> int
> main(int argc, char *argv[])
> {
>   Py_Initialize();
>   PyRun_SimpleString("from LinearAlgebra import eigenvalues\nfrom Numeric
> import array\na = array([[3,4],[1,6]])\nprint eigenvalues(a)\n");
>   Py_Finalize();
>   return 0;
> }
> /* end of C code */
> I compile the code with Mingw
> gcc embed.c -Ic:\python23\include -Lc:\python23 -lpython23
> and gcc -v gives
> Reading specs from
> C:/Python23/Enthought/MingW/bin/../lib/gcc-lib/mingw32/3.2.3/specs
> Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as
> --host=mingw32 --target=mingw32 --prefix=/mingw
>  --enable-threads --disable-nls --enable-languages=c++,f77,objc
> --disable-win32-registry --disable-shared --enable-sjlj-
> exceptions
> Thread model: win32
> gcc version 3.2.3 (mingw special 20030504-1)
> I must recompile lapack_lite from source with Mingw in order to get the
> correct behaviour.
> Any hint on a cleaner solution (not recompile lapack_lite whenever I
> a new version of Numeric).
> Seb
> -------------------------------------------------------
> This SF.Net email sponsored by Black Hat Briefings & Training.
> Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
> digital self defense, top technical experts, no vendor pitches, 
> unmatched networking opportunities. Visit www.blackhat.com
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion

Michiel de Hoon, Assistant Professor
University of Tokyo, Institute of Medical Science
Human Genome Center
4-6-1 Shirokane-dai, Minato-ku
Tokyo 108-8639

More information about the Numpy-discussion mailing list