Apache SINGA
A distributed deep learning platform .
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Macros
Public Member Functions | Protected Attributes | List of all members
singa::Router Class Reference
Inheritance diagram for singa::Router:
singa::Socket

Public Member Functions

 Router (int bufsize=100)
 Constructor. More...
 
virtual int Bind (string endpoint)
 Setup the connection with dealers. More...
 
virtual int Send (Msg **msg)
 If the destination socket has not connected yet, buffer this the message.
 
virtual MsgReceive ()
 Receive a message from any connected socket. More...
 
virtual void * InternalID () const
 

Protected Attributes

zsock_t * router_
 
zpoller_t * poller_
 
std::map< int, zframe_t * > id2addr_
 
std::map< int, std::vector
< zmsg_t * > > 
bufmsg_
 
int nBufmsg_
 
int bufsize_
 
- Protected Attributes inherited from singa::Socket
int local_id_
 

Constructor & Destructor Documentation

singa::Router::Router ( int  bufsize = 100)

Constructor.

There is only one router per procs, hence its local id is 0 and is not set explicitly.

Parameters
bufsizebuffer at most this number of messages

Member Function Documentation

virtual int singa::Router::Bind ( string  endpoint)
virtual

Setup the connection with dealers.

It automatically binds to the endpoint for intra-process communication, i.e., "inproc://router".

Parameters
endpointthe identifier for the Dealer socket in other process to connect. It has the format IP:Port, where IP is the host machine. If endpoint is empty, it means that all connections are intra-process connection.
Returns
number of connected dealers.
virtual void* singa::Router::InternalID ( ) const
inlinevirtual
Returns
Identifier of the implementation dependent socket. E.g., zsock_t* for ZeroMQ implementation and rank for MPI implementation.

Implements singa::Socket.

virtual Msg* singa::Router::Receive ( )
virtual

Receive a message from any connected socket.

Returns
a message pointer if success; nullptr if failure

Implements singa::Socket.


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