MATLAB Answers

0

Out of memory error in matlab

Asked by Suhani Agarwal on 15 Feb 2018
Latest activity Answered by Javier Pinzón on 8 Mar 2018
trainingFeatures = activations(net, trainingSet, featureLayer, ...
'MiniBatchSize', 10, 'OutputAs', 'columns');
trainingSet is an imagestore containing 3 million entries.
net is a pretrained alexnet.
featureLayer we are using is fc7 .
This is the line which I am using, But I am getting error messege
Error using zeros
Out of memory. Type HELP MEMORY for your options.
Error in SeriesNetwork/activations (line 365)
Y = precision.cast( zeros(sz) );
I am using Matlab 2017a, GPU enabled & RAM of 16GB. I had done below mention things to resolve problem but it doesn't get resolved
In Matlab, Home-> Preference->General->JavaHeapMemory->(Then increase the size)

  0 Comments

Sign in to comment.

2 Answers

Answer by Joss Knight
on 15 Feb 2018

Clearly you can't store the activations for your entire dataset in memory. fc7 of AlexNet has 4096 single precision outputs. That's 16K. So 3 million of those takes 45 GB.
Try computing the activations in chunks.

  0 Comments

Sign in to comment.


Answer by Javier Pinzón on 8 Mar 2018

Hello Suhani,
That happens when you GPU can store all the data of one iteration or the data of the activations, so it do not let you continue with the process.
The best way to know what is happening in your GPU consumption, is with this:
- I recommend you to install a third party program called AfterBurner, it let you see how many memory are you using in your GPU.
- If your GPU is about 2 GB space, so it probably is getting out of memory because of it capacity, so you can check if the highest value of memory is reached with the third party software at the time you run your program.
Hope it may help you
Regards,
Javier

  0 Comments

Sign in to comment.