在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:Horovod开源软件地址:https://gitee.com/mirrors/Horovod开源软件介绍:HorovodHorovod is a distributed deep learning training framework for TensorFlow, Keras, PyTorch, and Apache MXNet.The goal of Horovod is to make distributed deep learning fast and easy to use. Horovod is hosted by the LF AI & Data Foundation (LF AI & Data). If you are a company that is deeplycommitted to using open source technologies in artificial intelligence, machine, and deep learning, and want to supportthe communities of open source projects in these domains, consider joining the LF AI & Data Foundation. For detailsabout who's involved and how Horovod plays a role, read the Linux Foundation announcement. Contents DocumentationWhy Horovod?The primary motivation for this project is to make it easy to take a single-GPU training script and successfully scaleit to train across many GPUs in parallel. This has two aspects:
Internally at Uber we found the MPI model to be much more straightforward and require far less code changes than previoussolutions such as Distributed TensorFlow with parameter servers. Once a training script has been written for scale withHorovod, it can run on a single-GPU, multiple-GPUs, or even multiple hosts without any further code changes.See the Usage section for more details. In addition to being easy to use, Horovod is fast. Below is a chart representing the benchmark that was done on 128servers with 4 Pascal GPUs each connected by RoCE-capable 25 Gbit/s network: Horovod achieves 90% scaling efficiency for both Inception V3 and ResNet-101, and 68% scaling efficiency for VGG-16.See Benchmarks to find out how to reproduce these numbers. While installing MPI and NCCL itself may seem like an extra hassle, it only needs to be done once by the team dealingwith infrastructure, while everyone else in the company who builds the models can enjoy the simplicity of training them atscale. InstallTo install Horovod on Linux or macOS:
For more details on installing Horovod with GPU support, read Horovod on GPU. For the full list of Horovod installation options, read the Installation Guide. If you want to use MPI, read Horovod with MPI. If you want to use Conda, read Building a Conda environment with GPU support for Horovod. If you want to use Docker, read Horovod in Docker. To compile Horovod from source, follow the instructions in the Contributor Guide. ConceptsHorovod core principles are based on MPI concepts such as size, rank,local rank, allreduce, allgather, broadcast, and alltoall. See this pagefor more details. Supported frameworksSee these pages for Horovod examples and best practices:
UsageTo use Horovod, make the following additions to your program:
Example using TensorFlow v1 (see the examples directory for full training examples): import tensorflow as tfimport horovod.tensorflow as hvd# Initialize Horovodhvd.init()# Pin GPU to be used to process local rank (one GPU per process)config = tf.ConfigProto()config.gpu_options.visible_device_list = str(hvd.local_rank())# Build model...loss = ...opt = tf.train.AdagradOptimizer(0.01 * hvd.size())# Add Horovod Distributed Optimizeropt = hvd.DistributedOptimizer(opt)# Add hook to broadcast variables from rank 0 to all other processes during# initialization.hooks = [hvd.BroadcastGlobalVariablesHook(0)]# Make training operationtrain_op = opt.minimize(loss)# Save checkpoints only on worker 0 to prevent other workers from corrupting them.checkpoint_dir = '/tmp/train_logs' if hvd.rank() == 0 else None# The MonitoredTrainingSession takes care of session initialization,# restoring from a checkpoint, saving to a checkpoint, and closing when done# or an error occurs.with tf.train.MonitoredTrainingSession(checkpoint_dir=checkpoint_dir, config=config, hooks=hooks) as mon_sess: while not mon_sess.should_stop(): # Perform synchronous training. mon_sess.run(train_op) Running HorovodThe example commands below show how to run distributed training.See Run Horovod for more details, including RoCE/InfiniBand tweaks and tips for dealing with hangs.
GlooGloo is an open source collective communications library developed by Facebook. Gloo comes included with Horovod, and allows users to run Horovod without requiring MPI to be installed. For environments that have support both MPI and Gloo, you can choose to use Gloo at runtime by passing the $ horovodrun --gloo -np 2 python train.py mpi4pyHorovod supports mixing and matching Horovod collectives with other MPI libraries, such as mpi4py,provided that the MPI was built with multi-threading support. You can check for MPI multi-threading support by querying the import horovod.tensorflow as hvd# Initialize Horovodhvd.init()# Verify that MPI multi-threading is supported.assert hvd.mpi_threads_supported()from mpi4py import MPIassert hvd.size() == MPI.COMM_WORLD.Get_size() You can also initialize Horovod with an mpi4py sub-communicator, in which case each sub-communicatorwill run an independent Horovod training. from mpi4py import MPIimport horovod.tensorflow as hvd# Split COMM_WORLD into subcommunicatorssubcomm = MPI.COMM_WORLD.Split(color=MPI.COMM_WORLD.rank % 2, key=MPI.COMM_WORLD.rank)# Initialize Horovodhvd.init(comm=subcomm)print('COMM_WORLD rank: %d, Horovod rank: %d' % (MPI.COMM_WORLD.rank, hvd.rank())) InferenceLearn how to optimize your model for inference and remove Horovod operations from the graph here. Tensor FusionOne of the unique things about Horovod is its ability to interleave communication and computation coupled with the abilityto batch small allreduce operations, which results in improved performance. We call this batching feature Tensor Fusion. See here for full details and tweaking instructions. Horovod TimelineHorovod has the ability to record the timeline of its activity, called Horovod Timeline. Use Horovod timeline to analyze Horovod performance.See here for full details and usage instructions. Automated Performance TuningSelecting the right values to efficiently make use of Tensor Fusion and other advanced Horovod features can involvea good amount of trial and error. We provide a system to automate this performance optimization process calledautotuning, which you can enable with a single command line argument to See here for full details and usage instructions. Horovod Process SetsHorovod allows you to concurrently run distinct collective operations in different groups of processes taking part inone distributed training. Set up See Process Sets for detailed instructions. Guides
Send us links to any user guides you want to publish on this site TroubleshootingSee Troubleshooting and submit a ticketif you can't find an answer. CitationPlease cite Horovod in your publications if it helps your research: @article{sergeev2018horovod, Author = {Alexander Sergeev and Mike Del Balso}, Journal = {arXiv preprint arXiv:1802.05799}, Title = {Horovod: fast and easy distributed deep learning in {TensorFlow}}, Year = {2018}} Publications1. Sergeev, A., Del Balso, M. (2017) Meet Horovod: Uber’s Open Source Distributed Deep Learning Framework for TensorFlow.Retrieved from https://eng.uber.com/horovod/ 2. Sergeev, A. (2017) Horovod - Distributed TensorFlow Made Easy. Retrieved fromhttps://www.slideshare.net/AlexanderSergeev4/horovod-distributed-tensorflow-made-easy 3. Sergeev, A., Del Balso, M. (2018) Horovod: fast and easy distributed deep learning in TensorFlow. Retrieved fromarXiv:1802.05799 ReferencesThe Horovod source code was based off the Baidu tensorflow-allreducerepository written by Andrew Gibiansky and Joel Hestness. Their original work is described in the articleBringing HPC Techniques to Deep Learning. Getting Involved
|
请发表评论