Public Member Functions | Public Attributes | Friends

graphlab::dc_dist_object< T > Class Template Reference
[GraphLab RPC]

#include <dc_dist_object.hpp>

Inheritance diagram for graphlab::dc_dist_object< T >:
graphlab::dc_impl::dc_dist_object_base

List of all members.

Public Member Functions

void inc_calls_received (procid_t p)
 Should not be used by the user.
void inc_calls_sent (procid_t p)
 Should not be used by the user.
void inc_bytes_sent (procid_t p, size_t bytes)
 Should not be used by the user.
 dc_dist_object (distributed_control &dc_, T *owner, bool calltracking=false)
size_t calls_received () const
 The number of function calls received by this object.
size_t calls_sent () const
 The number of function calls send from this object.
size_t bytes_sent () const
distributed_controldc ()
 A reference to the underlying dc.
const distributed_controldc () const
 A reference to the underlying dc.
procid_t procid () const
 The current process ID.
procid_t numprocs () const
 The number of processes in the distributed program.
void comm_barrier (procid_t targetmachine)
void comm_barrier ()
 __attribute__ ((__deprecated__)) inline dc_services &services()
 BOOST_PP_REPEAT (6, RPC_INTERFACE_GENERATOR,(remote_call, dc_impl::object_call_issue, STANDARD_CALL)) BOOST_PP_REPEAT(6
FAST_CALL BOOST_PP_REPEAT (6, RPC_INTERFACE_GENERATOR,(control_call, dc_impl::object_call_issue,(FAST_CALL|CONTROL_PACKET))) BOOST_PP_REPEAT(6
FAST_CALL
dc_impl::function_ret_type
< __GLRPC_FRESULT >::type
STANDARD_CALL 
BOOST_PP_REPEAT (6, REQUEST_INTERFACE_GENERATOR,(typename dc_impl::function_ret_type< __GLRPC_FRESULT >::type fast_remote_request, dc_impl::object_request_issue, FAST_CALL)) BOOST_PP_REPEAT(6
 BOOST_PP_REPEAT (6, RPC_INTERFACE_GENERATOR,(internal_call, dc_impl::object_call_issue, STANDARD_CALL)) BOOST_PP_REPEAT(6
FAST_CALL BOOST_PP_REPEAT (6, RPC_INTERFACE_GENERATOR,(internal_control_call, dc_impl::object_call_issue,(FAST_CALL|CONTROL_PACKET))) BOOST_PP_REPEAT(6
FAST_CALL
dc_impl::function_ret_type
< __GLRPC_FRESULT >::type
STANDARD_CALL 
BOOST_PP_REPEAT (6, REQUEST_INTERFACE_GENERATOR,(typename dc_impl::function_ret_type< __GLRPC_FRESULT >::type internal_fast_request, dc_impl::object_request_issue, FAST_CALL)) BOOST_PP_REPEAT(6
template<typename U >
void send_to (procid_t target, U &t, bool control=false)
template<typename U >
void recv_from (procid_t source, U &t, bool control=false)
template<typename U >
void broadcast (U &data, bool originator, bool control=false)
template<typename U >
void gather (std::vector< U > &data, procid_t sendto, bool control=false)
template<typename U >
void all_gather (std::vector< U > &data, bool control=false)
template<typename U >
void gather_partition (const std::vector< U > &local_contribution, std::vector< std::vector< U > > &ret_partition, bool control=false)
void barrier ()
void full_barrier ()
std::map< std::string, size_t > gather_statistics ()

Public Attributes

 RPC_INTERFACE_GENERATOR
 fast_remote_call
FAST_CALL REQUEST_INTERFACE_GENERATOR
FAST_CALL
dc_impl::function_ret_type
< __GLRPC_FRESULT >::type 
remote_request
FAST_CALL
dc_impl::function_ret_type
< __GLRPC_FRESULT >::type
STANDARD_CALL 
REQUEST_INTERFACE_GENERATOR
FAST_CALL
dc_impl::function_ret_type
< __GLRPC_FRESULT >::type
STANDARD_CALL
dc_impl::function_ret_type
< __GLRPC_FRESULT >::type 
control_request
 internal_fast_call
FAST_CALL
dc_impl::function_ret_type
< __GLRPC_FRESULT >::type 
internal_request
FAST_CALL
dc_impl::function_ret_type
< __GLRPC_FRESULT >::type
STANDARD_CALL
dc_impl::function_ret_type
< __GLRPC_FRESULT >::type 
internal_control_request

Friends

class distributed_control

Detailed Description

template<typename T>
class graphlab::dc_dist_object< T >

Provides capabilities for distributed objects Your class should either inherit this, or instantiate it before any distributed object call. The requirement for using the distributed object is that all machines must construct the distributed objects in the same order. And, no distributed object calls should be make until it is guaranteed that all machines have constructed their respective distributed objects.

This class also acts as a single "context" spanning multiple machines. For instance, the barrier implemented here is fully localized to within a particular instance of this object. That is, multiple instances of the object can issue multiple independent barriers. The dc_services() object is a thin wrapper around the dc_dist_object.

This class implements several MPI-like primitive ops such as barrier, gather, broadcast, etc. These operations are not particular optimized and can be quite inefficient.

Definition at line 62 of file dc_dist_object.hpp.


Member Function Documentation

template<typename T>
graphlab::dc_dist_object< T >::__attribute__ ( (__deprecated__)   )  [inline]

This returns the set of services for the parent DC. This is deprecated. Use dc() to get access to the global context

Definition at line 239 of file dc_dist_object.hpp.

template<typename T>
template<typename U >
void graphlab::dc_dist_object< T >::all_gather ( std::vector< U > &  data,
bool  control = false 
) [inline]

Each machine creates a vector 'data' with size equivalent to the number of machines. Each machine then fills the entry data[procid()] with information that it wishes to communicate. After calling all_gather(), all machines will return with identical vectors 'data', where data[i] contains the information machine i stored.

Definition at line 691 of file dc_dist_object.hpp.

template<typename T>
void graphlab::dc_dist_object< T >::barrier (  )  [inline]

A regular barrier equivalent to MPI_Barrier. A machine entering this barrier will wait until every machine reaches this barrier before continuing. Only one thread from each machine should call the barrier.

See also:
full_barrier

Definition at line 953 of file dc_dist_object.hpp.

template<typename T>
FAST_CALL graphlab::dc_dist_object< T >::BOOST_PP_REPEAT ( ,
RPC_INTERFACE_GENERATOR  ,
(control_call, dc_impl::object_call_issue,(FAST_CALL|CONTROL_PACKET))   
)

Generates the interface functions. 3rd argument is a tuple (interface name, issue name, flags)

template<typename T>
template<typename U >
void graphlab::dc_dist_object< T >::broadcast ( U &  data,
bool  originator,
bool  control = false 
) [inline]

This function allows one machine to broadcasts a variable to all machines.

The originator calls broadcast with data provided in in 'data' and originator set to true. All other callers call with originator set to false.

The originator will then return 'data'. All other machines will receive the originator's transmission in the "data" parameter.

This call is guaranteed to have barrier-like behavior. That is to say, this call will block until all machines enter the broadcast function.

Note:
Behavior is undefined if more than one machine calls broadcast with originator set to true.
Behavior is undefined if multiple threads on the same machine call broadcast simultaneously. If multiple-thread broadcast is necessary, each thread should use its own instance of the services class.

Definition at line 506 of file dc_dist_object.hpp.

template<typename T>
void graphlab::dc_dist_object< T >::comm_barrier ( procid_t  targetmachine  )  [inline]

This comm barrier is not a true "barrier" but is essentially a sequentialization point. It guarantees that all calls from this machine to the target machine performed before the comm_barrier() call are completed before any call sent after the comm barrier() call.

Note:
This affects the global context

Definition at line 220 of file dc_dist_object.hpp.

template<typename T>
void graphlab::dc_dist_object< T >::comm_barrier (  )  [inline]

This is a convenience function which broadcasts a comm_barrier()

Note:
having all machines call the comm barrier does not guarantee that all calls have been processed. Basically 'p' local barriers do not result in a global barrier.
This affects the global context

Definition at line 231 of file dc_dist_object.hpp.

template<typename T>
void graphlab::dc_dist_object< T >::full_barrier (  )  [inline]

Similar to the barrier(), but provides additional guarantees that all RMI calls issued prior to this barrier are completed before returning.

Note:
This function could return prematurely if other threads are still issuing function calls since we cannot differentiate between calls issued before the barrier and calls issued while the barrier is being evaluated. Therefore, when used in a multithreaded scenario, the user must ensure that all other threads which may perform operations using this object are stopped before the full barrier is initated.
See also:
barrier

Definition at line 1035 of file dc_dist_object.hpp.

template<typename T>
template<typename U >
void graphlab::dc_dist_object< T >::gather ( std::vector< U > &  data,
procid_t  sendto,
bool  control = false 
) [inline]

Collects information contributed by each machine onto one machine. data must be of length data[numprocs]. My data is stored in data[dc.procid()]. when function returns, machine sendto will have the complete vector where data[i] is the data contributed by machine i. All machines must have the same parameter for "sendto"

Definition at line 571 of file dc_dist_object.hpp.

template<typename T>
template<typename U >
void graphlab::dc_dist_object< T >::gather_partition ( const std::vector< U > &  local_contribution,
std::vector< std::vector< U > > &  ret_partition,
bool  control = false 
) [inline]

This function is takes a vector of local elements T which must be comparable and constructs a vector of length numprocs where each element is a subset of the local contribution from that machine and the union of all elements in the union of all local contributions and all entries are unique:

Usage: Each process reads the files that are stored locally and wants to know which subset of local files to read even when multiple processes see the same files.

Definition at line 836 of file dc_dist_object.hpp.

template<typename T>
std::map<std::string, size_t> graphlab::dc_dist_object< T >::gather_statistics (  )  [inline]

Gather RPC statistics. All machines must call this function at the same time. However, only proc 0 will return values

Definition at line 1094 of file dc_dist_object.hpp.

template<typename T>
template<typename U >
void graphlab::dc_dist_object< T >::recv_from ( procid_t  source,
U &  t,
bool  control = false 
) [inline]

A blocking recv_from. Must be matched with a send_to call from the target before both source and target resumes.

Definition at line 432 of file dc_dist_object.hpp.

template<typename T>
template<typename U >
void graphlab::dc_dist_object< T >::send_to ( procid_t  target,
U &  t,
bool  control = false 
) [inline]

This is a blocking send_to. It send an object T to the target machine, but waits for the target machine to call recv_from before returning. Functionally similar to MPI's matched sending/receiving

Definition at line 402 of file dc_dist_object.hpp.


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