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 know that PETSc.Vec objects supported direct assignments like x[i] = ..., so I rather use assignments of the form x.array = ... >From what I understand from the GitHub page >(https://urldefense.us/v3/__https://gitlab.com/petsc/petsc/-/blob/main/src/binding/petsc4py/src/petsc4py/PETSc/Vec.pyx__;!!G_uCfscf7eWS!f3M5SmfhSqew4tgfvFDjdLnd3q3kT_KzcCitJTJC0HRl1YvbSNBr5Uuzv6OWP1pVQBgbi_WJlekerylpGcBHQ9vsbzL1suFBQHkoPIwhdw$ > ) it seems, that doing so, we only access the local portion of the array >which should not require any assemble() am I right? Best regards, Alexandre. -----Message d'origine----- De : Jose E. Roman <jro...@dsic.upv.es> Envoyé : mardi 15 juillet 2025 12:21 À : SCOTTO Alexandre <alexandre.sco...@irt-saintexupery.com> Cc : petsc-users@mcs.anl.gov Objet : Re: [petsc-users] When to perform PETSc.Vec assembly with petsc4py 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!f3M5SmfhSqew4tgfvFDjdLnd3q3kT_KzcCitJTJC0HRl1YvbSNBr5Uuzv6OWP1pVQBgbi_WJlekerylpGcBHQ9vsbzL1suFBQHlKEPOyQg$ Take into account that in python the notation x[i] = ... with call x.setValues() under the hood. Jose > El 15 jul 2025, a las 12:02, SCOTTO Alexandre via petsc-users > <petsc-users@mcs.anl.gov> escribió: > > 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 need be assembled and when it is > not? > Thanks in advance. > Regards, > Alexandre.