Skip to content

An efficient C++ multi-threaded sorting function based on C++11 threads

License

Notifications You must be signed in to change notification settings

baserinia/parallel-sort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

C++ Parallel Sort

An efficient C++ multi-threaded sorting function based on C++11 threads

How to use

To use this function, simply include the the file parasort.h in your program and call the template function parasort(sz, list, np, sf) with proper argument values. Here is the list of arguments:

  • Function prototype: parasort (size_t sz, T* list, unsigned np = 2; unsigned sf = 100);
  • sz: Length of array of type size_t;
  • list: Array of arbitrary type T. This array is used as both input and output since the sorted output is written to it. If T is not a built-in type, overload the operator <.
  • np: Number of concurrent threads. By default, np=2, so it is optional.
  • sf: Sampling factor. By default sf=100, so it is optional.

How to compile

This function uses only the standard C++ constructs, so you can compile it like any other C++ program. Just make sure you are using these flags in gcc:

  • For C++ 11 features: -std=c++11
  • For standard threads: -pthread

About

An efficient C++ multi-threaded sorting function based on C++11 threads

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages