MPIU_Scatterv — PETSc 3.25.1 documentation

Skip to main content
`Ctrl`+`K`

# MPIU_Scatterv

A replacement for `MPI_Scatterv()` that can be called with `PetscInt` types when PETSc is built for either 32-bit indices or 64-bit indices.

## Synopsis

    #include <petscsys.h>
    PetscMPIInt MPIU_Scatterv(const void *sendbuf, const PetscInt sendcounts[], const PetscInt displs[], MPI_Datatype sendtype, void *recvbuf, PetscInt recvcount, MPI_Datatype recvtype, PetscMPIInt root, MPI_Comm comm)

Collective

## Input Parameters

- sendbuf - address of send buffer

- sendcounts - non-negative `PetscInt` array (of length `comm` group size) specifying the number of elements to send to each MPI process

- displs - `PetscInt` array (of length `comm` group size). Entry i specifies the displacement (relative to `sendbuf`) from which to take the outgoing data to process i

- sendtype - data type of `sendbuf` elements

- recvcount - number of elements in `recvbuf` (non-negative integer)

- recvtype - data type of `recvbuf` elements

- root - Rank of the MPI root process, which will dispatch the data to scatter

- comm - `MPI_Comm` communicator

## Output Parameter

- recvbuf - the resulting scattered values on this MPI process

## Notes

Should be wrapped with `PetscCallMPI()` for error checking

This is different than most of the `MPIU_` wrappers in that all the count arguments are in `PetscInt`

## See Also

PETSc and standard datatypes, `MPI_Allreduce()`, `MPIU_Gatherv()`

## Level

developer

## Location

include/petscsys.h

Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages