Re: CUDA Sorting - Mailing list pgsql-hackers

From Thom Brown
Subject Re: CUDA Sorting
Date
Msg-id CAA-aLv7jR8ajGuuWqJKTmYB_YsW0d3PgvVNG8EzBgxJYMPcYJA@mail.gmail.com
Whole thread Raw
In response to CUDA Sorting  (Vitor Reus <vitor.reus@gmail.com>)
List pgsql-hackers
On 19 September 2011 14:32, Vitor Reus <vitor.reus@gmail.com> wrote:
> 2011/9/19 Thom Brown <thom@linux.com>:
>> On 19 September 2011 13:11, Vitor Reus <vitor.reus@gmail.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
>>
>
> Hi Thom Brown,
>
> thank you very much for your reply.
>
> I am aware that CUDA is a proprietary framework, but since the high
> level CUDA API is easier than OpenCL, it will be faster to implement
> and test. Also, CUDA can be translated to OpenCL in a straightforward
> way, since the low level CUDA API generated code is really similar to
> OpenCL.
>
> I'll try engaging with Tim Child, but it seems that his work is to
> create GPU support for specific SQL, like procedural SQL statements
> with CUDA extensions, did I understand it right? And my focus is to
> "unlock" the GPU power without the user being aware of this.

Please use Reply To All in your responses so the mailing list is included.

Is your aim to have this committed into core PostgreSQL, or just for
your own version?  If it's the former, I don't anticipate any
enthusiasm from the hacker community.

But you're right, Tim Child's work is aimed at procedural acceleration
rather than speeding up core functionality (from what I gather
anyway).

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

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


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Range Types - typo + NULL string constructor
Next
From: Josh Berkus
Date:
Subject: Re: Is there really no interest in SQL Standard?