:orphan: # VecCreateMPI Creates a parallel vector. ## Synopsis ``` #include "petscvec.h" PetscErrorCode VecCreateMPI(MPI_Comm comm, PetscInt n, PetscInt N, Vec *v) ``` Collective ## Input Parameters - ***comm -*** the MPI communicator to use - ***n -*** local vector length (or `PETSC_DECIDE` to have calculated if `N` is given) - ***N -*** global vector length (or `PETSC_DETERMINE` to have calculated if `n` is given) ## Output Parameter - ***vv -*** the vector ## Notes Use `VecDuplicate()` or `VecDuplicateVecs()` to form additional vectors of the same type as an existing vector. ## See Also [](ch_vectors), `Vec`, `VecType`, `VecCreateSeq()`, `VecCreate()`, `VecDuplicate()`, `VecDuplicateVecs()`, `VecCreateGhost()`, `VecCreateMPIWithArray()`, `VecCreateGhostWithArray()`, `VecMPISetGhost()` ## Level intermediate ## Location src/vec/vec/impls/mpi/vmpicr.c ## Examples src/dm/field/tutorials/ex1.c
src/ksp/ksp/tutorials/ex15f.F90
src/ksp/ksp/tutorials/ex2f.F90
src/ksp/ksp/tutorials/ex52f.F90
src/ksp/ksp/tutorials/ex57f.F90
src/ksp/ksp/tutorials/ex77.c
src/tao/bound/tutorials/plate2.c
src/tao/bound/tutorials/plate2f.F90
src/ts/tutorials/ex11.c
src/vec/vec/tutorials/ex1.c
src/vec/vec/tutorials/ex11.c
--- [Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/vec/vec/impls/mpi/vmpicr.c) [Index of all Vec routines](index.md) [Table of Contents for all manual pages](/manualpages/index.md) [Index of all manual pages](/manualpages/singleindex.md)