深度学习

MXNet分布式训练怎么完成的?

2018-03-30  本文已影响0人  gb_QA_log

MXNet

首先

incubator-mxnet/example/image-classification/中运行

python ../../tools/launch.py -n 2 -s 1 --launcher ssh -H hosts \
--sync-dst-dir /home/xugb/image-classification_test/  \
python train_mnist.py --network lenet --kv-store dist_sync

即python调用incubator-mxnet/tools/launch.py,同时传入参数

agrs function
-n 2
-s 1
--launcher ssh
-H hosts
--sync-dst-dir /home/xugb/image-classification_test/
python train_mnist.py --network lenet --kv-store dist_sync

之后解析这些参数
-n 2 -s 1 --launcher ssh -H hosts --sync-dst-dir /home/xugb/image-classification_test/

python train_mnist.py --network lenet --kv-store dist_sync
并且根据这些配置,调用相应函数。

连接各主机

incubator-mxnet/3rdparty/dmlc-core/tracker/dmlc_tracker/ssh.py

incubator-mxnet/3rdparty/dmlc-core/tracker/dmlc_tracker/tracker.py 初始化PSTracker作为PS的控制节点。然后返回调用ssh.py的函数,ssh连接其他server和worker,并运行python train_mnist.py --network lenet --kv-store dist_sync,环境和DMLC_ROLE都被传过去了。然后当前进程的控制权给PS scheduler。

各个节点的运行

incubator-mxnet/example/image-classification/train_imagenet.py根据传入的args,动态调用
incubator-mxnet/example/image-classification/symbols/lenet.py
incubator-mxnet/example/image-classification/common/date.py/得到data,
得到的参数再传入incubator-mxnet/example/image-classification/common/fit.py的fit函数。
fit则再调用incubator-mxnet/python/mxnet/model/module.py(继承incubator-mxnet/python/mxnet/model/base_module.py),接着看父类base_module的fit的文档

fit.py

module.py

c++的kvstore


cppkafka


librdkafka

src/rdkafka_transport.crd_kafka_transport_t *rd_kafka_transport_connect用broker thread建立socket连接。

上一篇 下一篇

猜你喜欢

热点阅读