← Back to team overview

dolfin team mailing list archive

Python typemap problem in Lucid

 

The buildbot is failing for the linear algebra tests on Lucid.

I've tracked it down to this function in dolfin/la/post.i (including a
new bug fix to the error message):

def get_tensor_type(tensor):
    "Return the concrete subclass of tensor."
    for k, v in _has_type_map.items():
        print "checking", k, v
        if v(tensor):
            return k
    common.dolfin_error("dolfin/swig/la/post.i",
                        "extract backend type for %s" % type(tensor).__name__,
                        "This apparently doesn't work for uBLAS..")

This function is called from the as_backend_type function which
automagically tries to figure out the type using the get_tensor_type
function.

The result for a uBLAS vector (setting backend type to uBLAS and
creating a Vector) is:

>>> as_backend_type(x)
checking <class 'dolfin.cpp.la.uBLASDenseMatrix'> <built-in function
_has_type_uBLASDenseMatrix>
checking <class 'dolfin.cpp.la.PETScVector'> <built-in function
_has_type_PETScVector>
checking <class 'dolfin.cpp.la.EpetraMatrix'> <built-in function
_has_type_EpetraMatrix>
checking <class 'dolfin.cpp.la.uBLASVector'> <built-in function
_has_type_uBLASVector>
checking <class 'dolfin.cpp.la.uBLASSparseMatrix'> <built-in function
_has_type_uBLASSparseMatrix>
checking <class 'dolfin.cpp.la.PETScMatrix'> <built-in function
_has_type_PETScMatrix>
checking <class 'dolfin.cpp.la.EpetraVector'> <built-in function
_has_type_EpetraVector>
[...]
*** Error:   Unable to extract backend type for Vector.
*** Reason:  This apparently doesn't work for uBLAS...
*** Where:   This error was encountered inside dolfin/swig/la/post.i.
*** Process: 0
***

Any ideas why this fails? The error message seems to indicate someone
knows this might fail for uBLAS...

My guess is Lucid is using an older SWIG which doesn't handle the
uBLAS templates well enough to understand the type is uBLAS.

--
Anders


Follow ups