qutil_qsort(3)
π 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 π
qutil_double_sum(3)qutil_double_mult(3)qutil_double_min(3)qutil_double_max(3)qutil_uint_sum(3)qutil_uint_mult(3)qutil_uint_min(3)qutil_uint_max(3)qutil_int_sum(3)qutil_int_mult(3)qutil_int_min(3)qutil_int_max(3)qsort(3)
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
- fedora 43: qthreads-devel 1.22^20251007gitcedb1fc-1.fc43 Β· BSD-3-Clause AND MIT AND dtoa
- fedora 44: qthreads-devel 1.22^20251007gitcedb1fc-2.fc44 Β· BSD-3-Clause AND MIT AND dtoa
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms