bfroehle / pymumps

PyMUMPS: A parallel sparse direct solver
BSD 3-Clause "New" or "Revised" License
8 stars 4 forks source link

Python int too large to convert to C long #1

Open ttinoco opened 10 years ago

ttinoco commented 10 years ago

Hi,

I just started playing around with pymumps and ran into the following problem:

After creating a coo_matrix A, initializing the mumps context and analyzing the structure of A, I get an error during the execution of the routine

set_centralized_assembled_values(A.data)

This routine breaks down during the step

self.id.a = self.cast_array(a)

and produces the error

OverflowError: Python int too large to convert to C long

I think that this is due to the fact that

a.array_interface['data'][0] is huge (3028508680) and of type long.

I am wondering if there is an easy fix for this.

Thanks, Tomas

ttinoco commented 10 years ago

Hi,

I think I solved the problem. In _dmumps.pyx I changed all "long" to "unsigned long" and reconstructed the .c file using cython 0.19.2.

Tomas

alikadar commented 10 years ago

Thanks a lot Tomas, I had the same problem and I changed it to 'unsigned unsigned long'. Though I could not understand how they made such an error, when MUMPS was made to operate on 'very very large' matrices. Currently I am testing with matrices of size 5000, but soon I need to test matrices of size 1000000, I hope it will work as well. Thanks again! Ali, TU Berlin

alikadar commented 10 years ago

Hello, I need to work with complex matrices. Can you please suggest what changes have to be made in _dmumps.pyx. I tried changing all references of DMumps, DMUMPS, dmumps to CMUmps, CMUMPS, cmumps respectively. Now when I run the same file with a complex matrix I get 'segmentation fault'. Can you please suggest if that is the right way to do it.

LucasPa commented 10 years ago

I am not sure we should continue this discussion here, but just like Ali, I am interested in using pyMumps for complex matrices. @alikadar, have you tried to replace DMumps, DMUMPS and dmumps in ZMumps ZMUMPS and zmumps respectively ? Maybe the error "segmentation fault" comes from the fact that cmumps is single precision while dmumps (and zmumps) are double precision.

Lucas

alikadar commented 10 years ago

hello, I am trying to experiment with PyMUMPS for very large matrices on the university cluster. I get the following error after >python setup.py install

running install running build running build_py running build_ext building 'mumps._dmumps' extension gcc -pthread -shared build/temp.linux-x86_64-2.7/mumps/_dmumps.o -L/usr/lib64 -ldmumps -lpython2.7 -o build/lib.linux-x86_64-2.7/mumps/_dmumps.so /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: cannot find -ldmumps collect2: error: ld returned 1 exit status error: command 'gcc' failed with exit status 1

Its not able to form the library file _dmumps.so. I don't really understand what is -ld and -ldmumps. Everything is perfect on my 32bit Ubuntu system but the same doesn't work on 64-bit cluster(OpenSUSE interface).

Can anyone please help me ?

alikadar commented 10 years ago

hello, I figured out the problem. Here is the updated setup.py Extension( 'mumps._dmumps', sources=['mumps/_dmumps.c'], include_dirs=['/usr/include/mumps'], library_dirs=['/usr/lib64'], libraries=['dmumps_seq'], ),