Max size for efficient vectorization?
Ältere Kommentare anzeigen
As far as I understand, vectorization can highly optimize code, because of its parallelization properties.
As you have for example n separate samples to treat, a classical for loop would imply that the computational time grows linealy:
.
By vectorizing, t remains virtually constant as function of n, as all n samples fit together in the shift register of the CPU.
However, this only works as long as
for some
that determines the maximum amount of floats to enter the register simultaneously. For
, computation will be sequential and thus with a linearly growing time again.
My question is: is there a simple way to find this
?
In addition: am I correct that the advantage of using gpuArray is that these can have larger
, while c is also larger? Are there similar commands to retrieve these parameters of the GPU?
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!