qutil_qsort(3)

πŸ“¦ version 1.22^20251007gitcedb1fc, in fedora 43, fedora 44

πŸ’– qutil_qsort(3) πŸ’–

okay bestie, so this one lives in the libqthread manual, and it's literally about sorting an array of doubles in parallel. like, multiple threads, all vibing, all sorting. no cap. πŸ¦‹


✨ NAME ✨

qutil_qsort, qutil_mergesort β€” sorts an array of doubles in parallel


🌸 SYNOPSIS 🌸

#include <qthread.h>
#include <qthread/qutil.h>

void
qutil_qsort (double *array, size_t length);

void
qutil_mergesort (double *array, size_t length);

πŸ’… DESCRIPTION πŸ’…

So basically, both of these functions take an array of length numbers and sort their values. that's the whole assignment. iconic behaviour, honestly. πŸŽ€

qutil_qsort() is the main character here. it gets large amounts of parallelism by using a strided lagging-loop structure for the partitioning phases of the sort, plus a tree structure (with a minimum leaf-size) for the divide-and-conquer phases. the design is based, partly, upon work done by CRAY for their MTA-threaded quicksort. and for sufficiently small arrays or sub-arrays, it just uses the libc qsort() function. lowkey efficient, highkey slay. πŸ”₯

qutil_mergesort() is a different vibe. the parallelism here comes solely from the obvious divide-and-conquer tree. the merge phases of the algorithm use an in-place merge rather than a lookaside merge, and as a result, the merge phases are rather computationally intensive. (this sort exists primarily as a proof of concept rather than as a useful alternative β€” so like, it's cute, but don't make it your whole personality. πŸ™ˆ)

the result of the sort is an array in increasing order. periodt. ⭐


πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole page bestie!! this one's from libqthread, dated APRIL 2011 β€” yes she's a vintage queen and she still eats πŸ’œβœ¨πŸ«Ά

πŸ“¦ where this page comes from