Sort: implementation of sorting algorithms in C and CUDA

in #utopian-io7 years ago

sort

Repository of sorting algorithms in C and CUDA.

Proof of work

Information

The program generates and fills arrays in four different ways:

  1. arrays with totally random elements
  2. arrays already ordered
  3. arrays ordered in descending order
  4. arrays 90% ordered.

Sorting methods implemented

  1. Selection sort
  2. Insertion sort
  3. Shell sort
  4. Quick sort
  5. Heap sort
  6. Merge sort
  7. CUDA Quick sort
  8. CUDA Merge sort

Requirements

NVIDIA CUDA Toolkit 6.0, NVCC v6.0.1, GCC and G++

Follow these instructions to set up your environment:
prosciens’s tutorial to set up CUDA 6 compiler environment on Debian testing/sid

Our CUDA sorting code requires devices with CUDA compute capability 3.5 or higher, in order to use
the Dinamic Parallelism technology, read more about it here:

NVIDIA blog describing Dinamic Parallelism in Kepler GPUs

Compiling

Run the MAKEFILE

Instructions

To run the program, type:

./a.out -a $algorithm -n $number_of_elements -s $state [-P]

Parameters

  1. -a sorting algorithm
  1. -n number of elements
  2. -s array state
  3. -P print results
ParamValue
-aselection
insertion
shell
quick
heap
merge
gpuquick
gpumerge
-nint > 0
-srandom
ascending
descending
almost
-P

Tested

CUDA code tested on a GeForce GT 740M

GeForce GT 740MFeatures
CUDA Driver Version / Runtime Version6.5 / 6.0
CUDA Capability Major/Minor version number:3.5
Total amount of global memory:2048 MBytes (2147352576 bytes)
( 2) Multiprocessors, (192) CUDA Cores/MP:384 CUDA Cores



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Hey @icaro I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

The fastest sorting algorithm for CUDA I know of is radix sort.
It is included in the CUDA unbound library.
lsb_radix_sort_int32_keys.png

Coin Marketplace

STEEM 0.20
TRX 0.20
JST 0.034
BTC 89955.66
ETH 3105.10
USDT 1.00
SBD 2.98