MATLAB: GPU gather command clarification and GPU memory usage

gpu memory gpuarray

Dear All,
1. If x is a gpuarray, and y its cpu correspondent, after the command
y=gather(x)
is x still on the GPU or is cleared (by being gathered on the cpu)?
2. Also, is there a way to see memory usage just on GPU at a certain time point, and not combined with the cpu memory usage?
3. Can x be saved on the hard drive without first being passed as y on the cpu?
Thank you,
Octavian.

Best Answer

  1. In this case, x still exists on the GPU - in general, input arguments to functions are not modified in MATLAB (some exceptions exist where the objects are handle types).
  2. Yes, look at the AvailableMemory field of the GPUDevice object returned by the function gpuDevice. See the documentation for more about this object
  3. Yes.