megengine.dtr

enable

Enable to record computing path of tensors and to perform DTR policy.

disable

Stop recording computing path of tensors and performing DTR policy.

eviction_threshold(mod, value: Union[int, str])
Get or set the eviction threshold in bytes. It can also be set to a string,

whose formatting supports byte(B), kilobyte(KB), megabyte(MB) and gigabyte(GB) units.

注解

When GPU memory usage exceeds this value, DTR will heuristically select and evict resident tensors until the amount of used memory falls below this threshold.

例如:

import megengine as mge
mge.dtr.eviction_threshold = "2GB"
evictee_minimum_size(mod)
Get or set the memory threshold of tensors in bytes. It can also be set to a

string, whose formatting supports byte(B), kilobyte(KB), megabyte(MB) and gigabyte(GB) units.

注解

Only tensors whose size exceeds this threshold will be added to the candidate set. A tensor that is not added to the candidate set will never be evicted during its lifetime.

例如:

import megengine as mge
mge.dtr.evictee_minimum_size = "2MB"