is using gpuArray instead of array in matlab more performant?

156 views Asked by At

If i use any function in the list at the following link:

Run Built-In Functions on a GPU with the argument being of the type gpuArray instead of array, will the result be computed faster? If the answer is yes, is there some case where it is more convinient to use an array instead of a gpuArray?

It is claimed that this question is a duplicate of this one:

why MATLAB gpuarray is much slower in just adding two matrices?

This is clearly not the case, since I am asking in a general manner, while this is comparing CPU to GPU for a specific code. At most, that link should provide an answer to this question.

1

There are 1 answers

0
gibarsin On

According to the official documentation:

Measure and Improve GPU Performance there exists at least one case where the CPU is more performant than the GPU, so the general answer is that the GPU does not necessarily compute faster:

On the same machine, this code displays the output:

Execution time on CPU = 0.019335

Execution time on GPU = 0.027235

I found this documentation to answer this question and provide an answer to those such as

  • Best Practices for Improving Performance
  • Comparison between increasing performance on the CPU and the GPU