GE_USE_STATIC_MEMORY
Description
Sets the memory allocation mode when the network is running. The options are as follows:
- 0 (default): dynamic memory allocation. Memory is dynamically allocated based on the actual size.
- 2: dynamic memory expansion supported by only static shape. During network running, this option can be used to implement memory reuse between multiple graphs in a session. That is, the memory required by the maximum graph is allocated. For example, if the memory required by the current graph exceeds the memory of the previous graph, the memory of the previous graph is directly released. The memory is reallocated based on the memory required by the current graph.
- 3: dynamic memory expansion supported by only dynamic shape, which solves the fragment problem during dynamic memory allocation and reduces the memory usage of the dynamic-shape network.
- 4: dynamic memory expansion supported by both static and dynamic shapes.
The default value is 0.
- This environment variable will be deprecated in later versions.
- This option cannot be set to 2 or 4 when multiple graphs are executed concurrently.
- To be compatible with earlier versions, the system adopts the method of mode 2 even if this option is set to 1.
- If this option is set to 3 or 4, memory gains are generated, but performance may deteriorate.
- In the TensorFlow training and online inference scenarios, this environment variable cannot be used together with static_memory_policy. Otherwise, conflicts will occur during network running. You are advised to use the static_memory_policy parameter to configure the memory allocation mode during network running.
- In the Ascend graph construction scenario, this environment variable cannot be used in conjunction with the ge.exec.staticMemoryPolicy parameter. Otherwise, a conflict may occur during network running. You are advised to use the ge.exec.staticMemoryPolicy parameter to configure the memory allocation mode during network running.
Example
export GE_USE_STATIC_MEMORY=2
Restrictions
None