caffe icon indicating copy to clipboard operation
caffe copied to clipboard

What does "Memory required for data:" measure?

Open mingtop opened this issue 11 years ago • 6 comments

Here is the output of debug minist_letnet :

I1203 18:47:00.397809 4610 net.cpp:170] relu1 needs backward computation. I1203 18:47:00.397816 4610 net.cpp:170] ip1 needs backward computation. I1203 18:47:00.397825 4610 net.cpp:170] pool2 needs backward computation. I1203 18:47:00.397832 4610 net.cpp:170] conv2 needs backward computation. I1203 18:47:00.397843 4610 net.cpp:170] pool1 needs backward computation. I1203 18:47:00.397851 4610 net.cpp:170] conv1 needs backward computation. I1203 18:47:00.397860 4610 net.cpp:172] label_mnist_1_split does not need backward computation. I1203 18:47:00.397867 4610 net.cpp:172] mnist does not need backward computation. I1203 18:47:00.397874 4610 net.cpp:208] This network produces output accuracy I1203 18:47:00.397884 4610 net.cpp:208] This network produces output loss I1203 18:47:00.397905 4610 net.cpp:467] Collecting Learning Rate and Weight Decay. I1203 18:47:00.397915 4610 net.cpp:219] Network initialization done. I1203 18:47:00.397923 4610 net.cpp:220] Memory required for data: 8086808

memory required for data 8086808 is the total caffe needed for gpu , or only for input data(mnist)? the 8006808 is Byte?or bit ?

mingtop avatar Apr 29 '15 01:04 mingtop

Yeah, the memory requirement reported by caffe seems to have no correlation with either the actual memory used on the GPU or the file size of the .caffemodel.

So, what does it mean?

Is it the amount of memory set aside for prefetching the data?

lukeyeager avatar Apr 29 '15 18:04 lukeyeager

It's the memory required for all the top blobs or "data" in the sense of layer outputs. It excludes the diffs, the parameters, and any intermediate blobs within layers. @jeffdonahue do you remember the motivation for this number?

shelhamer avatar Apr 30 '15 18:04 shelhamer

Ah, so it's sizeof(data layer input) + sizeof(label layer input), in most cases? That doesn't seem particularly useful information.

Is is possible to report the max amount of memory that is going to be used by the GPU? That would be super useful for auto-tuning the batch-size. I fear that it's not possible because of this comment, but I don't understand why.

lukeyeager avatar May 01 '15 16:05 lukeyeager

@lukeyeager, no, @shelhamer means the memory for all top blobs, i.e., all "intermediate" data, not counting parameters and layer-specific buffers. (In DEBUG mode, you also get the total memory requirement printed after each layer is created.) Since layers are individually responsible for allocating parameters and buffers, there's no way in general to know the total amount of memory required except by running a forward pass.

For additional usage questions, please ask on caffe-users. Thanks!

longjon avatar May 08 '15 02:05 longjon

I will check the code to see this, I thought it's an very important information for me !

mingtop avatar May 14 '15 11:05 mingtop

Can I ask a question,what does the "XX does not need backward computation"mean? At the end of training

DouSong avatar Oct 06 '16 16:10 DouSong