KMR
Classes | Macros | Functions
kmrisort.c File Reference

Sorter on Long Integers. More...

#include <mpi.h>
#include <sys/types.h>
#include <assert.h>
#include <errno.h>
#include "kmr.h"
#include "kmrimpl.h"

Go to the source code of this file.

Classes

struct  kmr_isort_entry
 

Macros

#define MAX(a, b)   (((a)>(b))?(a):(b))
 

Functions

static int KMR_CMP2N (void *A, void *B)
 
static int KMR_CMP2P (void *A, void *B)
 
void kmr_isort (void *A, const size_t N, const size_t ES, int depth)
 Sorts by comparator on long integers. More...
 
static void kmr_isort0 (void *A0, size_t N, const size_t ES, int depth)
 
static void * kmr_meddleof (void *a, void *b, void *c)
 
static char * kmr_medianof (char *A, const size_t N, const size_t ES)
 
static ptrdiff_t kmr_min (ptrdiff_t a, intptr_t b)
 
static void kmr_subsort (char *A, size_t N, const size_t ES, int swaptype)
 
static void kmr_swap (void *a, void *b, size_t ES, int swaptype)
 
static void kmr_swapbytype (void *a, void *b, size_t sz, int swaptype)
 
static int kmr_swaptype (void *a, size_t es)
 
static void kmr_vecswap (void *a, void *b, size_t sz, int swaptype)
 

Detailed Description

Sorter on Long Integers.

This sorting is NOT-STABLE. This file is a copy of "qsort.c" from NetBSD-5.1, and copyrighted by The Regents of the University of California. It is deoptimized by removing the code to gather equal keys, due to not-fast 3-way comparison (that returns -1/0/1) on K.

Definition in file kmrisort.c.

Function Documentation

void kmr_isort ( void *  A,
const size_t  N,
const size_t  ES,
int  depth 
)

Sorts by comparator on long integers.

The target array is of "struct kmr_isort_entry". DEPTH tells how deep OMP threading is enabled (using tasks), and it is decremented by one each recursion. Zero depth tells a sequential run.

Definition at line 292 of file kmrisort.c.