PetscParallelSortInt#

Globally sort a distributed array of integers

Synopsis#

#include "petscis.h" 
PetscErrorCode PetscParallelSortInt(PetscLayout mapin, PetscLayout mapout, PetscInt keysin[], PetscInt keysout[])

Collective

Input Parameters#

  • mapin - PetscLayout describing the distribution of the input keys

  • mapout - PetscLayout describing the distribution of the output keys

  • keysin - the pre-sorted array of integers

Output Parameter#

  • keysout - the array in which the sorted integers will be stored. If mapin == mapout, then keysin may be equal to keysout.

Notes: This implements a distributed samplesort, which, with local array sizes n_in and n_out, global size N, and global number of processes P, does#

  • sorts locally

  • chooses pivots by sorting (in parallel) (P-1) pivot suggestions from each process using bitonic sort and allgathering a subset of (P-1) of those

  • using to the pivots to repartition the keys by all-to-all exchange

  • sorting the repartitioned keys locally (the array is now globally sorted, but does not match the mapout layout)

  • redistributing to match the mapout layout

If keysin != keysout, then keysin will not be changed during PetscParallelSortInt.

See Also#

PetscParallelSortedInt()

Level#

developer

Location#

src/vec/is/utils/psort.c


Edit on GitLab

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