Utilities
- class rhodent.typing.DistributedArray
Array that contains data on the root rank of the calculation communicator. Acts as an empty numpy array on other ranks.
Is implemented as
numpy.ndarray
on the root rank andArrayIsOnRootRank
on other ranks.
- class rhodent.utils.Logger(t0=None)[source]
- Parameters:
t0 (
Optional
[float
]) – Start time (default is current time).
- class rhodent.utils.ResultKeys(*scalar_keys)[source]
List of result keys.
- add_key(key, shape=(), dtype=<class 'float'>)[source]
Add a new result key.
- Parameters:
key (
str
) – Name of result.shape (
tuple
[int
,...
] |int
) – Shape of result (at one time or frequency instance). Default is scalar.dtype (
Union
[dtype
[Any
],None
,type
[Any
],_SupportsDType
[dtype
[Any
]],str
,tuple
[Any
,int
],tuple
[Any
,SupportsIndex
|Sequence
[SupportsIndex
]],list
[Any
],_DTypeDict
,tuple
[Any
,Any
]]) – Result dtype.
- rhodent.utils.env.rhodent_getenv(variable)[source]
Get value of environment variable, or default.
Possible environment variables are:
RHODENT_RESPONSE_MAX_MEM
- Value in units of MiB. When constructing response, try to limit memory usage below this value.RHODENT_RESPONSE_MAX_MEM_PER_RANK
- Value in units of MiB. Ignored ifRHODENT_RESPONSE_MAX_MEM
is set.RHODENT_REDISTRIBUTE_MAXSIZE
- Maximal number of elements in single redistribute call. Larger arrays are split.
- Parameters:
variable – Name of variable, without the
'RHODENT_'
prefix.- Return type:
Value of variable as string.
- class rhodent.utils.memory.HasMemoryEstimate[source]
Classes inheriting from this class are able to provide a memory estimate
- class rhodent.utils.memory.MemoryEstimate(comment='', children=<factory>, arrays=<factory>)[source]
- property grand_total: int
Grand total of bytes.
- class rhodent.utils.result.ResultKeys(*scalar_keys)[source]
List of result keys.
- add_key(key, shape=(), dtype=<class 'float'>)[source]
Add a new result key.
- Parameters:
key (
str
) – Name of result.shape (
tuple
[int
,...
] |int
) – Shape of result (at one time or frequency instance). Default is scalar.dtype (
Union
[dtype
[Any
],None
,type
[Any
],_SupportsDType
[dtype
[Any
]],str
,tuple
[Any
,int
],tuple
[Any
,SupportsIndex
|Sequence
[SupportsIndex
]],list
[Any
],_DTypeDict
,tuple
[Any
,Any
]]) – Result dtype.