PetscGatherMessageLengths2 — PETSc 3.25.2 documentation

Skip to main content
`Ctrl`+`K`

# PetscGatherMessageLengths2

Computes info about messages that a MPI rank will receive, including (from-id,length) pairs for each message. Same functionality as `PetscGatherMessageLengths()` except it takes TWO ilenths and output TWO olengths.

## Synopsis

    #include "petscsys.h"
    PetscErrorCode PetscGatherMessageLengths2(MPI_Comm comm, PetscMPIInt nsends, PetscMPIInt nrecvs, const PetscMPIInt ilengths1[], const PetscMPIInt ilengths2[], PetscMPIInt **onodes, PetscMPIInt **olengths1, PetscMPIInt **olengths2)

Collective, No Fortran Support

## Input Parameters

- comm - Communicator

- nsends - number of messages that are to be sent.

- nrecvs - number of messages being received

- ilengths1 - first array of integers of length sizeof(comm)

- ilengths2 - second array of integers of length sizeof(comm)

## Output Parameters

- onodes - list of ranks from which messages are expected

- olengths1 - first corresponding message lengths

- olengths2 - second message lengths

## Notes

With this info, the correct `MPIU_Irecv()` can be posted with the correct from-id, with a buffer with the right amount of memory required.

The calling function should `PetscFree()` the memory in `onodes` and `olengths`

To determine `nrecvs`, one can use `PetscGatherNumberOfMessages()`

## See Also

`PetscGatherMessageLengths()`, `PetscGatherNumberOfMessages()`, `PetscCommBuildTwoSided()`

## Level

developer

## Location

src/sys/utils/mpimesg.c

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