pytmosph3r.util.memory
Module Contents
- class MemoryUtils[source]
This class is inherited from
Logger
.- margin = 1
Margin (in ratio wrt available memory) that we can allow to allocate (to avoid swapping).
- check_memory(to_check, name=None)[source]
Check if memory of
to_check
is lower than available memory.- Parameters:
to_check (array, int) – If an array, calculate its theoretical memory based on its shape and dtype. If the
elements (number of) –
name (str, optional) – Name to print in message. Defaults to None. If
to_check
is an array,name. (it will try to retrieve the variable) –
- available_memory(to_check, obj_type=float)[source]
Returns how much of the available memory an object is consuming.
- Parameters:
to_check (array, int) – If an array, calculate its theoretical memory based on its shape and dtype. If the
elements (number of) –
obj_type (type, optional) – Type of
to_check
(to use only if it’s a number, not an array).float. (Defaults to) –