mxnet icon indicating copy to clipboard operation
mxnet copied to clipboard

Reported memory consumption in contrast to real memory consumption.

Open vchuravy opened this issue 10 years ago • 9 comments

On a M6000 with 12GB the reported memory consumption from MXNet debug_str does not correspond to the real memory consumption measured with nvidia-smi.

cuDNN v5

Phase nvidia-smi debug_str batch size
Training 11310 MiB 6948 MiB 16
Training 5752 MiB 3474 MiB 8
Prediction 7208 MiB 3096 MiB 16

cuDNN v4

Phase nvidia-smi debug_str batch size
Training 11307 MiB 6948 MiB 16
Prediction 7442 MiB 3088 MiB 16

This network consists of

2*(Conv -> LeaktReLU -> BatchNorm) -> Pooling -> 2*(Conv -> LeaktReLU -> BatchNorm) -> Pooling
                                         |                                                |
                          Concat:    UpSampling                +                     UpSampling -> Conv -> Softmax  

vchuravy avatar May 10 '16 02:05 vchuravy

Debug Str reports internal allocation, such as internal representation, but not includes weight and gradient.

antinucleon avatar May 10 '16 03:05 antinucleon

could it be possible to get them equal? I noticed this problem in my previous experiment in #1981. The get_cost function parsed the debug_str to give a memory estimation.

Godricly avatar May 10 '16 03:05 Godricly

echo @antinucleon debug_str only amounts to the static allocation part of intermediate results, the real execution memory cost is going to be larger.

tqchen avatar May 10 '16 04:05 tqchen

So the example I am looking at right now is https://gist.github.com/vchuravy/bdd8b080a64621433359d039a1a38ae9

Am I right in assuming that every output that has no storage_id is not part of the internal allocation? Those should be parameters and gradient?

That would leave dynamic allocations?

vchuravy avatar May 10 '16 05:05 vchuravy

Is the workspace for deconvolution and convolution reported as part of the total allocated?

vchuravy avatar May 13 '16 07:05 vchuravy

no, they are not so far. These are dynamic memory that are allocated in the first pass

tqchen avatar May 13 '16 15:05 tqchen

We should have all information to compute the minimum size of the workspace during shape-inference. Would it be possible to make allocate workspace statically? I am currently working on a network where workspace is ~5GB with a network size of 3.3GB.

Edit: Maybe we could use aux for this? Or can't those not be shared between convolution. In an ideal world we would calculate the minimum workspace required for each convolution/deconvolution and then take the maximum workspace need and set it for all convolutions. Making memory usage queryable and thus predictable.

vchuravy avatar May 25 '16 08:05 vchuravy

.

mcxkarakoc avatar May 10 '17 15:05 mcxkarakoc

This issue is closed due to lack of activity in the last 90 days. Feel free to reopen if this is still an active issue. Thanks!

yajiedesign avatar Sep 30 '17 11:09 yajiedesign