megengine.dtr

enable_sqrt_sampling

Get or set whether sqrt sampling is allowed. Sqrt sampling means that given the size of the candidate set is N, only enumerate sqrt(N) tensors. When the number of tensors is very high, enabling this optimization will speed up the training.

实际案例

import megengine as mge
mge.dtr.enable_sqrt_sampling = True
evictee_minimum_size

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"
eviction_threshold

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"