SublinearMemoryConfig#

class SublinearMemoryConfig(thresh_nr_try=10, genetic_nr_iter=0, genetic_pool_size=20, lb_memory_mb=0, num_worker=max(1, get_device_count('cpu') // 2))[source]#

Configuration for sublinear memory optimization.

Parameters:
  • thresh_nr_try (int) – number of samples both for searching in linear space and around current thresh in sublinear memory optimization. Default: 10. It can also be set through the environmental variable ‘MGB_SUBLINEAR_MEMORY_THRESH_NR_TRY’.

  • genetic_nr_iter (int) – number of iterations to find the best checkpoints in genetic algorithm. Default: 0. It can also be set through the environmental variable ‘MGB_SUBLINEAR_MEMORY_GENETIC_NR_ITER’.

  • genetic_pool_size (int) – number of samples for the crossover random selection during genetic optimization. Default: 20. It can also be set through the environmental variable ‘MGB_SUBLINEAR_MEMORY_GENETIC_POOL_SIZE’.

  • lb_memory_mb (int) – memory lower bound of bottleneck size in MB for sublinear memory optimization. It can be used to perform manual tradeoff between memory and speed. Default: 0. It can also be set through the environmental variable ‘MGB_SUBLINEAR_MEMORY_LOWER_BOUND_MB’.

  • num_worker (int) – number of thread workers to search the optimum checkpoints in sublinear memory optimization. Default: half of cpu number in the system. Note: the value must be greater or equal to one. It can also be set through the environmental variable ‘MGB_SUBLINEAR_MEMORY_WORKERS’.

Note that the environmental variable MGB_COMP_GRAPH_OPT must be set to ‘enable_sublinear_memory_opt=1’ in order for the above environmental variable to be effective.