
320 Accelerating MATLAB
®
Performance
methods of the gpuArray object. When all GPU computations are done, the result is trans-
ferred to MATLAB workspace via the gather command:
out = gather(out);
It is important to understand the relation between the C-prototype of a CUDA kernel
and the input/output parameters supplied to the feval command. That is, when calling
[out1, out2] = feval(kernel, in1, in2, in3)
the inputs in1, in2, and in3 correspond to each of the input argument to the C function
within our CU le. The out1, out2 outputs store the values of the non-const pointer input
arguments to the C function after the CUDA kernel has been executed. ...