coder.gpu.kernelfun
Pragma that maps function to GPU kernels
Syntax
Description
coder.gpu.kernelfun()
is a global-level pragma that attempts
to map all the computation within the function it
resides in on to the GPU. Loops within this function are parallelized into GPU
kernels only if they pass the parallel-loop analysis check. This analysis tries to
prove that every loop iteration is independent of each other. In addition, the code
generator does not create GPU kernels for simple loops, such as those with few
iterations or that perform minimal computation. Parallelization of such loops can
decrease code performance due to the overhead of kernel creation and memory transfer
between the GPU and the CPU.
The kernelfun
pragma does not require
any input parameters. It generates kernels whose
dimensions are computed automatically based on loop parameters.
This function is a code generation function. It has no effect in MATLAB®.
Examples
Version History
Introduced in R2017b
See Also
Apps
Functions
codegen
|coder.gpu.kernel
|gpucoder.stencilKernel
|coder.gpu.constantMemory
|gpucoder.reduce
|gpucoder.sort
|coder.gpu.nokernel