|
virtual | ~KVStore () |
| virtual destructor More...
|
|
const std::string & | type () |
| return the type More...
|
|
virtual void | Init (const std::vector< int > &keys, const std::vector< NDArray > &values)=0 |
| Initialize a list of key-value pair to the store. More...
|
|
virtual void | Init (const std::vector< std::string > &str_keys, const std::vector< NDArray > &values)=0 |
| Initialize a list of key-value pair to the store. More...
|
|
virtual void | Push (const std::vector< int > &keys, const std::vector< NDArray > &values, int priority=0)=0 |
| push a list of key-value pairs into the store More...
|
|
virtual void | Push (const std::vector< std::string > &str_keys, const std::vector< NDArray > &values, int priority=0)=0 |
| push a list of key-value pairs into the store More...
|
|
virtual void | Pull (const std::vector< int > &keys, const std::vector< NDArray * > &values, int priority=0)=0 |
| pull a list of key-value pairs from the store More...
|
|
virtual void | Pull (const std::vector< std::string > &str_keys, const std::vector< NDArray * > &values, int priority=0)=0 |
| pull a list of key-value pairs from the store More...
|
|
virtual void | set_updater (const Updater &updater) |
| set an updater More...
|
|
void | set_barrier_before_exit (const bool barrier_before_exit) |
|
virtual int | get_rank () const |
|
virtual int | get_group_size () const |
|
virtual int | get_num_dead_node (int node_id, int timeout=60) const |
|
virtual void | Barrier () |
| global barrier among all worker machines More...
|
|
virtual void | SendCommandToServers (int cmd_id, const std::string &cmd_body) |
| Send a command to all server nodes. More...
|
|
virtual void | RunServer (const Controller &controller) |
| Run as server (or scheduler) More...
|
|
distributed key-value store
A distributed key-value store for data synchronization over multiple devices/machines. It support user-defined updater.
virtual void mxnet::KVStore::Init |
( |
const std::vector< int > & |
keys, |
|
|
const std::vector< NDArray > & |
values |
|
) |
| |
|
pure virtual |
Initialize a list of key-value pair to the store.
One must initialize the key before Push and Pull, and a key should be only initialized once
It returns after data have been initialized successfully.
For multiple workers, all workers must call Init. But only worker 0 (get_rank() == 0)'s values are used for initialization. So others' values can be empty (but not keys). This function blocks until all workers are finished. That means, any worker can push and pull on the keys now.
- Parameters
-
keys | a list of unique keys |
values | a list of values |
virtual void mxnet::KVStore::Push |
( |
const std::vector< int > & |
keys, |
|
|
const std::vector< NDArray > & |
values, |
|
|
int |
priority = 0 |
|
) |
| |
|
pure virtual |
push a list of key-value pairs into the store
If a key appears mulitple times in keys, then the according values will be aggregated (summed) before pushing.
The (aggregated) values are merged into the store one by one
updater(key, value, &value_in_store);
One can set a user-defined updater by set_updater. The default updater is Assign.
This function returns after adding a push operator to the engine. Any following operator requiring writing value will be blocked until the actual push is finished. One can wait the push is finished by
- when type == "local"
for (auto& v : values) v.WaitToWrite()
- when type == "dist"
One must call Init() on every key before. And the value NDArray should be always has the same shape as being inited.
- Parameters
-
keys | the list of keys |
values | the list of values |
priority | Priority of the action. |