In-place operation at gpuarray

I'm using Matlab 2015b on Ubuntu 14.04
I'm unable to perform inplace operations on gpuarray even when both left & right hand variables are the same.
For example:
gpA = ones (N,M,'single','gpuarray');
S = 5;
gpA = gpA.*S;
gpA = abs (gpA);
If N & M are big enough so gpA occupies more than half of the GPU memory, the above operations results in out of memory exception.
How do I perform simple inplace operations without writing a proprietary kernel?
Thanks in advance, David

Respuestas (1)

Joss Knight
Joss Knight el 4 de Feb. de 2016
Editada: Joss Knight el 4 de Feb. de 2016

2 votos

Do it inside a function. On the command line MATLAB cannot operate on the arguments to functions in-place, because (to cite one of the reasons) if a function errors or the user hits Ctrl-C it needs to be able to return your workspace to the state it was in before you ran the function, not some half-completed state.

Categorías

Más información sobre Parallel Computing en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 13 de En. de 2016

Editada:

el 4 de Feb. de 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by