[SciPy-User] Using LU Decomposition from UMFPACK?

Skipper Seabold jsseabold@gmail....
Sat Mar 23 21:04:16 CDT 2013


On Sat, Mar 23, 2013 at 1:20 PM, Skipper Seabold <jsseabold@gmail.com>wrote:

> On Fri, Mar 22, 2013 at 5:39 PM, Skipper Seabold <jsseabold@gmail.com>wrote:
>
>> On Fri, Mar 22, 2013 at 5:04 PM, Skipper Seabold <jsseabold@gmail.com>wrote:
>>
>>> On Fri, Mar 22, 2013 at 4:50 PM, Skipper Seabold <jsseabold@gmail.com>wrote:
>>>
>>>> I thought I built scipy with UMFPACK support but I can't seem to get
>>>> this to work. I would like to do a sparse LU decomposition and recover the
>>>> U matrix.
>>>>
>>>> I built SuiteSparse so long ago, so might there have been a build issue
>>>> I haven't noticed until now?
>>>>
>>>> scipy.test() does not show any errors, though there are 28 skipped
>>>> tests.
>>>>
>>>> Does this work for anyone?
>>>>
>>>> [~/]
>>>> [1]: from scipy import version
>>>>
>>>> [~/]
>>>> [2]: version.full_version
>>>> [2]: '0.13.0.dev-61f05fe'
>>>>
>>>> [~/]
>>>> [3]: from scipy.sparse.linalg.dsolve import umfpack
>>>>
>>>> [~/]
>>>> [4]: umf = umfpack.UmfpackContext()
>>>> Exception AttributeError: "'UmfpackContext' object has no attribute
>>>> '_symbolic'" in <bound method UmfpackContext.__del__ of
>>>> <scipy.sparse.linalg.dsolve.umfpack.umfpack.UmfpackContext object at
>>>> 0x56c0b10>> ignored
>>>>
>>>> ---------------------------------------------------------------------------
>>>> ImportError                               Traceback (most recent call
>>>> last)
>>>> <ipython-input-3-2e28850f247d> in <module>()
>>>> ----> 1 umf = umfpack.UmfpackContext("di")
>>>>
>>>> /usr/local/lib/python2.7/dist-packages/scipy/sparse/linalg/dsolve/umfpack/umfpack.pyc
>>>> in __init__(self, family, **kwargs)
>>>>     279                    a warning is issued (default: 1e12)"""
>>>>     280         if _um is None:
>>>> --> 281             raise ImportError('Scipy was built without UMFPACK
>>>> support. '
>>>>     282                               'You need to install the UMFPACK
>>>> library and '
>>>>     283                               'header files before building
>>>> scipy.')
>>>>
>>>> ImportError: Scipy was built without UMFPACK support. You need to
>>>> install the UMFPACK library and header files before building scipy.
>>>>
>>>> [~/]
>>>> [5]: from scipy import show_config
>>>>
>>>> [~/]
>>>> [6]: show_config()
>>>> amd_info:
>>>>     libraries = ['amd']
>>>>     library_dirs = ['/home/skipper/atlas_build2/lib']
>>>>     define_macros = [('SCIPY_AMD_H', None)]
>>>>     swig_opts = ['-I/home/skipper/atlas_build2/include']
>>>>     include_dirs = ['/home/skipper/atlas_build2/include']
>>>> umfpack_info:
>>>>     libraries = ['umfpack', 'amd']
>>>>     library_dirs = ['/home/skipper/atlas_build2/lib']
>>>>
>>>>     define_macros = [('SCIPY_UMFPACK_H', None), ('SCIPY_AMD_H', None)]
>>>>
>>>>     swig_opts = ['-I/home/skipper/atlas_build2/include',
>>>> '-I/home/skipper/atlas_build2/include']
>>>>
>>>>     include_dirs = ['/home/skipper/atlas_build2/include']
>>>> atlas_threads_info:
>>>>     libraries = ['lapack', 'ptf77blas', 'ptcblas', 'atlas']
>>>>     library_dirs = ['/home/skipper/atlas_build2/lib']
>>>>     define_macros = [('NO_ATLAS_INFO', -1)]
>>>>     language = f77
>>>>     include_dirs = ['/home/skipper/atlas_build2/include']
>>>> blas_opt_info:
>>>>     libraries = ['ptf77blas', 'ptcblas', 'atlas']
>>>>     library_dirs = ['/home/skipper/atlas_build2/lib']
>>>>     define_macros = [('NO_ATLAS_INFO', -1)]
>>>>     language = c
>>>>     include_dirs = ['/home/skipper/atlas_build2/include']
>>>> atlas_blas_threads_info:
>>>>     libraries = ['ptf77blas', 'ptcblas', 'atlas']
>>>>     library_dirs = ['/home/skipper/atlas_build2/lib']
>>>>     define_macros = [('NO_ATLAS_INFO', -1)]
>>>>     language = c
>>>>     include_dirs = ['/home/skipper/atlas_build2/include']
>>>> lapack_opt_info:
>>>>     libraries = ['lapack', 'ptf77blas', 'ptcblas', 'atlas']
>>>>     library_dirs = ['/home/skipper/atlas_build2/lib']
>>>>     define_macros = [('NO_ATLAS_INFO', -1)]
>>>>     language = f77
>>>>     include_dirs = ['/home/skipper/atlas_build2/include']
>>>> lapack_mkl_info:
>>>>   NOT AVAILABLE
>>>> blas_mkl_info:
>>>>   NOT AVAILABLE
>>>> mkl_info:
>>>>   NOT AVAILABLE
>>>>
>>>> Skipper
>>>>
>>>
>>> Ah, might it be this? From SuiteSparse/AMD/Doc/ChangeLog
>>>
>>> Jun 1, 2012: version 2.3.0
>>>
>>>     * changed from UFconfig to SuiteSparse_config
>>>
>>
>> I suppose not. Also, does this look right? Should they be shared objects?
>> (I'm just about out of my depth)
>>
>> [~/src/SuiteSparse]
>> |27 $ ls ~/atlas_build2/lib/
>> libamd.a    libcholmod.a     liblapack.a     libptlapack.a  libtstatlas.a
>> libatlas.a  libf77blas.a     libptcblas.a    libsatlas.so   libumfpack.a
>> libcblas.a  libf77refblas.a  libptf77blas.a  libtatlas.so
>>
>> I have the -fPIC flag set when building SuiteSparse.
>>
>
> The issue was that there was a problem in the building of SuiteSparse. I
> had not correctly linked against blas and never knew it.
>

Ok, I figured it out after some more fumbling around in the dark. This
thread [1] indicates that you need to change the default [umfpack] section
in site.cfg to read

[umfpack]
umfpack_libs = umfpack, cholmod,  colamd, amd

I didn't have any luck with my old ATLAS/LAPACK, but I was able to link
SuiteSparse (0.4.2) against OpenBlas (current master) and add the following
to site.cfg.

[umfpack]
umfpack_libs = umfpack, cholmod,  colamd, amd, suitesparseconfig, spqr, rt

You only need rt if you didn't disable in in SuiteSparse_config.mk, and
make sure to include the correct library directory for it. It's likely
system-wide if the others aren't. Now I can do my sparse LU decompositions,
which is a great relief.

from scipy import sparse
umf = sparse.linalg.umfpack.UmfpackContext("di")
L, U, P, Q, R, recip = umf.lu(W)

Skipper

[1] http://mail.scipy.org/pipermail/scipy-dev/2011-August/016459.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20130323/8bbe95e9/attachment-0001.html 


More information about the SciPy-User mailing list