<div dir="auto">petsc-current/docs/manualpages/Vec/VecScatterCreateToAll.html</div><div class="gmail_extra"><br><div class="gmail_quote">Il 05 Giu 2017 4:12 PM, "Francesco Migliorini" <<a href="mailto:francescomigliorini93@gmail.com">francescomigliorini93@gmail.com</a>> ha scritto:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello there!<div><br></div><div>I am working with an MPI code in which I should create a petsc vector such that all the processes can access to all its entries. So, I tried with VecCreateShared but it does not work with my machine. Then I tried VecCreateMPI but it seems to me that it does not change anything from the usual VecCreate. Finally I found the scatter commands but the examples are a bit tricky. So, are there any other way? If no, could someone please show me how to use scatter in this simple code?</div><div><br></div><div>Vec  feP    !The vector to be shared with all the processes</div><div>(...)</div><div>mpi_np = 2    !The number of processes</div><div><div>ind(1) = 10   !The global dimension of the vector</div><div>call VecCreate(PETSC_COMM_WORLD,<wbr>feP,perr)</div><div>call VecSetSizes(feP,PETSC_DECIDE,<wbr>ind,perr)</div><div>call VecSetFromOptions(feP,perr)</div></div><div>(...)    !Here feP is filled in</div><div><div>call VecAssemblyBegin(feP,perr)</div><div>call VecAssemblyEnd(feP,perr)</div></div><div><br></div><div>Many thanks,</div><div>Francesco</div></div>
</blockquote></div></div>