Applying Sorting Networks to Synthesize Optimized Sorting Libraries
نویسندگان
چکیده
This paper presents an application of the theory of sorting networks to facilitate the synthesis of optimized general-purpose sorting libraries. Standard sorting libraries are often based on combinations of the classic Quicksort algorithm with insertion sort applied as base case for small, fixed, numbers of inputs. Unrolling the code for the base case by ignoring loop conditions eliminates branching, resulting in code equivalent to a sorting network. This enables further program transformations based on sorting network optimizations, and eventually the synthesis of code from sorting networks. We show that, if considering the number of comparisons and swaps, the theory predicts no real advantage of this approach. However, significant speed-ups are obtained when taking advantage of instruction level parallelism and non-branching conditional assignment instructions, both of which are common in modern CPU architectures. We provide empirical evidence that using code synthesized from efficient sorting networks as the base case for Quicksort libraries results in significant real-world speed-ups.
منابع مشابه
Synthesis of Parallel Sorting Networks using SAT Solvers
Sorting networks are implementations of parallel sorting algorithms that have many important applications like routing where they are more powerful than other networks like the Omeganetwork [Law75]. Sorting networks are essentially combinational hardware circuits that consist of only compare/exchange modules. While a recursive definition of an asymptotically optimal sorting network is known [AK...
متن کاملReturn on Investment in Transmission Network Expansion Planning Considering Wind Generation Uncertainties Applying Non-dominated Sorting Genetic Algorithm
Although significant private investment is absorbed in different sectors of power systems, transmission sector is still suffering from appropriate private investment. This is because of the pricing policies of transmission services, tariffs, and especially for investment risks. Investment risks are due to the uncertain behaviour of power systems that discourage investors to invest in the transm...
متن کاملOptimal Distribution System Reconfiguration Using Non-dominated Sorting Genetic Algorithm (NSGA-II)
In this paper, a Non-dominated Sorting Genetic Algorithm-II (NSGA-II) based approach is presented for distribution system reconfiguration. In contrast to the conventional GA based methods, the proposed approach does not require weighting factors for conversion of multi-objective function into an equivalent single objective function. In order to illustrate the performance of the proposed method,...
متن کاملAn Adapted Non-dominated Sorting Algorithm (ANSA) for Solving Multi Objective Trip Distribution Problem
Trip distribution deals with estimation of trips distributed among origins and destinations and is one of the important stages in transportation planning. Since in the real world, trip distribution models often have more than one objective, multi-objective models are developed to cope with a set of conflict goals in this area. In a proposed method of adapted non-dominated sorting algorithm (ANS...
متن کاملIncreasing the Efficiency of Existing Sorting Algorithms by Using Randomized Wrappers
There are several generic sorting algorithms available that are highly optimized and are provided as part of standard programming libraries, such as the qsort implementation of quicksort available through the C standard library. In this work we present a practical algorithmic transformation that uses random sampling and ordered search, that can convert an existing implementation of any sorting ...
متن کامل