nbodykit¶
Functions
|
Turn on logging, with the specified level. |
|
Setup nbodykit to work with dask.distributed. |
|
Setup nbodykit to work with MPI. |
Classes
A class to faciliate getting and setting the current MPI communicator. |
|
|
A Cache object. |
|
Set global configuration options. |
- class nbodykit.CurrentMPIComm[source]¶
A class to faciliate getting and setting the current MPI communicator.
Methods
enable(func)Decorator to attach the current MPI communicator to the input keyword arguments of
func, via thecommkeyword.enter(comm)Enters a context where the current default MPI communicator is modified to the argument comm.
get()Get the default current MPI communicator.
pop()Restore to the previous current default MPI communicator
push(comm)Switch to a new current default MPI communicator
set(comm)Set the current MPI communicator to the input value.
- static enable(func)[source]¶
Decorator to attach the current MPI communicator to the input keyword arguments of
func, via thecommkeyword.
- classmethod enter(comm)[source]¶
Enters a context where the current default MPI communicator is modified to the argument comm. After leaving the context manager the communicator is restored.
Example:
with CurrentMPIComm.enter(comm): cat = UniformCatalog(...)
is identical to
cat = UniformCatalog(..., comm=comm)
- class nbodykit.GlobalCache(cache, *args, **kwargs)[source]¶
A Cache object.
Methods
get()Return the global cache object.
register
unregister
- classmethod get()[source]¶
Return the global cache object. The default size is controlled by the
global_cache_sizeglobal option; seeset_options.- Returns
cache – the cache object, as provided by dask
- Return type
dask.cache.Cache
- class nbodykit.set_options(**kwargs)[source]¶
Set global configuration options.
- Parameters
dask_chunk_size (int) – the number of elements for the default chunk size for dask arrays; chunks should usually hold between 10 MB and 100 MB
global_cache_size (float) – the size of the internal dask cache in bytes; default is 1e9
paint_chunk_size (int) – the number of objects to paint at the same time. This is independent from dask chunksize.
- nbodykit.setup_logging(log_level='info')[source]¶
Turn on logging, with the specified level.
- Parameters
log_level ('info', 'debug', 'warning') – the logging level to set; logging below this level is ignored
- nbodykit.use_distributed(c=None)[source]¶
Setup nbodykit to work with dask.distributed. This will change the default MPI communicator to MPI.COMM_SELF, such that each nbodykit object only reside on a single MPI rank.
This function shall only be used before any nbodykit object is created.
- Parameters
c (Client) – the distributed client. If not given, the default client is used. Notice that if you switch a new client then this function must be called again.