You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2017/10/28 20:48:00 UTC
[GitHub] piiswrong closed pull request #8368: A hybrid model with sync and async in kvstore
piiswrong closed pull request #8368: A hybrid model with sync and async in kvstore
URL: https://github.com/apache/incubator-mxnet/pull/8368
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/src/kvstore/kvstore_dist_server.h b/src/kvstore/kvstore_dist_server.h
index bedb5398a0..0c30810d0e 100644
--- a/src/kvstore/kvstore_dist_server.h
+++ b/src/kvstore/kvstore_dist_server.h
@@ -174,7 +174,8 @@ class KVStoreDistServer {
inline void ApplyUpdates(const int key, MergeBuf *merged, NDArray *stored,
ps::KVServer<real_t>* server) {
- if (merged->request.size() == (size_t) ps::NumWorkers()) {
+ if (merged->request.size() == (size_t) ps::NumWorkers()
+ || (key >= key_thre && merged.request.size() == 1)) {
// let the main thread to execute updater_, which is necessary for python
if (updater_) {
exec_.Exec([this, key, merged, stored](){
@@ -382,6 +383,17 @@ class KVStoreDistServer {
dshape, cpu::kDevMask);
NDArray recved = NDArray(recv_blob, 0);
if (stored.is_none()) {
+ // init the key_thre
+ // the value is designed as [-99999999, key_thre]
+ if (key_thre == 99999999) {
+ if ((size_t)req_data.lens[0] == 2) {
+ DType* tmp = reinterpret_cast<DType*>recv_blob.dptr_;
+ if (tmp[0] == -99999999) {
+ key_thre = tmp[1];
+ }
+ }
+ }
+
// initialization
stored = NDArray(dshape, Context());
CopyFromTo(recved, &stored, 0);
@@ -442,6 +454,10 @@ class KVStoreDistServer {
// whether to LOG verbose information
bool log_verbose_;
+ // threshold for keys
+ // when key smaller than key_thre, value will update in sync model
+ // when key lager than key_thre, value will update in async model
+ int key_thre = 99999999;
};
} // namespace kvstore
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services