libsc
2.8.7
The SC library provides support for parallel scientific applications.
|
Provide a parallel sort algorithm. More...
#include <sc.h>
Go to the source code of this file.
Functions | |
void | sc_psort (sc_MPI_Comm mpicomm, void *base, size_t *nmemb, size_t size, int(*compar)(const void *, const void *)) |
Sort a distributed set of fixed-size data items in parallel. More... | |
Provide a parallel sort algorithm.
We use a variant of the bitonic sort algorithm. Within each process we rely on the system quick sort function. The partition of data on input is arbitrary and remains invariant.
void sc_psort | ( | sc_MPI_Comm | mpicomm, |
void * | base, | ||
size_t * | nmemb, | ||
size_t | size, | ||
int(*)(const void *, const void *) | compar | ||
) |
Sort a distributed set of fixed-size data items in parallel.
This algorithm uses bitonic sort between processors and qsort locally.
This function is thread-safe if src/sc_config.h #defines SC_HAVE_QSORT_R. Otherwise, it uses a static read-only variable for the comparison function, and calling sc_psort concurrently is likely to fail.
The partition of the data can be arbitrary and is not changed.
[in] | mpicomm | Communicator to use. |
[in] | base | Pointer to the process-local data items. |
[in] | nmemb | Array of mpisize counts of data items. For each process, the number of its local items. This array must be identical on all processes. |
[in] | size | Size in bytes of one data item. |
[in] | compar | Comparison function to use; see man (3) qsort. Shall return < 0 if the first argument is less than the second, 0 if both are equal, and > 0 if the first is greater than the second. |