[petsc-users] Parallel vector with shared memory in Fortran

Francesco Migliorini francescomigliorini93 at gmail.com
Mon Jun 5 09:12:46 CDT 2017


Hello there!

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?

Vec  feP    !The vector to be shared with all the processes
(...)
mpi_np = 2    !The number of processes
ind(1) = 10   !The global dimension of the vector
call VecCreate(PETSC_COMM_WORLD,feP,perr)
call VecSetSizes(feP,PETSC_DECIDE,ind,perr)
call VecSetFromOptions(feP,perr)
(...)    !Here feP is filled in
call VecAssemblyBegin(feP,perr)
call VecAssemblyEnd(feP,perr)

Many thanks,
Francesco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170605/07c9e6fd/attachment.html>


More information about the petsc-users mailing list