[Numpy-discussion] lock in LinearAlgebra when embedding

Sebastien.deMentendeHorne at electrabel.com Sebastien.deMentendeHorne at electrabel.com
Tue Jun 22 04:59:32 CDT 2004


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 windows
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 install
a new version of Numeric).

Seb




More information about the Numpy-discussion mailing list