# Name

**HPL_logsort** Sort the processes in logarithmic order.
# Synopsis

`#include "hpl.h"`

`void`

`HPL_logsort(`

`const int`

`NPROCS`

,
`const int`

`ICURROC`

,
`int *`

`IPLEN`

,
`int *`

`IPMAP`

,
`int *`

`IPMAPM1`

`);`

# Description

**HPL_logsort**
computes an array IPMAP and its inverse IPMAPM1 that
contain the logarithmic sorted processes id with repect to the local
number of rows of U that they own. This is necessary to ensure that
the logarithmic spreading of U is optimal in terms of number of steps
and communication volume as well. In other words, the larget pieces
of U will be sent a minimal number of times.
# Arguments

NPROCS (global input) const int
On entry, NPROCS specifies the number of process rows in the
process grid. NPROCS is at least one.

ICURROC (global input) const int
On entry, ICURROC is the source process row.

IPLEN (global input/output) int *
On entry, IPLEN is an array of dimension NPROCS+1, such that
IPLEN[0] is 0, and IPLEN[i] contains the number of rows of U,
that process i-1 has. On exit, IPLEN[i] is the number of
rows of U in the processes before process IPMAP[i] after the
sort, with the convention that IPLEN[NPROCS] is the total
number of rows of the panel. In other words, IPLEN[i+1] -
IPLEN[i] is the number of rows of A that should be moved to
the process IPMAP[i]. IPLEN is such that the number of rows
of the source process row is IPLEN[1] - IPLEN[0], and the
remaining entries of this array are sorted so that the
quantities IPLEN[i+1]-IPLEN[i] are logarithmically sorted.

IPMAP (global output) int *
On entry, IPMAP is an array of dimension NPROCS. On exit,
array contains the logarithmic mapping of the processes. In
other words, IPMAP[myroc] is the corresponding sorted process
coordinate.

IPMAPM1 (global output) int *
On entry, IPMAPM1 is an array of dimension NPROCS. On exit,
this array contains the inverse of the logarithmic mapping
contained in IPMAP: IPMAPM1[ IPMAP[i] ] = i, for all i in
[0.. NPROCS)

# See Also

HPL_plindx1,
HPL_plindx10,
HPL_pdlaswp01N,
HPL_pdlaswp01T.