#include <dc.hpp>
Classes | |
| struct | function_call_block |
Public Member Functions | |
| distributed_control (dc_init_param initparam) | |
| distributed_control (const std::vector< std::string > &machines, const std::string &initstring, procid_t curmachineid, size_t numhandlerthreads=DEFAULT_NUMHANDLERTHREADS, dc_comm_type commtype=DEFAULT_COMMTYPE) | |
| procid_t | procid () const |
| returns the id of the current processor | |
| procid_t | numprocs () const |
| returns the number of processors in total. | |
| BOOST_PP_REPEAT (6, RPC_INTERFACE_GENERATOR,(remote_call, dc_impl::remote_call_issue, STANDARD_CALL)) BOOST_PP_REPEAT(6 | |
| FAST_CALL | BOOST_PP_REPEAT (6, RPC_INTERFACE_GENERATOR,(control_call, dc_impl::remote_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::remote_request_issue, FAST_CALL)) BOOST_PP_REPEAT(6 |
|
FAST_CALL dc_impl::function_ret_type < __GLRPC_FRESULT >::type STANDARD_CALL dc_impl::function_ret_type < __GLRPC_FRESULT >::type FAST_CALL CONTROL_PACKET size_t | calls_sent () const |
| size_t | calls_received () const |
| size_t | bytes_sent () const |
| size_t | network_bytes_sent () const |
| size_t | bytes_received () const |
| bool | is_master_rank () const |
| procid_t | master_rank () const |
| template<typename F , F f> | |
| void | register_rpc (std::string c) |
| void | comm_barrier (procid_t targetmachine) |
| void | comm_barrier () |
| long long int | get_total_bytes_sent () |
| 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 () |
| void | fill_metrics () |
| metrics | get_metrics () |
| void | reset_metrics () |
| void | report_metrics (imetrics_reporter &reporter) |
Static Public Member Functions | |
| static unsigned char | set_sequentialization_key (unsigned char newkey) |
| static unsigned char | new_sequentialization_key () |
| static unsigned char | get_sequentialization_key () |
| gets the current sequentialization key. This function is not generally useful. | |
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 |
| long long int | total_bytes_sent |
Friends | |
| class | dc_dist_object |
| the callback given to the comms class. Called when data is inbound | |
| void | dc_recv_callback (void *tag, procid_t src, const char *buf, size_t len) |
| the callback given to the comms class. Called when data is inbound | |
graphlab::distributed_control is the primary distributed RPC object. This class initializes distributed communication, as well as provide basic RPC routines and collective operations.
In addition to the documented functions, the following RPC routines are provided.
Definition at line 152 of file dc.hpp.
| void graphlab::distributed_control::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.
| void graphlab::distributed_control::barrier | ( | ) |
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.
| void graphlab::distributed_control::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.
| void graphlab::distributed_control::comm_barrier | ( | procid_t | targetmachine | ) |
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.
| void graphlab::distributed_control::comm_barrier | ( | ) |
This is a convenience function which broadcasts a comm_barrier()
| void graphlab::distributed_control::fill_metrics | ( | ) |
Fills metrics information. All machines must call this function simultaneously. Only proc 0 will have metrics
| void graphlab::distributed_control::full_barrier | ( | ) |
Similar to the barrier(), but provides additional guarantees that all calls issued prior to this barrier are completed before returning.
| void graphlab::distributed_control::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"
| void graphlab::distributed_control::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.
| std::map<std::string, size_t> graphlab::distributed_control::gather_statistics | ( | ) |
Gather RPC statistics. All machines must call this function at the same time. However, only proc 0 will return values
| metrics graphlab::distributed_control::get_metrics | ( | ) | [inline] |
| bool graphlab::distributed_control::is_master_rank | ( | ) | const [inline] |
| procid_t graphlab::distributed_control::master_rank | ( | ) | const [inline] |
| static unsigned char graphlab::distributed_control::new_sequentialization_key | ( | ) | [static] |
Creates a new sequentialization key, returning the old value. All remote calls/remote requests made by the current thread will be sequentially processed by the remote machines.
Essentially all RPC calls made using the same key value will sequentialize. However, since new_sequentialization_key() uses a very naive key selection system, we recommend the use of set_sequentialization_key() especially in the case of multi-threaded code.
User should oldval = new_sequentialization_key() ... ... do stuff ... set_sequentialization_key(oldval) All RPC calls in while the key is set will be sequentialized on the receiving machine.
| void graphlab::distributed_control::recv_from | ( | procid_t | source, | |
| U & | t, | |||
| bool | control = false | |||
| ) | [inline] |
| void graphlab::distributed_control::register_rpc | ( | std::string | c | ) | [inline] |
| void graphlab::distributed_control::report_metrics | ( | imetrics_reporter & | reporter | ) | [inline] |
| void graphlab::distributed_control::send_to | ( | procid_t | target, | |
| U & | t, | |||
| bool | control = false | |||
| ) | [inline] |
| static unsigned char graphlab::distributed_control::set_sequentialization_key | ( | unsigned char | newkey | ) | [static] |
Sets the sequentialization key to the new value, returning the previous value. When the key is set to an arbitrary non-zero value, all remote calls/remote requests made by the current thread will be sequentially processed by the remote machines.
All RPC calls made using the same key value will sequentialize.
User should oldval = set_sequentialization_key(newval) ... ... do stuff ... set_sequentialization_key(oldval)
1.7.1