Re: CUDA Sorting

From: Thom Brown <thom(at)linux(dot)com>
To: Vitor Reus <vitor(dot)reus(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: CUDA Sorting
Date: 2011-09-19 12:27:59
Message-ID: CAA-aLv5sseO_PGStwchc4eW3aUeha1Nntn5wn7XzFb4ydKdbMg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 19 September 2011 13:11, Vitor Reus <vitor(dot)reus(at)gmail(dot)com> wrote:
> Hello everyone,
>
> I'm implementing a CUDA based sorting on PostgreSQL, and I believe it
> can improve the ORDER BY statement performance in 4 to 10 times. I
> already have a generic CUDA sort that performs around 10 times faster
> than std qsort. I also managed to load CUDA into pgsql.
>
> Since I'm new to pgsql development, I replaced the code of pgsql
> qsort_arg to get used with the way postgres does the sort. The problem
> is that I can't use the qsort_arg_comparator comparator function on
> GPU, I need to implement my own. I didn't find out how to access the
> sorting key value data of the tuples on the Tuplesortstate or
> SortTuple structures. This part looks complicated because it seems the
> state holds the pointer for the scanner(?), but I didn't managed to
> access the values directly. Can anyone tell me how this works?

I can't help with explaining the inner workings of sorting code, but
just a note that CUDA is a proprietary framework from nVidia and
confines its use to nVidia GPUs only. You'd probably be better off
investing in the OpenCL standard which is processor-agnostic. Work
has already been done in this area by Tim Child with pgOpenCL,
although doesn't appear to be available yet. It might be worth
engaging with him to see if there are commonalities to what you're
both trying to achieve.

--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2011-09-19 12:31:00 Re: Improve lseek scalability v3
Previous Message Vitor Reus 2011-09-19 12:11:14 CUDA Sorting