This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Access assembled tensor in parallel to use in Eigen

0 votes

Is it possible to somehow assemble forms into tensors that could be reached by the Eigen library in parallel?

If I try to assemble form 'a' into 'A' in parallel:

EigenVector A;    
assemble(A, a);

I get an error message, that says:

Distributed EigenVector is not supported.

asked Nov 7, 2015 by str FEniCS User (1,600 points)

2 Answers

0 votes
 
Best answer

Eigen can't be used in parallel, but it should still be possible to create Eigen Vectors and Matrices locally on each process. Probably you can use:

EigenVector(mpi_comm_self())

to create a local vector. But I'm not sure that is what you are looking for. Use PETSc.

answered Nov 7, 2015 by chris_richardson FEniCS Expert (31,740 points)
selected Nov 16, 2015 by str

I would like to add new elements into the assembled Vectors and new rows/cols into the assembled Matrices. I used Eigen in the non-parallel version to do that.

0 votes

From your code sample I guess you are using the C++ interface which I do not use so much. If you need full control in parallel of your vector entries the only proper way is to use the PETSc (and perhaps Trilinos?) backends (in conjunction with PETSc4py if you are using Python).

In Python, if you assemble a vector:

A = PETScVector()
assemble(a, tensor=A)
A_petsc = as_backend_type(A.vector())

Will give you a fully-fledged petsc4py Vec which you can do whatever you wish with. Something similar is possible in the C++ backend as well.

answered Nov 10, 2015 by jack_s_hale FEniCS Novice (180 points)
...