[petsc-users] Copy MPIAIJ Matrix onto MPISeq Matrices on All Processors
Smith, Barry F.
bsmith at mcs.anl.gov
Mon Mar 19 13:08:04 CDT 2018
> On Mar 19, 2018, at 12:00 PM, Ali Berk Kahraman <aliberkkahraman at yahoo.com> wrote:
>
> Dear All,
>
> I have to create my Jacobian numerically using an FD function I have written, but the problem is that the function evaluation FormRHSFunction creates PETSC_COMM_WORLD objects in it, and takes 1 PETSC_COMM_WORLD matrix as an input. So I cannot work it on parallel (every processor calculating its own portion of Jacobian), I tried but the machine gets confused.
Huh. It is fine to have the function work on PETSC_COMM_WORLD, and it can be in parallel.
>
> My initial idea was to create the objects in PETSC_COMM_SELF type within the RHS function, but the input COMM_WORLD matrix standed where it was. So my question is, is there a way to get a complete copy of a distributed matrix on all the processors as seq matrices?
>
> I cannot use the Petsc's version FD function because the FormRHSFunction I call to create the Jacobian is slightly different than the original FormRHSFunction. The original function is too expensive, so I only calculate the relevant parts of it in the Jacobian function.
You can do this with MatCreateMFFD() and set your inexpensive function as the function.
>
> Best Regards,
>
> Ali Berk Kahraman
> M.Sc. Student, Mechanical Engineering
> Bogazici Uni. Istanbul, Turkey
>
More information about the petsc-users
mailing list