tkwant.mpi.DistributedDict

class tkwant.mpi.DistributedDict(data=None, comm=None)[source]

A class to handle a dictionary which is distributed over MPI ranks.

Initialize the dictionary.

Parameters
  • data (dict, optional) – Dictionary with all initial one-body states. The dictionary can (and should be) distributed over all MPI ranks.

  • comm (mpi4py.MPI.Intracomm, optional) – The MPI communicator over which to parallelize the computation. By default, use the tkwant global MPI communicator.

Methods

add(key, value, rank=None, check=True)[source]

Add a key value pair to the dictionary

data(key, to_rank=None)[source]

Get the data corresponding to the key

delete(key)[source]

Delete a dictionary entry

key_is_present(key)[source]

Returns true if a key is present in the dataset

keys(rank=None)[source]

Get all keys of the dictionary

keys_are_unique()[source]

Returns true the stored dictionary data is not dublicated on MPI ranks

local_data()[source]

Get all data stored on the local MPI ranks

local_keys()[source]

Get all keys on the local MPI ranks

move_data(key, to_rank)[source]

Move the data to a specific MPI rank

rank_from_key(key)[source]

Get the MPI rank that hosts a specific key data

size(rank=None)[source]

Get the size of the dictonary