Out of memory error in matlab

조회 수: 1 (최근 30일)
Suhani Agarwal
Suhani Agarwal 2018년 2월 15일
댓글: Walter Roberson 2020년 6월 8일
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)

답변 (2개)

Joss Knight
Joss Knight 2018년 2월 15일
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.

Javier Pinzón
Javier Pinzón 2018년 3월 8일
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
  댓글 수: 1
Walter Roberson
Walter Roberson 2020년 6월 8일
If I recall, alexnet uses GPU by default. GPUs just do not have a lot of memory (and the situation is worse on MS Windows, which reserves a large chunk of memory for communicating with the GPU.)
Switching to Python will not increase the amount of memory that is available on your GPUs.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by