Skip to content

cmcantalupo/sorter_threaded

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

-------------------
+ sorter_threaded +
-------------------

A C++ library for doing a threaded sort.  

Brief description
-----------------

This library contains the class SorterThreaded which has a sort()
method that uses OpenMP threading.  This is a header only template 
library.  

SorterThreaded class
--------------------

Basic usage is with default options for the constructor.  The sort()
method takes an iterator to the beginning and end of the vector to be
sorted.

You can optionally specify the task factor with the first constructor
argument.  This determines how many threaded tasks the sort will be
broken up into.  The default for the task factor is 8.  This should
provide enough tasks to balance the non-uniform size of chunks to be
sorted without creating so many tasks that the partition step becomes
overwhelming.  The number of tasks is the task factor times the number
of threads.  The partitioning step is
O(distance(begin,end)*log(numTasks)) in time.

The second optional constructor argument is the maximum number of
threads.  The default for this option is -1 which will use the OpenMP
environment to determine the number of threads.  This parameter is
ignored if it is larger than the maximum number of threads in the
OpenMP environment.

Compile options
---------------

If the STL sort on your system is thread safe then compile with
-DSTL_THREAD_SAFE to use the built in sort as the basic sort.
Otherwise a thread safe quick sort is implemented and will be used.

About

Threaded quicksort using OpenMP

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages