Galois
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
galois::runtime::NetworkInterface Class Referenceabstract

A class that defines functions that a network interface in Galois should have. More...

#include <Network.h>

Public Member Functions

 NetworkInterface ()
 Constructor for interface. More...
 
virtual ~NetworkInterface ()
 Destructor destroys MPI (if it exists). More...
 
void sendMsg (uint32_t dest, void(*recv)(uint32_t, RecvBuffer &), SendBuffer &buf)
 Send a message to a given (dest) host. More...
 
template<typename... Args>
void sendSimple (uint32_t dest, void(*recv)(uint32_t, Args...), Args...param)
 Send a message letting the network handle the serialization and deserialization slightly slower. More...
 
virtual void sendTagged (uint32_t dest, uint32_t tag, SendBuffer &buf, int type=0)=0
 Send a message to a given (dest) host. More...
 
void broadcast (void(*recv)(uint32_t, RecvBuffer &), SendBuffer &buf, bool self=false)
 Send a message to all hosts. More...
 
template<typename... Args>
void broadcastSimple (void(*recv)(uint32_t, Args...), Args...param)
 Broadcast a message allowing the network to handle serialization and deserialization. More...
 
void handleReceives ()
 Receive and dispatch messages. More...
 
void resetMemUsage ()
 Wrapper to reset the mem usage tracker's stats. More...
 
void reportMemUsage () const
 Reports the memory usage tracker's statistics to the stat manager. More...
 
virtual std::optional
< std::pair< uint32_t,
RecvBuffer > > 
recieveTagged (uint32_t tag, std::unique_lock< substrate::SimpleLock > *rlg, int type=0)=0
 Receive a tagged message. More...
 
virtual void flush ()=0
 move send buffers out to network More...
 
virtual bool anyPendingSends ()=0
 
virtual bool anyPendingReceives ()=0
 
virtual unsigned long reportSendBytes () const =0
 Get how many bytes were sent. More...
 
virtual unsigned long reportSendMsgs () const =0
 Get how many messages were sent. More...
 
virtual unsigned long reportRecvBytes () const =0
 Get how many bytes were received. More...
 
virtual unsigned long reportRecvMsgs () const =0
 Get how many messages were received. More...
 
virtual std::vector< unsigned
long > 
reportExtra () const =0
 Get any other extra statistics that might need to be reported; varies depending on implementation. More...
 
virtual std::vector< std::pair
< std::string, unsigned long > > 
reportExtraNamed () const =0
 Get the names of the extra things that are returned by reportExtra. More...
 

Static Public Attributes

static uint32_t ID = 0
 This machine's host ID. More...
 
static uint32_t Num = 1
 The total number of machines in the current program. More...
 

Protected Member Functions

void initializeMPI ()
 Initialize the MPI system. Should only be called once per process. More...
 
void finalizeMPI ()
 Finalize the MPI system. Should only be called once per process. More...
 

Protected Attributes

MemUsageTracker memUsageTracker
 Memory usage tracker. More...
 
std::atomic< size_t > inflightSends
 Number of inflight sends and receives. More...
 
std::atomic< size_t > inflightRecvs
 

Detailed Description

A class that defines functions that a network interface in Galois should have.

How the sends/recvs/stat-collecting happens as well as the network layer itself is up to the implemention of the class.

Constructor & Destructor Documentation

NetworkInterface::NetworkInterface ( )

Constructor for interface.

NetworkInterface::~NetworkInterface ( )
virtual

Destructor destroys MPI (if it exists).

Member Function Documentation

virtual bool galois::runtime::NetworkInterface::anyPendingReceives ( )
pure virtual
Returns
true if any receive is in progress or is pending to be dequeued
virtual bool galois::runtime::NetworkInterface::anyPendingSends ( )
pure virtual
Returns
true if any send is in progress or is pending to be enqueued
void NetworkInterface::broadcast ( void(*)(uint32_t, RecvBuffer &)  recv,
SendBuffer buf,
bool  self = false 
)

Send a message to all hosts.

A message is simply a landing pad (recv) and some data (buf) buf is invalidated by this operation

template<typename... Args>
void galois::runtime::NetworkInterface::broadcastSimple ( void(*)(uint32_t, Args...)  recv,
Args...  param 
)

Broadcast a message allowing the network to handle serialization and deserialization.

void NetworkInterface::finalizeMPI ( )
protected

Finalize the MPI system. Should only be called once per process.

virtual void galois::runtime::NetworkInterface::flush ( )
pure virtual

move send buffers out to network

void NetworkInterface::handleReceives ( )

Receive and dispatch messages.

void NetworkInterface::initializeMPI ( )
protected

Initialize the MPI system. Should only be called once per process.

virtual std::optional<std::pair<uint32_t, RecvBuffer> > galois::runtime::NetworkInterface::recieveTagged ( uint32_t  tag,
std::unique_lock< substrate::SimpleLock > *  rlg,
int  type = 0 
)
pure virtual

Receive a tagged message.

virtual std::vector<unsigned long> galois::runtime::NetworkInterface::reportExtra ( ) const
pure virtual

Get any other extra statistics that might need to be reported; varies depending on implementation.

Returns
vector of extra things to be reported
virtual std::vector<std::pair<std::string, unsigned long> > galois::runtime::NetworkInterface::reportExtraNamed ( ) const
pure virtual

Get the names of the extra things that are returned by reportExtra.

Returns
vector of the names of the reported extra things
void NetworkInterface::reportMemUsage ( ) const

Reports the memory usage tracker's statistics to the stat manager.

virtual unsigned long galois::runtime::NetworkInterface::reportRecvBytes ( ) const
pure virtual

Get how many bytes were received.

Returns
num bytes received
virtual unsigned long galois::runtime::NetworkInterface::reportRecvMsgs ( ) const
pure virtual

Get how many messages were received.

Returns
num messages received
virtual unsigned long galois::runtime::NetworkInterface::reportSendBytes ( ) const
pure virtual

Get how many bytes were sent.

Returns
num bytes sent
virtual unsigned long galois::runtime::NetworkInterface::reportSendMsgs ( ) const
pure virtual

Get how many messages were sent.

Returns
num messages sent
void galois::runtime::NetworkInterface::resetMemUsage ( )
inline

Wrapper to reset the mem usage tracker's stats.

void NetworkInterface::sendMsg ( uint32_t  dest,
void(*)(uint32_t, RecvBuffer &)  recv,
SendBuffer buf 
)

Send a message to a given (dest) host.

A message is simply a landing pad (recv, funciton pointer) and some data (buf) on the receiver, recv(buf) will be called durring handleReceives() buf is invalidated by this operation

template<typename... Args>
void galois::runtime::NetworkInterface::sendSimple ( uint32_t  dest,
void(*)(uint32_t, Args...)  recv,
Args...  param 
)

Send a message letting the network handle the serialization and deserialization slightly slower.

virtual void galois::runtime::NetworkInterface::sendTagged ( uint32_t  dest,
uint32_t  tag,
SendBuffer buf,
int  type = 0 
)
pure virtual

Send a message to a given (dest) host.

A message is simply a tag (tag) and some data (buf) on the receiver, buf will be returned on a receiveTagged(tag) buf is invalidated by this operation

Member Data Documentation

uint32_t galois::runtime::NetworkInterface::ID = 0
static

This machine's host ID.

std::atomic<size_t> galois::runtime::NetworkInterface::inflightRecvs
protected
std::atomic<size_t> galois::runtime::NetworkInterface::inflightSends
protected

Number of inflight sends and receives.

MemUsageTracker galois::runtime::NetworkInterface::memUsageTracker
protected

Memory usage tracker.

uint32_t galois::runtime::NetworkInterface::Num = 1
static

The total number of machines in the current program.


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