--disable_reuse_memory

Applicable Products

All processors

Description

Specifies whether to enable memory reuse.

Memory reuse refers to the practice of utilizing memory multiple times based on its lifecycle and size, ensuring that non-conflicting memory is reused to reduce network memory consumption.

See Also

None

Arguments

  • 0 (default): enabled
  • 1: disabled If the network model is large, disabling memory reuse will cause the device memory not to be reused during subsequent inference, resulting in insufficient memory.

Suggestions and Benefits

None

Example

--disable_reuse_memory=0

Dependencies and Restrictions

Memory reuse is enabled by default. You can select the operators to skip memory reusing. The operator (or operators separated by commas) specified by OP_NO_REUSE_MEM will use exclusively allocated memory. For details, see Environment Variables.

  • Configuration by node name:
    After the node name is converted to be compatible with the CANN platform, ensure that the node name is correctly configured. You can obtain the node name by setting DUMP_GE_GRAPH and viewing the name field in the exported ge_onnx_xxx_Build.pbtxt.
    export OP_NO_REUSE_MEM=gradients/logits/semantic/kernel/Regularizer/l2_regularizer_grad/Mul_1,resnet_v1_50/conv1_1/BatchNorm/AssignMovingAvg2
  • Configuration by operator type:
    export OP_NO_REUSE_MEM=FusedMulAddN,BatchNorm
  • Configuration by operator name and operator type:
    export OP_NO_REUSE_MEM=FusedMulAddN,resnet_v1_50/conv1_1/BatchNorm/AssignMovingAvg