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 - - PetscLayoutdescribing the distribution of the input keys
- mapout - - PetscLayoutdescribing the desired 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- keysinmay 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 MPI 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#
Level#
developer
Location#
Index of all IS routines
Table of Contents for all manual pages
Index of all manual pages