anandj91 commented on a change in pull request #15124: [MXNET-1294]
Priority-based parameter propagation for improved data parallel training
throughput
URL: https://github.com/apache/incubator-mxnet/pull/15124#discussion_r370776741
##########
File path: python/mxnet/kvstore/kvstore.py
##########
@@ -104,8 +104,22 @@ def broadcast(self, key, value, out, priority=0):
[ 2. 2. 2.]]
"""
- self.init(key, value)
- self.pull(key, out=out, priority=priority)
+ cvkeys, cvals, use_str_keys = _ctype_key_value(key, value)
+ if out is not None:
+ cokeys, couts, _ = _ctype_key_value(key, out)
+ else:
+ cokeys = cvkeys
+ couts = cvals
+
+ if use_str_keys:
+ check_call(_LIB.MXKVStoreBroadcastEx(
+ self.handle, mx_uint(len(cvkeys)), cvkeys,
mx_uint(len(cokeys)), cokeys,
+ cvals, couts, ctypes.c_int(priority)))
+ else:
+ check_call(_LIB.MXKVStoreBroadcast(
+ self.handle, mx_uint(len(cvkeys)), cvkeys,
mx_uint(len(cokeys)), cokeys,
+ cvals, couts, ctypes.c_int(priority)))
+
Review comment:
if a user wants to directly use kvstore class, then probably have to use
name "dist_p3" to instantiate kvstore python class and also set
DMLC_PS_VAN_TYPE env var. seems a bit redundant to me.
I feel that we don't need separate python class for p3 except for overriding
is_capable(). But I think if we are planning to use DMLC_PS_VAN_TYPE in the
backend anyway, we probably can handle this by raising exception in the backend
if someone tries to set optimizer or updater in kvstore. So we don't need any
changes in the python frontend at all.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services