In-place operation at gpuarray
Ältere Kommentare anzeigen
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
Antworten (1)
Joss Knight
am 4 Feb. 2016
Bearbeitet: Joss Knight
am 4 Feb. 2016
2 Stimmen
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.
Kategorien
Mehr zu Parallel Computing finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!