5. APIs¶
The data communicated are presented as key-value
pairs, where the key might be the uint64_t
(defined by ps::Key
) feature
index and the value might be the according float
gradient.
- Basic synchronization functions: \ref ps::KVWorker::Push, \ref ps::KVWorker::Pull, and \ref ps::KVWorker::Wait
- Dynamic length value push and pull: \ref ps::KVWorker::VPush and \ref ps::KVWorker::VPull
- Zero-copy versions: \ref ps::KVWorker::ZPush, \ref ps::KVWorker::ZPull, \ref ps::KVWorker::ZVPush and \ref ps::KVWorker::ZVPull
often server i handles the keys (feature indices) within the i-th
segment of [0, uint64_max]. The server node allows user-defined handles to
process the push
and pull
requests from the workers.
- Online key-value store \ref ps::OnlineServer
- Example user-defined value: \ref ps::IVal
- Example user-defined handle: \ref ps::IOnlineHandle
also We can also implement
, which is often used to monitor and control the progress of the machine learning application. It also can be used to deal with node failures. See an example in asynchronous SGD.
- template <typename Val>
-
struct
ps::
KVPairs
¶ the structure for a list of key-value pairs
The keys must be unique and sorted in an increasing order. The length of a value can be more than one. If lens is empty, then the length of a value is determined by
k=vals.size()/keys.size()
. The i-th KV pair is then{keys[i], (vals[i*k], ..., vals[(i+1)*k-1])}
If lens is given, then
lens[i]
is the length of the i-th value. Letn = lens[0] + .. + lens[i-1]
then the i-th KV pair is presented as
{keys[i], (vals[n], ..., vals[lens[i]+n-1])}