feval - Evaluate kernel on GPU - MATLAB (original) (raw)
Syntax
Description
feval([kern](#mw%5Fd403e26e-d0b8-4df4-9641-1d6f8759f6d3),[x1,...,xn](#mw%5Fc7bf9b95-aaf4-49fa-8502-a8c488d15ab9))
evaluates the CUDA kernel kern
with the argumentsx1,...,xn
. The number of input arguments, n
, must be equal to the value of the NumRHSArguments
property ofkern
, and their types must match the description in theArgumentTypes
property of kern
. The input data can be regular MATLABĀ® data, GPU arrays, or both.
[[y1,...,ym](#mw%5F94c2debe-ffc3-48d1-b799-3dcb8f87ff84)] = feval([kern](#mw%5Fd403e26e-d0b8-4df4-9641-1d6f8759f6d3),[x1,...,xn](#mw%5Fc7bf9b95-aaf4-49fa-8502-a8c488d15ab9))
returns multiple output arguments from the evaluation of the kernel. Each output argument corresponds to the value of the non-constant pointer inputs to the CUDA kernel after it has executed. The output from feval
running a kernel on the GPU is always agpuArray
, even if all the inputs are stored in host memory. The number of output arguments, m
, must not exceed the value of theMaxNumLHSArguments
property of kern
.
Examples
If the CUDA kernel within a CU file has this signature:
void myKernel(const float * pIn, float * pInOut1, float * pInOut2)
Then, the corresponding kernel object in MATLAB has these properties:
MaxNumLHSArguments: 2 NumRHSArguments: 3 ArgumentTypes: {'in single vector' ... 'inout single vector' 'inout single vector'}
Use feval
on this kernel (KERN
) with this syntax:
[y1, y2] = feval(KERN,x1,x2,x3)
The three input arguments, x1
, x2
, andx3
, correspond to the three arguments that are passed into the CUDA function. The output arguments, y1
and y2
, aregpuArray
objects, and correspond to the values ofpInOut1
and pInOut2
after the CUDA kernel has executed.
Input Arguments
Arguments to evaluate the kernel with, specified as MATLAB data, a gpuArray object, or a mixture of the two. The number of these arguments must be equal to the value of theNumRHSArguments
property of the kern
argument, and their types must match the description in the ArgumentTypes
property of the kern
argument.
Output Arguments
Output from the evaluation of the CUDA kernel, returned as agpuArray
object. The number of these arguments must not exceed the value of the MaxNumLHSArguments
property of thekern
input argument.
Version History
Introduced in R2010b