← Back to team overview

dolfin team mailing list archive

Re: Fwd: cbc.block with trilinos failing after recent dolfin updates

 

The problem is that dolfin.cpp.EpetraMatrix.mat() returns a
SwigPyObject instead of a PyTrilinos.Epetra.FECrsMatrix.

With your cbc.block patch, I'm running the following code:

        print type(Puu)

        A = dolfin.down_cast(Puu)
        print type(A)

        B = A.mat()
        print type(B)

        C = PyTrilinos.ML.MultiLevelPreconditioner(B, 0)
        print type(C)

With dolfin/1.0.x -r6439 I get:

<class 'dolfin.cpp.Matrix'>
<class 'dolfin.cpp.EpetraMatrix'>
<class 'PyTrilinos.Epetra.FECrsMatrix'>
<class 'PyTrilinos.ML.MultiLevelPreconditioner'>

With dolfin/1.0.x -r6447 I get:

<class 'dolfin.cpp.Matrix'>
<class 'dolfin.cpp.EpetraMatrix'>
<type 'SwigPyObject'>
Traceback (most recent call last):
  File "/home/martinal/dev/cbc/invbench/scripts/invbench", line 5, in <module>
    simfra.introrun.run(locals())
  File "/home/martinal/dev/cbc/invbench/src/simfra/introrun.py", line 79, in run
    return func(**kwargs)
  File "/home/martinal/dev/cbc/invbench/src/invbench/oneshot.py", line
160, in case_fruitfly_oneshotblock
    C = PyTrilinos.ML.MultiLevelPreconditioner(B, 0)
  File "/home/martinal/opt/fenics/dorsal-unstable/lib/python2.7/site-packages/PyTrilinos/ML.py",
line 1442, in __init__
    this = _ML.new_MultiLevelPreconditioner(*args)
NotImplementedError: Wrong number or type of arguments for overloaded
function 'new_MultiLevelPreconditioner'.
  Possible C/C++ prototypes are:
    ML_Epetra::MultiLevelPreconditioner::MultiLevelPreconditioner(Epetra_RowMatrix
const &,bool const)
    ML_Epetra::MultiLevelPreconditioner::MultiLevelPreconditioner(Epetra_RowMatrix
const &,Teuchos::ParameterList const &,bool const)
    ML_Epetra::MultiLevelPreconditioner::MultiLevelPreconditioner(ML_Operator
*,Teuchos::ParameterList const &,bool const)
    ML_Epetra::MultiLevelPreconditioner::MultiLevelPreconditioner(ML_Operator
*,Teuchos::ParameterList const &,Epetra_RowMatrix
**,Teuchos::ParameterList *,int,bool const)
    ML_Epetra::MultiLevelPreconditioner::MultiLevelPreconditioner(Epetra_RowMatrix
const &,Epetra_RowMatrix const &,Epetra_RowMatrix const
&,Teuchos::ParameterList const &,bool const,bool const)
    ML_Epetra::MultiLevelPreconditioner::MultiLevelPreconditioner(Epetra_RowMatrix
const &,Epetra_RowMatrix const &,Epetra_RowMatrix const
&,Epetra_RowMatrix const &,Teuchos::ParameterList const &,bool const)
    ML_Epetra::MultiLevelPreconditioner::MultiLevelPreconditioner(Epetra_MsrMatrix
const &,ML_Operator *,AZ_MATRIX *,int *,Teuchos::ParameterList const
&,bool const)


Martin

On 18 November 2011 16:03, Joachim Berdal Haga <jobh@xxxxxxxxx> wrote:
>>   self.ml_prec = MultiLevelPreconditioner(A.down_cast().mat(), 0)
>
> I assume Puu is a dolfin.GenericMatrix, so this should be equivalent to
>   PyTrilinos.ML.MultiLevelPreconditioner(dolfin.down_cast(Puu).mat(), 0)
> and the only reason I can see for that to fail is if the returned matrix
> from dolfin isn't (recognised as) an Epetra matrix.
> Does the explicit call above give the same error? If so, what is the type of
> the down_cast(Puu).mat()?
> -j.
>
> On 18 November 2011 15:47, Martin Sandve Alnæs <martinal@xxxxxxxxx> wrote:
>>
>> On 18 November 2011 13:52, Joachim Berdal Haga <jobh@xxxxxxxxx> wrote:
>> > Yep, sorry, forgot the list. Here's a patch for cbc.block which removes
>> > the
>> > workaround, can you see if it helps?
>> > -j.
>>
>> Now I get:
>>
>> Traceback (most recent call last):
>>  File "/home/martinal/dev/cbc/invbench/scripts/invbench", line 5, in
>> <module>
>>    simfra.introrun.run(locals())
>>  File "/home/martinal/dev/cbc/invbench/src/simfra/introrun.py", line 79,
>> in run
>>    return func(**kwargs)
>>  File "/home/martinal/dev/cbc/invbench/src/invbench/oneshot.py", line
>> 168, in case_fruitfly_oneshotblock
>>    P = block_mat([[ML(Puu), 0, 0],
>>  File
>> "/home/martinal/opt/fenics/dorsal-unstable/lib/python2.7/site-packages/block/algebraic/trilinos/MLPrec.py",
>> line 25, in __init__
>>    self.ml_prec = MultiLevelPreconditioner(A.down_cast().mat(), 0)
>>  File
>> "/home/martinal/opt/fenics/dorsal-unstable/lib/python2.7/site-packages/PyTrilinos/ML.py",
>> line 1442, in __init__
>>    this = _ML.new_MultiLevelPreconditioner(*args)
>> NotImplementedError: Wrong number or type of arguments for overloaded
>> function 'new_MultiLevelPreconditioner'.
>>  Possible C/C++ prototypes are:
>>
>>  ML_Epetra::MultiLevelPreconditioner::MultiLevelPreconditioner(Epetra_RowMatrix
>> const &,bool const)
>>
>>  ML_Epetra::MultiLevelPreconditioner::MultiLevelPreconditioner(Epetra_RowMatrix
>> const &,Teuchos::ParameterList const &,bool const)
>>
>>  ML_Epetra::MultiLevelPreconditioner::MultiLevelPreconditioner(ML_Operator
>> *,Teuchos::ParameterList const &,bool const)
>>
>>  ML_Epetra::MultiLevelPreconditioner::MultiLevelPreconditioner(ML_Operator
>> *,Teuchos::ParameterList const &,Epetra_RowMatrix
>> **,Teuchos::ParameterList *,int,bool const)
>>
>>  ML_Epetra::MultiLevelPreconditioner::MultiLevelPreconditioner(Epetra_RowMatrix
>> const &,Epetra_RowMatrix const &,Epetra_RowMatrix const
>> &,Teuchos::ParameterList const &,bool const,bool const)
>>
>>  ML_Epetra::MultiLevelPreconditioner::MultiLevelPreconditioner(Epetra_RowMatrix
>> const &,Epetra_RowMatrix const &,Epetra_RowMatrix const
>> &,Epetra_RowMatrix const &,Teuchos::ParameterList const &,bool const)
>>
>>  ML_Epetra::MultiLevelPreconditioner::MultiLevelPreconditioner(Epetra_MsrMatrix
>> const &,ML_Operator *,AZ_MATRIX *,int *,Teuchos::ParameterList const
>> &,bool const)
>>
>>
>> --
>> Martin
>
>


Follow ups

References