gputimeit
Time required to run function on GPU
Description
measures the typical time, in seconds, required to run the function specified by the function handlet
= gputimeit(F
)F
. The function handle accepts no external input arguments, but you can defined it with input arguments to its internal function call.
callst
= gputimeit(F
,numOutputs
)F
with the desired number of output arguments,numOutputs
. By default,gputimeit
calls the functionF
with one output argument, or no output arguments ifF
does not return any output.
Examples
Input Arguments
Limitations
The function
F
must not calltic
ortoc
.You cannot use
tic
andtoc
to measure the execution time ofgputimeit
itself.
Tips
gputimeit
is preferable totimeit
for functions that use the GPU, because it ensures that all operations on the GPU have finished before recording the time and compensates for the overhead. For operations that do not use a GPU,timeit
offers greater precision.