index_cn.html 8.7 KB
Newer Older
1 2 3 4 5 6 7 8 9 10


<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
11
  <title>分布式训练 &mdash; PaddlePaddle  文档</title>
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
  

  
  

  

  
  
    

  

  
  
    <link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
  

  
31

32 33 34 35 36
  
        <link rel="index" title="索引"
              href="../../genindex.html"/>
        <link rel="search" title="搜索" href="../../search.html"/>
    <link rel="top" title="PaddlePaddle  文档" href="../../index.html"/>
37
        <link rel="up" title="进阶使用" href="../index_cn.html"/>
38
        <link rel="next" title="环境准备" href="preparations_cn.html"/>
39
        <link rel="prev" title="细节描述" href="../cmd_parameter/detail_introduction_cn.html"/> 
40 41 42 43 44 45 46 47

  
  <script src="../../_static/js/modernizr.min.js"></script>

</head>

<body class="wy-body-for-nav" role="document">

48 49 50 51 52 53 54 55 56 57 58 59 60
  <div class="wy-grid-for-nav">

    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search">
          

          
            <a href="../../index_cn.html" class="icon icon-home"> PaddlePaddle
          

          
61 62
          </a>

63 64 65 66 67 68
          
            
            
          

          
69 70 71 72 73 74
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
75
</div>
76 77

          
78 79 80 81 82 83 84 85 86
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
                <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../getstarted/index_cn.html">新手入门</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../build_and_install/index_cn.html">安装与编译</a></li>
87
<li class="toctree-l1 current"><a class="reference internal" href="../index_cn.html">进阶使用</a><ul class="current">
88
<li class="toctree-l2"><a class="reference internal" href="../cmd_parameter/index_cn.html">命令行参数设置</a></li>
89 90 91
<li class="toctree-l2 current"><a class="current reference internal" href="#">分布式训练</a><ul>
<li class="toctree-l3"><a class="reference internal" href="preparations_cn.html">环境准备</a></li>
<li class="toctree-l3"><a class="reference internal" href="cmd_argument_cn.html">启动参数说明</a></li>
92
<li class="toctree-l3"><a class="reference internal" href="multi_cluster/index_cn.html">在不同集群中运行</a></li>
93 94
</ul>
</li>
95 96
<li class="toctree-l2"><a class="reference internal" href="../capi/index_cn.html">C-API预测库</a></li>
<li class="toctree-l2"><a class="reference internal" href="../rnn/index_cn.html">RNN模型</a></li>
97 98 99
<li class="toctree-l2"><a class="reference internal" href="../optimization/gpu_profiling_cn.html">GPU性能调优</a></li>
</ul>
</li>
100 101
<li class="toctree-l1"><a class="reference internal" href="../../dev/index_cn.html">开发标准</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../faq/index_cn.html">FAQ</a></li>
102 103
</ul>

104 105 106 107
            
          
        </div>
      </div>
108 109
    </nav>

110
    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
111

112 113 114 115 116
      
      <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
        <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
        <a href="../../index_cn.html">PaddlePaddle</a>
      </nav>
117 118


119 120 121 122
      
      <div class="wy-nav-content">
        <div class="rst-content">
          
123

124
 
125 126 127 128 129



<div role="navigation" aria-label="breadcrumbs navigation">
  <ul class="wy-breadcrumbs">
130
    <li><a href="../../index_cn.html">Docs</a> &raquo;</li>
131
      
132
          <li><a href="../index_cn.html">进阶使用</a> &raquo;</li>
133
      
134
    <li>分布式训练</li>
135 136 137 138 139 140 141
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="../../_sources/howto/cluster/index_cn.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
142
  </ul>
143
  <hr/>
144 145 146 147 148
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="id1">
149
<h1>分布式训练<a class="headerlink" href="#id1" title="永久链接至标题"></a></h1>
150 151 152 153 154 155 156 157 158
<p>本节将介绍如何使用PaddlePaddle在不同的集群框架下完成分布式训练。分布式训练架构如下图所示:</p>
<a class="reference internal image-reference" href="../../_images/ps_cn.png"><img alt="../../_images/ps_cn.png" src="../../_images/ps_cn.png" style="width: 500px;" /></a>
<ul class="simple">
<li>数据分片(Data shard): 用于训练神经网络的数据,被切分成多个部分,每个部分分别给每个trainer使用。</li>
<li>计算节点(Trainer): 每个trainer启动后读取切分好的一部分数据,开始神经网络的“前馈”和“后馈”计算,并和参数服务器通信。在完成一定量数据的训练后,上传计算得出的梯度(gradients),然后下载优化更新后的神经网络参数(parameters)。</li>
<li>参数服务器(Parameter server):每个参数服务器只保存整个神经网络所有参数的一部分。参数服务器接收从计算节点上传的梯度,并完成参数优化更新,再将更新后的参数下发到每个计算节点。</li>
</ul>
<p>这样,通过计算节点和参数服务器的分布式协作,可以完成神经网络的SGD方法的训练。PaddlePaddle可以同时支持同步随机梯度下降(SGD)和异步随机梯度下降。</p>
<p>在使用同步SGD训练神经网络时,PaddlePaddle使用同步屏障(barrier),使梯度的提交和参数的更新按照顺序方式执行。在异步SGD中,则并不会等待所有trainer提交梯度才更新参数,这样极大地提高了计算的并行性:参数服务器之间不相互依赖,并行地接收梯度和更新参数,参数服务器也不会等待计算节点全部都提交梯度之后才开始下一步,计算节点之间也不会相互依赖,并行地执行模型的训练。可以看出,虽然异步SGD方式会提高参数更新并行度, 但是并不能保证参数同步更新,在任意时间某一台参数服务器上保存的参数可能比另一台要更新,与同步SGD相比,梯度会有噪声。</p>
159 160
<div class="toctree-wrapper compound">
<ul>
161 162 163
<li class="toctree-l1"><a class="reference internal" href="preparations_cn.html">环境准备</a></li>
<li class="toctree-l1"><a class="reference internal" href="cmd_argument_cn.html">启动参数说明</a></li>
<li class="toctree-l1"><a class="reference internal" href="multi_cluster/index_cn.html">在不同集群中运行</a></li>
164 165 166 167 168 169 170 171 172 173 174
</ul>
</div>
</div>


           </div>
          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
175
        <a href="preparations_cn.html" class="btn btn-neutral float-right" title="环境准备" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a>
176 177
      
      
178
        <a href="../cmd_parameter/detail_introduction_cn.html" class="btn btn-neutral" title="细节描述" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a>
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2016, PaddlePaddle developers.

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  

    <script type="text/javascript">
        var DOCUMENTATION_OPTIONS = {
            URL_ROOT:'../../',
            VERSION:'',
            COLLAPSE_INDEX:false,
            FILE_SUFFIX:'.html',
212
            HAS_SOURCE:  true
213 214 215 216 217 218
        };
    </script>
      <script type="text/javascript" src="../../_static/jquery.js"></script>
      <script type="text/javascript" src="../../_static/underscore.js"></script>
      <script type="text/javascript" src="../../_static/doctools.js"></script>
      <script type="text/javascript" src="../../_static/translations.js"></script>
219
      <script type="text/javascript" src="https://cdn.bootcss.com/mathjax/2.7.0/MathJax.js"></script>
220

221 222 223 224 225 226
  

  
  
    <script type="text/javascript" src="../../_static/js/theme.js"></script>
  
227

228
  
229 230 231 232 233 234 235
  
  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.StickyNav.enable();
      });
  </script>
   
236 237

</body>
238
</html>