CUDA core median of choice

I need to calculate the median of an array of size p inside the CUDA kernel (in my case p is small, for example p = 10). I use the O (p ^ 2) algorithm for its simplicity, but at the expense of time performance.

Is there a β€œfunction” to find the median efficiency that I can call inside the CUDA core?

I know that I can implement a selection algorithm, but I'm looking for a function and / or verified code.

Thank!

+1
source share
2 answers

O (p * log (p)), O (p ^ 2) . p-, , O (log (p)), p. . :

:

+1

:

  1. : QuickSelect - QuickSort k- . , , TLP O (log ^ 2 n). 8- , , . , , , . , ( , , SM ), .
  2. . , . .
  3. , , shared memory, , .
  4. , (, 3x3 5x5), , . , , , , .
  5. , .

, . , CUDA, . , CUDA, , Visual Profiler.

+1

Source: https://habr.com/ru/post/1671298/


All Articles