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 keysmapout -
PetscLayout
describing the desired distribution of the output keyskeysin - 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 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