DIY  3.0
data-parallel out-of-core C++ library
 All Classes Namespaces Functions Typedefs Groups Pages
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
diy::Master Class Reference

Classes

struct  BaseCommand
 
struct  Binder
 
struct  Collective
 
struct  Command
 
struct  IncomingQueuesRecords
 
struct  IncomingRound
 
struct  InFlightRecv
 
struct  InFlightSend
 
struct  MessageInfo
 
struct  NeverSkip
 
struct  OutgoingQueuesRecord
 
struct  ProcessBlock
 
struct  Proxy
 Communication proxy, used for enqueueing and dequeueing items for future exchange. More...
 
struct  ProxyWithLink
 
struct  QueuePolicy
 
struct  QueueRecord
 
struct  QueueSizePolicy
 Move queues out of core if their size exceeds a parameter given in the constructor. More...
 
struct  SkipNoIncoming
 
struct  tags
 

Public Types

typedef std::vector
< BaseCommand * > 
Commands
 
using Skip = std::function< bool(int, const Master &)>
 
typedef Collection::Create CreateBlock
 
typedef Collection::Destroy DestroyBlock
 
typedef Collection::Save SaveBlock
 
typedef Collection::Load LoadBlock
 
template<class Block >
using Callback = std::function< void(Block *, const ProxyWithLink &)>
 
typedef std::list< InFlightSendInFlightSendsList
 
typedef std::map< int,
InFlightRecv
InFlightRecvsMap
 
typedef std::list< int > ToSendList
 
typedef std::list< CollectiveCollectivesList
 
typedef std::map< int,
CollectivesList > 
CollectivesMap
 
typedef std::map< int,
QueueRecord
InQueueRecords
 
typedef std::map< int,
MemoryBuffer
IncomingQueues
 
typedef std::map< BlockID,
MemoryBuffer
OutgoingQueues
 
typedef std::map< BlockID,
QueueRecord
OutQueueRecords
 
typedef std::map< int,
IncomingQueuesRecords
IncomingQueuesMap
 
typedef std::map< int,
OutgoingQueuesRecord
OutgoingQueuesMap
 
typedef std::map< int,
IncomingRound
IncomingRoundMap
 

Public Member Functions

 Master (mpi::communicator comm, int threads__=1, int limit__=-1, CreateBlock create_=0, DestroyBlock destroy_=0, ExternalStorage *storage=0, SaveBlock save=0, LoadBlock load_=0, QueuePolicy *q_policy=new QueueSizePolicy(4096))
 The main DIY object. More...
 
void clear ()
 
void destroy (int i)
 
int add (int gid, void *b, Link *l)
 add a block
 
void * release (int i)
 release ownership of the block More...
 
void * block (int i) const
 
template<class Block >
Block * block (int i) const
 
Linklink (int i) const
 
int loaded_block () const
 
void unload (int i)
 
void load (int i)
 
void unload (std::vector< int > &loaded)
 
void unload_all ()
 
bool has_incoming (int i) const
 
void unload_queues (int i)
 
void unload_incoming (int gid)
 
void unload_outgoing (int gid)
 
void load_queues (int i)
 
void load_incoming (int gid)
 
void load_outgoing (int gid)
 
const mpi::communicatorcommunicator () const
 return the MPI communicator
 
mpi::communicatorcommunicator ()
 return the MPI communicator
 
void * get (int i)
 return the i-th block, loading it if necessary
 
int gid (int i) const
 return gid of the i-th block
 
int lid (int gid__) const
 return the local id of the local block with global id gid, or -1 if not local
 
bool local (int gid__) const
 whether the block with global id gid is local
 
void exchange ()
 exchange the queues between all the blocks (collective operation)
 
void process_collectives ()
 
ProxyWithLink proxy (int i) const
 
unsigned int size () const
 return the number of local blocks
 
void * create () const
 
int limit () const
 
int threads () const
 
int in_memory () const
 
void set_threads (int threads__)
 
CreateBlock creator () const
 
DestroyBlock destroyer () const
 
LoadBlock loader () const
 
SaveBlock saver () const
 
template<class Block >
void foreach_ (const Callback< Block > &f, const Skip &s=NeverSkip())
 call f with every block
 
template<class F >
void foreach (const F &f, const Skip &s=NeverSkip())
 
void execute ()
 
bool immediate () const
 
void set_immediate (bool i)
 
IncomingQueues & incoming (int gid__)
 
OutgoingQueues & outgoing (int gid__)
 
CollectivesList & collectives (int gid__)
 
size_t incoming_count (int gid__) const
 
size_t outgoing_count (int gid__) const
 
void set_expected (int expected)
 
void add_expected (int i)
 
int expected () const
 
void replace_link (int i, Link *link__)
 
void flush ()
 

Public Attributes

std::shared_ptr< spd::loggerlog = get_logger()
 
stats::Profiler prof
 

Detailed Description

Examples:
decomposition/regular-decomposer-long.cpp, decomposition/regular-decomposer-short.cpp, decomposition/test-direct-master.cpp, reduce/all-done.cpp, reduce/all-to-all.cpp, reduce/kd-tree.cpp, reduce/merge-reduce.cpp, reduce/sample-sort.cpp, reduce/sort.cpp, reduce/swap-reduce.cpp, simple/read-blocks.cpp, simple/simple.cpp, and simple/until-done.cpp.

Constructor & Destructor Documentation

diy::Master::Master ( mpi::communicator  comm,
int  threads__ = 1,
int  limit__ = -1,
CreateBlock  create_ = 0,
DestroyBlock  destroy_ = 0,
ExternalStorage storage = 0,
SaveBlock  save = 0,
LoadBlock  load_ = 0,
QueuePolicy q_policy = new QueueSizePolicy(4096) 
)
inline

The main DIY object.

Helper functions specify how to: create an empty block, destroy a block (a function that's expected to upcast and delete), serialize a block

Parameters
commcommunicator
threads__number of threads DIY can use
limit__number of blocks to store in memory
create_block create function; master manages creation if create != 0
destroy_block destroy function; master manages destruction if destroy != 0
storagestorage object (path, method, etc.) for storing temporary blocks being shuffled in/out of core
saveblock save function; master manages saving if save != 0
load_block load function; master manages loading if load != 0

Member Function Documentation

void * diy::Master::release ( int  i)
inline

release ownership of the block

return the i-th block


The documentation for this class was generated from the following file: