Re: [petsc-users] When to perform PETSc.Vec assembly with petsc4py

2025-07-15 Thread Matthew Knepley
On Tue, Jul 15, 2025 at 10:44 AM SCOTTO Alexandre < alexandre.sco...@irt-saintexupery.com> wrote: > The place where the problem is quite deep in a large code, I will try to > isolate the problematic behaviour but this may take some time. > > > > @Matthew, is there a way in the Python API to check

Re: [petsc-users] When to perform PETSc.Vec assembly with petsc4py

2025-07-15 Thread SCOTTO Alexandre via petsc-users
The place where the problem is quite deep in a large code, I will try to isolate the problematic behaviour but this may take some time. @Matthew, is there a way in the Python API to check whether a vector is assembled? Regards, Alexandre. De : Matthew Knepley Envoyé : mardi 15 juillet 2025 16

Re: [petsc-users] When to perform PETSc.Vec assembly with petsc4py

2025-07-15 Thread Matthew Knepley
We check that the x argument is assembled in MatMultTranspose(), but not y. It seems possible that y could have stashed values that get communicated when the operation is performed. Why do we not check that y is assembled? Thanks, Matt On Tue, Jul 15, 2025 at 9:36 AM Jose E. Roman wrote:

Re: [petsc-users] When to perform PETSc.Vec assembly with petsc4py

2025-07-15 Thread Jose E. Roman via petsc-users
It is better if you can provide a full python script that we can run to reproduce the problem. Jose > El 15 jul 2025, a las 14:49, SCOTTO Alexandre > escribió: > > Ok I get it, Vec.assemble() is mandatory whenever MPI communications are > required to get the values to appropriate processes.

Re: [petsc-users] When to perform PETSc.Vec assembly with petsc4py

2025-07-15 Thread Stefano Zampini
A.multTranspose(x, y) produces y = A^t * x If it is not the case, you are doing something wrong I minimal working example will help us debug your approach. You can take a look at the test folder https://urldefense.us/v3/__https://gitlab.com/petsc/petsc/-/tree/main/src/binding/petsc4py/test__;!!G_u

Re: [petsc-users] When to perform PETSc.Vec assembly with petsc4py

2025-07-15 Thread SCOTTO Alexandre via petsc-users
Ok I get it, Vec.assemble() is mandatory whenever MPI communications are required to get the values to appropriate processes. To provide more information, I am in a situation where I perform a A.multTranspose(x, y), where y is a vector that has been filled in with values earlier in the process.

Re: [petsc-users] When to perform PETSc.Vec assembly with petsc4py

2025-07-15 Thread Matthew Knepley
On Tue, Jul 15, 2025 at 8:13 AM SCOTTO Alexandre via petsc-users < petsc-users@mcs.anl.gov> wrote: > Hello Jose, > > Thanks for your answer. Then it seems that I have under the hood usages of > setValues() in my code since I do not explicitly make use of it but still > has problems when not assemb

Re: [petsc-users] When to perform PETSc.Vec assembly with petsc4py

2025-07-15 Thread Barry Smith via petsc-users
> On Jul 15, 2025, at 8:13 AM, SCOTTO Alexandre via petsc-users > wrote: > > Hello Jose, > > Thanks for your answer. Then it seems that I have under the hood usages of > setValues() in my code since I do not explicitly make use of it but still has > problems when not assembling my vector.

Re: [petsc-users] When to perform PETSc.Vec assembly with petsc4py

2025-07-15 Thread SCOTTO Alexandre via petsc-users
Hello Jose, Thanks for your answer. Then it seems that I have under the hood usages of setValues() in my code since I do not explicitly make use of it but still has problems when not assembling my vector. Do I need to assemble vectors after Mat.mult or Scatter.scatter? By the way, I did not kn

Re: [petsc-users] When to perform PETSc.Vec assembly with petsc4py

2025-07-15 Thread Jose E. Roman via petsc-users
Assembly is needed after a call to x.setValues() or any of its variants. https://urldefense.us/v3/__https://petsc.org/main/petsc4py/reference/petsc4py.PETSc.Vec.html*petsc4py.PETSc.Vec.setValue__;Iw!!G_uCfscf7eWS!cvSh6J_ggyBtDLAEXjAIxkYQUbKkTTiA-QPyYNKZh3E_iJjftgP4afSVeUnPwdIE84eDB6to38b3rFjJg9yRB1

[petsc-users] When to perform PETSc.Vec assembly with petsc4py

2025-07-15 Thread SCOTTO Alexandre via petsc-users
Dear PETSc community, As a beginner in the MPI world and with the PETSc library, I come with a possibly very naive question. I know from the documentation that assembling vectors must be done, but it is not clear to me when to perform this operation. Is there a simple way to know when a vector n