What is reduction?
Reduction is an optimization strategy that is an expansion of the global kernel. With reduction, you can use multiple thread blocks and decompose a computation into multiple kernel invocations. So, reduction maximizes parallelization and lowers computation times by a huge extent.
To achieve reduction in CUDA-C/C++, you need to expand the __global__ kernel with multiple lines of code.
With PyCUDA, you can perform reduction in a single line by importing the reduction module. It is known as ReductionKernel and can be implemented with GPUArrays. You also have the option to use actual CUDA C/C++ reduction within the __global__ kernel itself, on PyCUDA.
We will revisit this perspective again in the next chapter when we compare ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access