Utils

exception mosaic.utils.utils.MultiError(exc)[source]

Bases: Exception

add(exc)[source]
mosaic.utils.utils.cpu_count()[source]

Get the number of available cores in the node.

Returns

Number of CPUs.

Return type

int

mosaic.utils.utils.gpu_count()[source]

Get the number of available GPUs in the node.

Returns

Number of GPUs.

Return type

int

mosaic.utils.utils.memory_limit()[source]

Get the memory limit (in bytes) for this system.

Takes the minimum value from the following locations: - Total system host memory - Cgroups limit (if set) - RSS rlimit (if set)

Returns

Memory limit.

Return type

float

mosaic.utils.utils.set_main_thread()[source]

Set current thread as main thread.

mosaic.utils.utils.sizeof(obj, seen=None)[source]

Recursively finds size of objects.

Parameters
  • obj (object) – Object to check size.

  • seen

Returns

Size in bytes.

Return type

float