Skip to main content
`Ctrl`+`K`

# PetscShmCommGlobalToLocal

Given a global rank returns the local rank in the shared memory communicator

## Synopsis

    #include "petscsys.h"
    PetscErrorCode PetscShmCommGlobalToLocal(PetscShmComm pshmcomm, PetscMPIInt grank, PetscMPIInt *lrank)

## Input Parameters

- pshmcomm - the shared memory communicator object

- grank - the global rank

## Output Parameter

- lrank - the local rank, or `MPI_PROC_NULL` if it does not exist

## Developer Notes

Assumes the pshmcomm->globranks[] is sorted

It may be better to rewrite this to map multiple global ranks to local in the same function call

## See Also

`PetscShmCommGet()`, `PetscShmCommLocalToGlobal()`, `PetscShmCommGetMpiShmComm()`

## Level

developer

## Location

src/sys/utils/mpishm.c

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