Added: websites/staging/singa/trunk/content/v0.2.0/communication.html
==============================================================================
--- websites/staging/singa/trunk/content/v0.2.0/communication.html (added)
+++ websites/staging/singa/trunk/content/v0.2.0/communication.html Tue Apr 12 
06:24:50 2016
@@ -0,0 +1,714 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia at 2016-04-12 
+ | Rendered using Apache Maven Fluido Skin 1.4
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta name="Date-Revision-yyyymmdd" content="20160412" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>Apache SINGA &#x2013; Communication</title>
+    <link rel="stylesheet" href="../css/apache-maven-fluido-1.4.min.css" />
+    <link rel="stylesheet" href="../css/site.css" />
+    <link rel="stylesheet" href="../css/print.css" media="print" />
+
+      
+    
+    
+  
+    <script type="text/javascript" 
src="../js/apache-maven-fluido-1.4.min.js"></script>
+
+                          
+        
+<script 
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
 type="text/javascript"></script>
+                      
+        
+<script type="text/x-mathjax-config">MathJax.Hub.Config({tex2jax: {inlineMath: 
[['$','$'], ['\\(','\\)']]}});</script>
+                      
+        
+<meta content="Apache SINGA" name="author"/>
+                      
+        
+<meta content="SINGA, Deep Learning, Distributed training" name="keywords"/>
+          
+                  </head>
+        <body class="topBarEnabled">
+          
+    
+    
+            
+    
+        
+    <a href="https://github.com/apache/incubator-singa";>
+      <img style="position: absolute; top: 0; right: 0; border: 0; z-index: 
10000;"
+        
src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png";
+        alt="Fork me on GitHub">
+    </a>
+  
+                
+                    
+                
+
+    <div id="topbar" class="navbar navbar-fixed-top navbar-inverse">
+      <div class="navbar-inner">
+                <div class="container-fluid">
+        <a data-target=".nav-collapse" data-toggle="collapse" class="btn 
btn-navbar">
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+        </a>
+                
+                                <ul class="nav">
+                          <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Apache 
SINGA <b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="../docs/overview.html"  
title="Introduction">Introduction</a>
+</li>
+                  
+                      <li>      <a href="../docs/quick-start.html"  
title="Quick Start">Quick Start</a>
+</li>
+                  
+                      <li>      <a href="../downloads.html"  
title="Downloads">Downloads</a>
+</li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" 
data-toggle="dropdown">Documentaion <b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li class="dropdown-submenu">
+                                      <a href="../docs/index.html"  
title="v0.3.0">v0.3.0</a>
+              <ul class="dropdown-menu">
+                                  <li>      <a href="../docs/index.html"  
title="English">English</a>
+</li>
+                                  <li>      <a href="../docs/zh/index.html"  
title="中文">中文</a>
+</li>
+                                  <li>      <a href="../docs/jp/index.html"  
title="日本語">日本語</a>
+</li>
+                                  <li>      <a href="../docs/kr/index.html"  
title="한국어">한국어</a>
+</li>
+                              </ul>
+            </li>
+                  
+                      <li>      <a href="../v0.2.0/index.html"  
title="v0.2.0">v0.2.0</a>
+</li>
+                  
+                      <li>      <a href="../v0.1.0/index.html"  
title="v0.1.0">v0.1.0</a>
+</li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Development 
<b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="../develop/schedule.html"  
title="Schedule">Schedule</a>
+</li>
+                  
+                      <li class="dropdown-submenu">
+                                      <a href="../develop/how-contribute.html" 
 title="How to Contribute">How to Contribute</a>
+              <ul class="dropdown-menu">
+                                  <li>      <a 
href="../develop/contribute-code.html"  title="Code">Code</a>
+</li>
+                                  <li>      <a 
href="../develop/contribute-docs.html"  title="Documentation">Documentation</a>
+</li>
+                              </ul>
+            </li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Community 
<b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="../community/source-repository.html"  
title="Source Repository">Source Repository</a>
+</li>
+                  
+                      <li>      <a href="../community/mail-lists.html"  
title="Mailing Lists">Mailing Lists</a>
+</li>
+                  
+                      <li>      <a href="../community/issue-tracking.html"  
title="Issue Tracking">Issue Tracking</a>
+</li>
+                  
+                      <li>      <a href="../community/team-list.html"  
title="SINGA Team">SINGA Team</a>
+</li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">External 
Links <b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="http://www.apache.org/";  
title="Apache Software Foundation">Apache Software Foundation</a>
+</li>
+                  
+                      <li>      <a 
href="http://www.comp.nus.edu.sg/~dbsystem/singa/";  title="NUS Site">NUS 
Site</a>
+</li>
+                          </ul>
+      </li>
+                  </ul>
+          
+          
+          
+                   
+                      </div>
+          
+        </div>
+      </div>
+    </div>
+    
+        <div class="container-fluid">
+          <div id="banner">
+        <div class="pull-left">
+                                                  <a href="../index.html" 
id="bannerLeft" title="Apache SINGA">
+                                                                               
                 <img src="../images/singa-logo.png"  alt="Apache SINGA"/>
+                </a>
+                      </div>
+        <div class="pull-right">              <div id="bannerRight">
+                                                                               
                 <img src="../images/singa-title.png"  alt="Apache SINGA"/>
+                </div>
+      </div>
+        <div class="clear"><hr/></div>
+      </div>
+
+      <div id="breadcrumbs">
+        <ul class="breadcrumb">
+                
+                    
+                              <li class="">
+                    <a href="../index.html" title="Apache SINGA">
+        Apache SINGA</a>
+                    <span class="divider">/</span>
+      </li>
+        <li class="active ">Communication</li>
+        
+                
+                    
+      
+                            </ul>
+      </div>
+
+                  
+      <div class="row-fluid">
+        <div id="leftColumn" class="span2">
+          <div class="well sidebar-nav">
+                
+                    
+                <ul class="nav nav-list">
+                    <li class="nav-header">Apache SINGA</li>
+                              
+      <li>
+  
+                          <a href="../docs/overview.html" title="Introduction">
+          <span class="none"></span>
+        Introduction</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../docs/quick-start.html" title="Quick 
Start">
+          <span class="none"></span>
+        Quick Start</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../downloads.html" title="Downloads">
+          <span class="none"></span>
+        Downloads</a>
+            </li>
+                              <li class="nav-header">Documentaion</li>
+                                                                               
                                                       
+      <li>
+  
+                          <a href="../docs/index.html" title="v0.3.0">
+          <span class="icon-chevron-right"></span>
+        v0.3.0</a>
+                  </li>
+                
+      <li>
+  
+                          <a href="../v0.2.0/index.html" title="v0.2.0">
+          <span class="none"></span>
+        v0.2.0</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../v0.1.0/index.html" title="v0.1.0">
+          <span class="none"></span>
+        v0.1.0</a>
+            </li>
+                              <li class="nav-header">Development</li>
+                              
+      <li>
+  
+                          <a href="../develop/schedule.html" title="Schedule">
+          <span class="none"></span>
+        Schedule</a>
+            </li>
+                                                                               
     
+      <li>
+  
+                          <a href="../develop/how-contribute.html" title="How 
to Contribute">
+          <span class="icon-chevron-right"></span>
+        How to Contribute</a>
+                  </li>
+                              <li class="nav-header">Community</li>
+                              
+      <li>
+  
+                          <a href="../community/source-repository.html" 
title="Source Repository">
+          <span class="none"></span>
+        Source Repository</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../community/mail-lists.html" 
title="Mailing Lists">
+          <span class="none"></span>
+        Mailing Lists</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../community/issue-tracking.html" 
title="Issue Tracking">
+          <span class="none"></span>
+        Issue Tracking</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../community/team-list.html" title="SINGA 
Team">
+          <span class="none"></span>
+        SINGA Team</a>
+            </li>
+                              <li class="nav-header">External Links</li>
+                              
+      <li>
+  
+                          <a href="http://www.apache.org/"; 
class="externalLink" title="Apache Software Foundation">
+          <span class="none"></span>
+        Apache Software Foundation</a>
+            </li>
+                
+      <li>
+  
+                          <a 
href="http://www.comp.nus.edu.sg/~dbsystem/singa/"; class="externalLink" 
title="NUS Site">
+          <span class="none"></span>
+        NUS Site</a>
+            </li>
+            </ul>
+                
+                    
+                
+          <hr />
+
+           <div id="poweredBy">
+                            <div class="clear"></div>
+                            <div class="clear"></div>
+                            <div class="clear"></div>
+                            <div class="clear"></div>
+                                                                               
                                    <a href="http://incubator.apache.org"; 
title="apache-incubator" class="builtBy">
+        <img class="builtBy"  alt="Apache Incubator" 
src="http://incubator.apache.org/images/egg-logo.png";    />
+      </a>
+                      </div>
+          </div>
+        </div>
+        
+                        
+        <div id="bodyColumn"  class="span10" >
+                                  
+            <h1>Communication</h1>
+<hr />
+<p>Different messaging libraries has different benefits and drawbacks. For 
instance, MPI provides fast message passing between GPUs (using GPUDirect), but 
does not support fault-tolerance well. On the contrary, systems using ZeroMQ 
can be fault-tolerant, but does not support GPUDirect. The AllReduce function 
of MPI is also missing in ZeroMQ which is efficient for data aggregation for 
distributed training. In Singa, we provide general messaging APIs for 
communication between threads within a process and across processes, and let 
users choose the underlying implementation (MPI or ZeroMQ) that meets their 
requirements.</p>
+<p>Singa&#x2019;s messaging library consists of two components, namely the 
message, and the socket to send and receive messages. <b>Socket</b> refers to a 
Singa defined data structure instead of the Linux Socket. We will introduce the 
two components in detail with the following figure as an example 
architecture.</p>
+<p><img src="../images/arch/arch2.png" style="width: 550px" alt="" /> <img 
src="../images/arch/comm.png" style="width: 550px" alt="" /> 
+<p><b> Fig.1 - Example physical architecture and network connection</b></p>
+<p>Fig.1 shows an example physical architecture and its network connection. <a 
href="architecture.html}">Section-partition server side ParamShard</a> has a 
detailed description of the architecture. Each process consists of one main 
thread running the stub and multiple background threads running the worker and 
server tasks. The stub of the main thread forwards messages among threads . The 
worker and server tasks are performed by the background threads.</p>
+<div class="section">
+<h2><a name="Message"></a>Message</h2>
+<p><object type="image/svg+xml" style="width: 100px" data="../images/msg.svg"> 
Not supported </object> 
+<p><b> Fig.2 - Logical message format</b></p>
+<p>Fig.2 shows the logical message format which has two parts, the header and 
the content. The message header includes the sender&#x2019;s and 
receiver&#x2019;s IDs, each consisting of the group ID and the worker/server ID 
within the group. The stub forwards messages by looking up an address table 
based on the receiver&#x2019;s ID. There are two sets of messages according to 
the message type defined below.</p>
+
+<ul>
+  
+<li>
+<p>kGet/kPut/kRequest/kSync for messages about parameters</p></li>
+  
+<li>
+<p>kFeaBlob/kGradBlob for messages about transferring feature and gradient  
blobs of one layer to its neighboring layer</p></li>
+</ul>
+<p>There is a target ID in the header. If the message body is parameters, the 
target ID is then the parameter ID. Otherwise the message is related to layer 
feature or gradient, and the target ID consists of the layer ID and the blob ID 
of that layer. The message content has multiple frames to store the parameter 
or feature data.</p>
+<p>The API for the base Msg is:</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">/**
+ * Msg used to transfer Param info (gradient or value), feature blob, etc
+ * between workers, stubs and servers.
+ *
+ * Each msg has a source addr and dest addr identified by a unique integer.
+ * It is also associated with a target field (value and version) for ease of
+ * getting some meta info (e.g., parameter id) from the msg.
+ *
+ * Other data is added into the message as frames.
+ */
+class Msg {
+ public:
+  ~Msg();
+  Msg();
+  /**
+   * Construct the msg providing source and destination addr.
+   */
+  Msg(int src, int dst);
+  /**
+   * Copy constructor.
+   */
+  Msg(const Msg&amp; msg);
+  /**
+   * Swap the src/dst addr
+   */
+  void SwapAddr();
+  /**
+   * Add a frame (a chunk of bytes) into the message
+   */
+  void AddFrame(const void* addr, int nBytes);
+  /**
+   * @return num of bytes of the current frame.
+   */
+  int FrameSize();
+  /**
+   * @return the pointer to the current frame data.
+   */
+  void* FrameData();
+  /**
+   * @return the data of the current frame as c string
+   */
+  char* FrameStr();
+  /**
+   * Move the cursor to the first frame.
+   */
+  void FirstFrame();
+  /**
+   * Move the cursor to the last frame.
+   */
+  void LastFrame();
+  /**
+   * Move the cursor to the next frame
+   * @return true if the next frame is not NULL; otherwise false
+   */
+  bool NextFrame();
+  /**
+   *  Add a 'format' frame to the msg (like CZMQ's zsock_send).
+   *
+   *  The format is a string that defines the type of each field.
+   *  The format can contain any of these characters, each corresponding to
+   *  one or two arguments:
+   *  i = int (signed)
+   *  1 = uint8_t
+   *  2 = uint16_t
+   *  4 = uint32_t
+   *  8 = uint64_t
+   *  p = void * (sends the pointer value, only meaningful over inproc)
+   *  s = char**
+   *
+   *  Returns size of the added content.
+   */
+  int AddFormatFrame(const char *format, ...);
+  /**
+   *  Parse the current frame added using AddFormatFrame(const char*, ...).
+   *
+   *  The format is a string that defines the type of each field.
+   *  The format can contain any of these characters, each corresponding to
+   *  one or two arguments:
+   *  i = int (signed)
+   *  1 = uint8_t
+   *  2 = uint16_t
+   *  4 = uint32_t
+   *  8 = uint64_t
+   *  p = void * (sends the pointer value, only meaningful over inproc)
+   *  s = char**
+   *
+   *  Returns size of the parsed content.
+   */
+  int ParseFormatFrame(const char* format, ...);
+
+#ifdef USE_ZMQ
+  void ParseFromZmsg(zmsg_t* msg);
+  zmsg_t* DumpToZmsg();
+#endif
+
+  /**
+   * @return msg size in terms of bytes, ignore meta info.
+   */
+  int size() const;
+  /**
+   * Set source addr.
+   * @param addr unique identify one worker/server/stub in the current job
+   */
+  void set_src(int addr) { src_ = addr; }
+  /**
+   * @return source addr.
+   */
+  int src() const { return src_; }
+  /**
+   * Set destination addr.
+   * @param addr unique identify one worker/server/stub in the current job
+   */
+  void set_dst(int addr) { dst_ = addr; }
+  /**
+   * @return dst addr.
+   */
+  int dst() const { return dst_; }
+  /**
+   * Set msg type, e.g., kPut, kGet, kUpdate, kRequest
+   */
+  void set_type(int type) { type_ = type; }
+  /**
+   * @return msg type.
+   */
+  int type() const { return type_; }
+  /**
+   * Set msg target.
+   *
+   * One msg has a target to identify some entity in worker/server/stub.
+   * The target is associated with a version, e.g., Param version.
+   */
+  void set_trgt(int val, int version) {
+    trgt_val_ = val;
+    trgt_version_ = version;
+  }
+  int trgt_val() const {
+    return trgt_val_;
+  }
+  int trgt_version() const {
+    return trgt_version_;
+  }
+
+};
+</pre></div></div>
+<p>In order for a Msg object to be routed, the source and dest address should 
be attached. This is achieved by calling the set_src and set_dst methods of the 
Msg object. The address parameter passed to these two methods can be 
manipulated via a set of helper functions, shown as below.</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">/**
+ * Wrapper to generate message address
+ * @param grp worker/server group id
+ * @param id_or_proc worker/server id or procs id
+ * @param type msg type
+ */
+inline int Addr(int grp, int id_or_proc, int type) {
+  return (grp &lt;&lt; 16) | (id_or_proc &lt;&lt; 8) | type;
+}
+
+/**
+ * Parse group id from addr.
+ *
+ * @return group id
+ */
+inline int AddrGrp(int addr) {
+  return addr &gt;&gt; 16;
+}
+/**
+ * Parse worker/server id from addr.
+ *
+ * @return id
+ */
+inline int AddrID(int addr) {
+  static const int mask = (1 &lt;&lt; 8) - 1;
+  return (addr &gt;&gt; 8) &amp; mask;
+}
+
+/**
+ * Parse worker/server procs from addr.
+ *
+ * @return procs id
+ */
+inline int AddrProc(int addr) {
+  return AddrID(addr);
+}
+/**
+ * Parse msg type from addr
+ * @return msg type
+ */
+inline int AddrType(int addr) {
+  static const int mask = (1 &lt;&lt; 8) -1;
+  return addr &amp; mask;
+}
+</pre></div></div></div>
+<div class="section">
+<h2><a name="Socket"></a>Socket</h2>
+<p>In SINGA, there are two types of sockets, the Dealer Socket and the Router 
Socket, whose names are adapted from ZeroMQ. All connections are of the same 
type, i.e., Dealer&lt;&#x2013;&gt;Router. The communication between dealers and 
routers are asynchronous. In other words, one Dealer socket can talk with 
multiple Router sockets, and one Router socket can talk with multiple Dealer 
sockets.</p>
+<div class="section">
+<h3><a name="Base_Socket"></a>Base Socket</h3>
+<p>The basic functions of a Singa Socket is to send and receive messages. The 
APIs are:</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">class SocketInterface {
+ public:
+  virtual ~SocketInterface() {}
+  /**
+    * Send a message to connected socket(s), non-blocking. The message
+    * will be deallocated after sending, thus should not be used after
+    * calling Send();
+    *
+    * @param msg The message to be sent
+    * @return 1 for success queuing the message for sending, 0 for failure
+    */
+  virtual int Send(Msg** msg) = 0;
+  /**
+    * Receive a message from any connected socket.
+    *
+    * @return a message pointer if success; nullptr if failure
+    */
+  virtual Msg* Receive() = 0;
+  /**
+   * @return Identifier of the implementation dependent socket. E.g., zsock_t*
+   * for ZeroMQ implementation and rank for MPI implementation.
+   */
+  virtual void* InternalID() const = 0;
+};
+</pre></div></div>
+<p>A poller class is provided to enable asynchronous communication between 
routers and dealers. One can register a set of SocketInterface objects with a 
poller instance via calling its Add method, and then call the Wait method of 
this poll object to wait for the registered SocketInterface objects to be ready 
for sending and receiving messages. The APIs of the poller class is shown 
below.</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">class Poller {
+ public:
+  Poller();
+  Poller(SocketInterface* socket);
+  /**
+    * Add a socket for polling; Multiple sockets can be polled together by
+    * adding them into the same poller.
+    */
+  void Add(SocketInterface* socket);
+  /**
+    * Poll for all sockets added into this poller.
+    * @param timeout Stop after this number of mseconds
+    * @return pointer To the socket if it has one message in the receiving
+    * queue; nullptr if no message in any sockets,
+    */
+  SocketInterface* Wait(int duration);
+
+  /**
+   * @return true if the poller is terminated due to process interupt
+   */
+  virtual bool Terminated();
+};
+</pre></div></div></div>
+<div class="section">
+<h3><a name="Dealer_Socket"></a>Dealer Socket</h3>
+<p>The Dealer socket inherits from the base Socket. In Singa, every Dealer 
socket only connects to one Router socket as shown in Fig.1. The connection is 
set up by connecting the Dealer socket to the endpoint of a Router socket.</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">class Dealer : public 
SocketInterface {
+ public:
+  /*
+   * @param id Local dealer ID within a procs if the dealer is from worker or
+   * server thread, starts from 1 (0 is used by the router); or the connected
+   * remote procs ID for inter-process dealers from the stub thread.
+   */
+  Dealer();
+  explicit Dealer(int id);
+  ~Dealer() override;
+  /**
+    * Setup the connection with the router.
+    *
+    * @param endpoint Identifier of the router. For intra-process
+    * connection, the endpoint follows the format of ZeroMQ, i.e.,
+    * starting with &quot;inproc://&quot;; in Singa, since each process has one
+    * router, hence we can fix the endpoint to be &quot;inproc://router&quot; 
for
+    * intra-process. For inter-process, the endpoint follows ZeroMQ's
+    * format, i.e., IP:port, where IP is the connected process.
+    * @return 1 connection sets up successfully; 0 otherwise
+    */
+  int Connect(const std::string&amp; endpoint);
+  int Send(Msg** msg) override;
+  Msg* Receive() override;
+  void* InternalID() const override;
+};
+</pre></div></div></div>
+<div class="section">
+<h3><a name="Router_Socket"></a>Router Socket</h3>
+<p>The Router socket inherits from the base Socket. One Router socket connects 
to at least one Dealer socket. Upon receiving a message, the router forwards it 
to the appropriate dealer according to the receiver&#x2019;s ID of this 
message.</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">class Router : public 
SocketInterface {
+ public:
+  Router();
+  /**
+   * There is only one router per procs, hence its local id is 0 and is not set
+   * explicitly.
+   *
+   * @param bufsize Buffer at most this number of messages
+   */
+  explicit Router(int bufsize);
+  ~Router() override;
+  /**
+   * Setup the connection with dealers.
+   *
+   * It automatically binds to the endpoint for intra-process communication,
+   * i.e., &quot;inproc://router&quot;.
+   *
+   * @param endpoint The identifier for the Dealer socket in other process
+   * to connect. It has the format IP:Port, where IP is the host machine.
+   * If endpoint is empty, it means that all connections are
+   * intra-process connection.
+   * @return number of connected dealers.
+   */
+  int Bind(const std::string&amp; endpoint);
+  /**
+   * If the destination socket has not connected yet, buffer this the message.
+   */
+  int Send(Msg** msg) override;
+  Msg* Receive() override;
+  void* InternalID() const override;
+
+};
+</pre></div></div></div></div>
+<div class="section">
+<h2><a name="Implementation"></a>Implementation</h2>
+<div class="section">
+<h3><a name="ZeroMQ"></a>ZeroMQ</h3>
+<p><b>Why <a class="externalLink" href="http://zeromq.org/";>ZeroMQ</a>?</b> 
Our previous design used MPI for communication between Singa processes. But MPI 
is a poor choice when it comes to fault-tolerance, because failure at one node 
brings down the entire MPI cluster. ZeroMQ, on the other hand, is fault 
tolerant in the sense that one node failure does not affect the other nodes. 
ZeroMQ consists of several basic communication patterns that can be easily 
combined to create more complex network topologies.</p>
+<p><img src="../images/msg-flow.png" style="width: 550px" alt="" /> 
+<p><b> Fig.3 - Messages flow for ZeroMQ</b></p>
+<p>The communication APIs of Singa are similar to the DEALER-ROUTER pattern of 
ZeroMQ. Hence we can easily implement the Dealer socket using ZeroMQ&#x2019;s 
DEALER socket, and Router socket using ZeroMQ&#x2019;s ROUTER socket. The 
intra-process can be implemented using ZeroMQ&#x2019;s inproc transport, and 
the inter-process can be implemented using the tcp transport (To exploit the 
Infiniband, we can use the sdp transport). Fig.3 shows the message flow using 
ZeroMQ as the underlying implementation. The messages sent from dealers has two 
frames for the message header, and one or more frames for the message content. 
The messages sent from routers have another frame for the identifier of the 
destination dealer.</p>
+<p>Besides the DEALER-ROUTER pattern, we may also implement the Dealer socket 
and Router socket using other ZeroMQ patterns. To be continued.</p></div>
+<div class="section">
+<h3><a name="MPI"></a>MPI</h3>
+<p>Since MPI does not provide intra-process communication, we have to 
implement it inside the Router and Dealer socket. A simple solution is to 
allocate one message queue for each socket. Messages sent to one socket is 
inserted into the queue of that socket. We create a SafeQueue class to ensure 
the consistency of the queue. All queues are created by the main thread and 
passed to all sockets&#x2019; constructor via <i>args</i>.</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">/**
+ * A thread safe queue class.
+ * There would be multiple threads pushing messages into
+ * the queue and only one thread reading and popping the queue.
+ */
+class SafeQueue{
+ public:
+  void Push(Msg* msg);
+  Msg* Front();
+  void Pop();
+  bool empty();
+};
+</pre></div></div>
+<p>For inter-process communication, we serialize the message and call 
MPI&#x2019;s send/receive functions to transfer them. All inter-process 
connections are setup by MPI at the beginning. Consequently, the Connect and 
Bind functions do nothing for both inter-process and intra-process 
communication.</p>
+<p>MPI&#x2019;s AllReduce function is efficient for data aggregation in 
distributed training. For example, <a class="externalLink" 
href="http://arxiv.org/abs/1501.02876";>DeepImage of Baidu</a> uses AllReduce to 
aggregate the updates of parameter from all workers. It has similar 
architecture as <a href="architecture.html">Fig.2</a>, where every process has 
a server group and is connected with all other processes. Hence, we can 
implement DeepImage in Singa by simply using MPI&#x2019;s AllReduce function 
for inter-process communication.</p></div></div>
+                  </div>
+            </div>
+          </div>
+
+    <hr/>
+
+    <footer>
+            <div class="container-fluid">
+                      <div class="row-fluid">
+                                                                          
+<p>Copyright © 2015 The Apache Software Foundation. All rights reserved. 
Apache Singa, Apache, the Apache feather logo, and the Apache Singa project 
logos are trademarks of The Apache Software Foundation. All other marks 
mentioned may be trademarks or registered trademarks of their respective 
owners.</p>
+                          </div>
+
+        
+                </div>
+    </footer>
+        </body>
+</html>

Added: websites/staging/singa/trunk/content/v0.2.0/data.html
==============================================================================
--- websites/staging/singa/trunk/content/v0.2.0/data.html (added)
+++ websites/staging/singa/trunk/content/v0.2.0/data.html Tue Apr 12 06:24:50 
2016
@@ -0,0 +1,426 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia at 2016-04-12 
+ | Rendered using Apache Maven Fluido Skin 1.4
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta name="Date-Revision-yyyymmdd" content="20160412" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>Apache SINGA &#x2013; Data Preparation</title>
+    <link rel="stylesheet" href="../css/apache-maven-fluido-1.4.min.css" />
+    <link rel="stylesheet" href="../css/site.css" />
+    <link rel="stylesheet" href="../css/print.css" media="print" />
+
+      
+    
+    
+  
+    <script type="text/javascript" 
src="../js/apache-maven-fluido-1.4.min.js"></script>
+
+                          
+        
+<script 
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
 type="text/javascript"></script>
+                      
+        
+<script type="text/x-mathjax-config">MathJax.Hub.Config({tex2jax: {inlineMath: 
[['$','$'], ['\\(','\\)']]}});</script>
+                      
+        
+<meta content="Apache SINGA" name="author"/>
+                      
+        
+<meta content="SINGA, Deep Learning, Distributed training" name="keywords"/>
+          
+                  </head>
+        <body class="topBarEnabled">
+          
+    
+    
+            
+    
+        
+    <a href="https://github.com/apache/incubator-singa";>
+      <img style="position: absolute; top: 0; right: 0; border: 0; z-index: 
10000;"
+        
src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png";
+        alt="Fork me on GitHub">
+    </a>
+  
+                
+                    
+                
+
+    <div id="topbar" class="navbar navbar-fixed-top navbar-inverse">
+      <div class="navbar-inner">
+                <div class="container-fluid">
+        <a data-target=".nav-collapse" data-toggle="collapse" class="btn 
btn-navbar">
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+        </a>
+                
+                                <ul class="nav">
+                          <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Apache 
SINGA <b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="../docs/overview.html"  
title="Introduction">Introduction</a>
+</li>
+                  
+                      <li>      <a href="../docs/quick-start.html"  
title="Quick Start">Quick Start</a>
+</li>
+                  
+                      <li>      <a href="../downloads.html"  
title="Downloads">Downloads</a>
+</li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" 
data-toggle="dropdown">Documentaion <b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li class="dropdown-submenu">
+                                      <a href="../docs/index.html"  
title="v0.3.0">v0.3.0</a>
+              <ul class="dropdown-menu">
+                                  <li>      <a href="../docs/index.html"  
title="English">English</a>
+</li>
+                                  <li>      <a href="../docs/zh/index.html"  
title="中文">中文</a>
+</li>
+                                  <li>      <a href="../docs/jp/index.html"  
title="日本語">日本語</a>
+</li>
+                                  <li>      <a href="../docs/kr/index.html"  
title="한국어">한국어</a>
+</li>
+                              </ul>
+            </li>
+                  
+                      <li>      <a href="../v0.2.0/index.html"  
title="v0.2.0">v0.2.0</a>
+</li>
+                  
+                      <li>      <a href="../v0.1.0/index.html"  
title="v0.1.0">v0.1.0</a>
+</li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Development 
<b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="../develop/schedule.html"  
title="Schedule">Schedule</a>
+</li>
+                  
+                      <li class="dropdown-submenu">
+                                      <a href="../develop/how-contribute.html" 
 title="How to Contribute">How to Contribute</a>
+              <ul class="dropdown-menu">
+                                  <li>      <a 
href="../develop/contribute-code.html"  title="Code">Code</a>
+</li>
+                                  <li>      <a 
href="../develop/contribute-docs.html"  title="Documentation">Documentation</a>
+</li>
+                              </ul>
+            </li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Community 
<b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="../community/source-repository.html"  
title="Source Repository">Source Repository</a>
+</li>
+                  
+                      <li>      <a href="../community/mail-lists.html"  
title="Mailing Lists">Mailing Lists</a>
+</li>
+                  
+                      <li>      <a href="../community/issue-tracking.html"  
title="Issue Tracking">Issue Tracking</a>
+</li>
+                  
+                      <li>      <a href="../community/team-list.html"  
title="SINGA Team">SINGA Team</a>
+</li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">External 
Links <b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="http://www.apache.org/";  
title="Apache Software Foundation">Apache Software Foundation</a>
+</li>
+                  
+                      <li>      <a 
href="http://www.comp.nus.edu.sg/~dbsystem/singa/";  title="NUS Site">NUS 
Site</a>
+</li>
+                          </ul>
+      </li>
+                  </ul>
+          
+          
+          
+                   
+                      </div>
+          
+        </div>
+      </div>
+    </div>
+    
+        <div class="container-fluid">
+          <div id="banner">
+        <div class="pull-left">
+                                                  <a href="../index.html" 
id="bannerLeft" title="Apache SINGA">
+                                                                               
                 <img src="../images/singa-logo.png"  alt="Apache SINGA"/>
+                </a>
+                      </div>
+        <div class="pull-right">              <div id="bannerRight">
+                                                                               
                 <img src="../images/singa-title.png"  alt="Apache SINGA"/>
+                </div>
+      </div>
+        <div class="clear"><hr/></div>
+      </div>
+
+      <div id="breadcrumbs">
+        <ul class="breadcrumb">
+                
+                    
+                              <li class="">
+                    <a href="../index.html" title="Apache SINGA">
+        Apache SINGA</a>
+                    <span class="divider">/</span>
+      </li>
+        <li class="active ">Data Preparation</li>
+        
+                
+                    
+      
+                            </ul>
+      </div>
+
+                  
+      <div class="row-fluid">
+        <div id="leftColumn" class="span2">
+          <div class="well sidebar-nav">
+                
+                    
+                <ul class="nav nav-list">
+                    <li class="nav-header">Apache SINGA</li>
+                              
+      <li>
+  
+                          <a href="../docs/overview.html" title="Introduction">
+          <span class="none"></span>
+        Introduction</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../docs/quick-start.html" title="Quick 
Start">
+          <span class="none"></span>
+        Quick Start</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../downloads.html" title="Downloads">
+          <span class="none"></span>
+        Downloads</a>
+            </li>
+                              <li class="nav-header">Documentaion</li>
+                                                                               
                                                       
+      <li>
+  
+                          <a href="../docs/index.html" title="v0.3.0">
+          <span class="icon-chevron-right"></span>
+        v0.3.0</a>
+                  </li>
+                
+      <li>
+  
+                          <a href="../v0.2.0/index.html" title="v0.2.0">
+          <span class="none"></span>
+        v0.2.0</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../v0.1.0/index.html" title="v0.1.0">
+          <span class="none"></span>
+        v0.1.0</a>
+            </li>
+                              <li class="nav-header">Development</li>
+                              
+      <li>
+  
+                          <a href="../develop/schedule.html" title="Schedule">
+          <span class="none"></span>
+        Schedule</a>
+            </li>
+                                                                               
     
+      <li>
+  
+                          <a href="../develop/how-contribute.html" title="How 
to Contribute">
+          <span class="icon-chevron-right"></span>
+        How to Contribute</a>
+                  </li>
+                              <li class="nav-header">Community</li>
+                              
+      <li>
+  
+                          <a href="../community/source-repository.html" 
title="Source Repository">
+          <span class="none"></span>
+        Source Repository</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../community/mail-lists.html" 
title="Mailing Lists">
+          <span class="none"></span>
+        Mailing Lists</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../community/issue-tracking.html" 
title="Issue Tracking">
+          <span class="none"></span>
+        Issue Tracking</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../community/team-list.html" title="SINGA 
Team">
+          <span class="none"></span>
+        SINGA Team</a>
+            </li>
+                              <li class="nav-header">External Links</li>
+                              
+      <li>
+  
+                          <a href="http://www.apache.org/"; 
class="externalLink" title="Apache Software Foundation">
+          <span class="none"></span>
+        Apache Software Foundation</a>
+            </li>
+                
+      <li>
+  
+                          <a 
href="http://www.comp.nus.edu.sg/~dbsystem/singa/"; class="externalLink" 
title="NUS Site">
+          <span class="none"></span>
+        NUS Site</a>
+            </li>
+            </ul>
+                
+                    
+                
+          <hr />
+
+           <div id="poweredBy">
+                            <div class="clear"></div>
+                            <div class="clear"></div>
+                            <div class="clear"></div>
+                            <div class="clear"></div>
+                                                                               
                                    <a href="http://incubator.apache.org"; 
title="apache-incubator" class="builtBy">
+        <img class="builtBy"  alt="Apache Incubator" 
src="http://incubator.apache.org/images/egg-logo.png";    />
+      </a>
+                      </div>
+          </div>
+        </div>
+        
+                        
+        <div id="bodyColumn"  class="span10" >
+                                  
+            <h1>Data Preparation</h1>
+<hr />
+<p>SINGA uses input layers to load data. Users can store their data in any 
format (e.g., CSV or binary) and at any places (e.g., disk file or HDFS) as 
long as there are corresponding input layers that can read the data records and 
parse them.</p>
+<p>To make it easy for users, SINGA provides a [StoreInputLayer] to read data 
in the format of (string:key, string:value) tuples from a couple of sources. 
These sources are abstracted using a <a href="">Store</a> class which is a 
simple version of the DB abstraction in Caffe. The base Store class provides 
the following operations for reading and writing tuples,</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">Open(string path, Mode mode); // 
open the store for kRead or kCreate or kAppend
+Close();
+
+Read(string* key, string* val); // read a tuple; return false if fail
+Write(string key, string val);  // write a tuple
+Flush();
+</pre></div></div>
+<p>Currently, two implementations are provided, namely</p>
+
+<ol style="list-style-type: decimal">
+  
+<li>
+<p>[KVFileStore] for storing tuples in <a href="">KVFile</a> (a binary file). 
The <i>create_data.cc</i> files in <i>examples/cifar10</i> and 
<i>examples/mnist</i> provide examples of storing records using 
KVFileStore.</p></li>
+  
+<li>
+<p>[TextFileStore] for storing tuples in plain text file (one line per 
tuple).</p></li>
+</ol>
+<p>The (key, value) tuple are parsed by subclasses of StoreInputLayer 
depending on the format of the tuple,</p>
+
+<ul>
+  
+<li>
+<p>[ProtoRecordInputLayer] parses the value field from one tuple into a 
[SingleLabelImageRecord], which is generated by Google Protobuf according to 
[common.proto]. It can be used to store features for images (e.g., using the 
pixel field) or other objects (using the data field). The key field is not 
used.</p></li>
+  
+<li>
+<p>[CSVRecordInputLayer] parses one tuple as a CSV line (separated by 
comma).</p></li>
+</ul>
+<div class="section">
+<h2><a name="Using_built-in_record_format"></a>Using built-in record 
format</h2>
+<p>SingleLabelImageRecord is a built-in record in SINGA for storing image 
features. It is used in the cifar10 and mnist examples.</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">message SingleLabelImageRecord {
+  repeated int32 shape = 1;                // it obtains 3 (rgb channels), 32 
(row), 32 (col)
+  optional int32 label = 2;                // label
+  optional bytes pixel = 3;                // pixels
+  repeated float data = 4 [packed = true]; // it is used for normalization
+</pre></div></div>
+<p>}</p>
+<p>The data preparation instructions for the <a class="externalLink" 
href="http://www.cs.toronto.edu/~kriz/cifar.html";>CIFAR-10 image dataset</a> 
will be elaborated here. This dataset consists of 60,000 32x32 color images in 
10 classes, with 6,000 images per class. There are 50,000 training images and 
10,000 test images. Each image has a single label. This dataset is stored in 
binary files with specific format. SINGA comes with the <a class="externalLink" 
href="https://github.com/apache/incubator-singa/blob/master/examples/cifar10/create_data.cc";>create_data.cc</a>
 to convert images in the binary files into <tt>SingleLabelImageRecord</tt>s 
and insert them into training and test stores.</p>
+
+<ol style="list-style-type: decimal">
+  
+<li>
+<p>Download raw data. The following command will download the dataset into 
<i>cifar-10-batches-bin</i> folder.</p>
+  
+<div class="source">
+<div class="source"><pre class="prettyprint"># in SINGA_ROOT/examples/cifar10
+$ cp Makefile.example Makefile   // an example makefile is provided
+$ make download
+</pre></div></div></li>
+  
+<li>
+<p>Fill one record for each image, and insert it to store.</p>
+  
+<div class="source">
+<div class="source"><pre class="prettyprint">KVFileStore store;
+store.Open(output_file_path, singa::io::kCreate);
+
+singa::SingleLabelImageRecord image;
+for (int image_id = 0; image_id &lt; 50000; image_id ++) {
+  // fill the record with image feature and label from downloaded binay files
+  string str;
+  image.SerializeToString(&amp;str);
+  store.Write(to_string(image_id), str);
+}
+store.Flush();
+store.Close();
+</pre></div></div>
+<p>The data store for testing data is created similarly. In addition, it 
computes average values (not shown here) of image pixels and insert the mean 
values into a SingleLabelImageRecord, which is then written into a another 
store.</p></li>
+  
+<li>
+<p>Compile and run the program. SINGA provides an example Makefile that 
contains instructions for compiling the source code and linking it with 
<i>libsinga.so</i>. Users just execute the following command.</p>
+  
+<div class="source">
+<div class="source"><pre class="prettyprint">$ make create
+</pre></div></div></li>
+</ol></div>
+<div class="section">
+<h2><a name="using_user-defined_record_format"></a>using user-defined record 
format</h2>
+<p>If users cannot use the SingleLabelImageRecord or CSV record for their 
data. They can define their own record format e.g., using Google Protobuf. A 
record can be written into a data store as long as it can be converted into 
byte string. Correspondingly, subclasses of StoreInputLayer are required to 
parse user-defined records.</p></div>
+                  </div>
+            </div>
+          </div>
+
+    <hr/>
+
+    <footer>
+            <div class="container-fluid">
+                      <div class="row-fluid">
+                                                                          
+<p>Copyright © 2015 The Apache Software Foundation. All rights reserved. 
Apache Singa, Apache, the Apache feather logo, and the Apache Singa project 
logos are trademarks of The Apache Software Foundation. All other marks 
mentioned may be trademarks or registered trademarks of their respective 
owners.</p>
+                          </div>
+
+        
+                </div>
+    </footer>
+        </body>
+</html>

Added: websites/staging/singa/trunk/content/v0.2.0/debug.html
==============================================================================
--- websites/staging/singa/trunk/content/v0.2.0/debug.html (added)
+++ websites/staging/singa/trunk/content/v0.2.0/debug.html Tue Apr 12 06:24:50 
2016
@@ -0,0 +1,366 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia at 2016-04-12 
+ | Rendered using Apache Maven Fluido Skin 1.4
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta name="Date-Revision-yyyymmdd" content="20160412" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>Apache SINGA &#x2013; How to Debug</title>
+    <link rel="stylesheet" href="../css/apache-maven-fluido-1.4.min.css" />
+    <link rel="stylesheet" href="../css/site.css" />
+    <link rel="stylesheet" href="../css/print.css" media="print" />
+
+      
+    
+    
+  
+    <script type="text/javascript" 
src="../js/apache-maven-fluido-1.4.min.js"></script>
+
+                          
+        
+<script 
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
 type="text/javascript"></script>
+                      
+        
+<script type="text/x-mathjax-config">MathJax.Hub.Config({tex2jax: {inlineMath: 
[['$','$'], ['\\(','\\)']]}});</script>
+                      
+        
+<meta content="Apache SINGA" name="author"/>
+                      
+        
+<meta content="SINGA, Deep Learning, Distributed training" name="keywords"/>
+          
+                  </head>
+        <body class="topBarEnabled">
+          
+    
+    
+            
+    
+        
+    <a href="https://github.com/apache/incubator-singa";>
+      <img style="position: absolute; top: 0; right: 0; border: 0; z-index: 
10000;"
+        
src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png";
+        alt="Fork me on GitHub">
+    </a>
+  
+                
+                    
+                
+
+    <div id="topbar" class="navbar navbar-fixed-top navbar-inverse">
+      <div class="navbar-inner">
+                <div class="container-fluid">
+        <a data-target=".nav-collapse" data-toggle="collapse" class="btn 
btn-navbar">
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+        </a>
+                
+                                <ul class="nav">
+                          <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Apache 
SINGA <b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="../docs/overview.html"  
title="Introduction">Introduction</a>
+</li>
+                  
+                      <li>      <a href="../docs/quick-start.html"  
title="Quick Start">Quick Start</a>
+</li>
+                  
+                      <li>      <a href="../downloads.html"  
title="Downloads">Downloads</a>
+</li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" 
data-toggle="dropdown">Documentaion <b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li class="dropdown-submenu">
+                                      <a href="../docs/index.html"  
title="v0.3.0">v0.3.0</a>
+              <ul class="dropdown-menu">
+                                  <li>      <a href="../docs/index.html"  
title="English">English</a>
+</li>
+                                  <li>      <a href="../docs/zh/index.html"  
title="中文">中文</a>
+</li>
+                                  <li>      <a href="../docs/jp/index.html"  
title="日本語">日本語</a>
+</li>
+                                  <li>      <a href="../docs/kr/index.html"  
title="한국어">한국어</a>
+</li>
+                              </ul>
+            </li>
+                  
+                      <li>      <a href="../v0.2.0/index.html"  
title="v0.2.0">v0.2.0</a>
+</li>
+                  
+                      <li>      <a href="../v0.1.0/index.html"  
title="v0.1.0">v0.1.0</a>
+</li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Development 
<b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="../develop/schedule.html"  
title="Schedule">Schedule</a>
+</li>
+                  
+                      <li class="dropdown-submenu">
+                                      <a href="../develop/how-contribute.html" 
 title="How to Contribute">How to Contribute</a>
+              <ul class="dropdown-menu">
+                                  <li>      <a 
href="../develop/contribute-code.html"  title="Code">Code</a>
+</li>
+                                  <li>      <a 
href="../develop/contribute-docs.html"  title="Documentation">Documentation</a>
+</li>
+                              </ul>
+            </li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Community 
<b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="../community/source-repository.html"  
title="Source Repository">Source Repository</a>
+</li>
+                  
+                      <li>      <a href="../community/mail-lists.html"  
title="Mailing Lists">Mailing Lists</a>
+</li>
+                  
+                      <li>      <a href="../community/issue-tracking.html"  
title="Issue Tracking">Issue Tracking</a>
+</li>
+                  
+                      <li>      <a href="../community/team-list.html"  
title="SINGA Team">SINGA Team</a>
+</li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">External 
Links <b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="http://www.apache.org/";  
title="Apache Software Foundation">Apache Software Foundation</a>
+</li>
+                  
+                      <li>      <a 
href="http://www.comp.nus.edu.sg/~dbsystem/singa/";  title="NUS Site">NUS 
Site</a>
+</li>
+                          </ul>
+      </li>
+                  </ul>
+          
+          
+          
+                   
+                      </div>
+          
+        </div>
+      </div>
+    </div>
+    
+        <div class="container-fluid">
+          <div id="banner">
+        <div class="pull-left">
+                                                  <a href="../index.html" 
id="bannerLeft" title="Apache SINGA">
+                                                                               
                 <img src="../images/singa-logo.png"  alt="Apache SINGA"/>
+                </a>
+                      </div>
+        <div class="pull-right">              <div id="bannerRight">
+                                                                               
                 <img src="../images/singa-title.png"  alt="Apache SINGA"/>
+                </div>
+      </div>
+        <div class="clear"><hr/></div>
+      </div>
+
+      <div id="breadcrumbs">
+        <ul class="breadcrumb">
+                
+                    
+                              <li class="">
+                    <a href="../index.html" title="Apache SINGA">
+        Apache SINGA</a>
+                    <span class="divider">/</span>
+      </li>
+        <li class="active ">How to Debug</li>
+        
+                
+                    
+      
+                            </ul>
+      </div>
+
+                  
+      <div class="row-fluid">
+        <div id="leftColumn" class="span2">
+          <div class="well sidebar-nav">
+                
+                    
+                <ul class="nav nav-list">
+                    <li class="nav-header">Apache SINGA</li>
+                              
+      <li>
+  
+                          <a href="../docs/overview.html" title="Introduction">
+          <span class="none"></span>
+        Introduction</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../docs/quick-start.html" title="Quick 
Start">
+          <span class="none"></span>
+        Quick Start</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../downloads.html" title="Downloads">
+          <span class="none"></span>
+        Downloads</a>
+            </li>
+                              <li class="nav-header">Documentaion</li>
+                                                                               
                                                       
+      <li>
+  
+                          <a href="../docs/index.html" title="v0.3.0">
+          <span class="icon-chevron-right"></span>
+        v0.3.0</a>
+                  </li>
+                
+      <li>
+  
+                          <a href="../v0.2.0/index.html" title="v0.2.0">
+          <span class="none"></span>
+        v0.2.0</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../v0.1.0/index.html" title="v0.1.0">
+          <span class="none"></span>
+        v0.1.0</a>
+            </li>
+                              <li class="nav-header">Development</li>
+                              
+      <li>
+  
+                          <a href="../develop/schedule.html" title="Schedule">
+          <span class="none"></span>
+        Schedule</a>
+            </li>
+                                                                               
     
+      <li>
+  
+                          <a href="../develop/how-contribute.html" title="How 
to Contribute">
+          <span class="icon-chevron-right"></span>
+        How to Contribute</a>
+                  </li>
+                              <li class="nav-header">Community</li>
+                              
+      <li>
+  
+                          <a href="../community/source-repository.html" 
title="Source Repository">
+          <span class="none"></span>
+        Source Repository</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../community/mail-lists.html" 
title="Mailing Lists">
+          <span class="none"></span>
+        Mailing Lists</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../community/issue-tracking.html" 
title="Issue Tracking">
+          <span class="none"></span>
+        Issue Tracking</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../community/team-list.html" title="SINGA 
Team">
+          <span class="none"></span>
+        SINGA Team</a>
+            </li>
+                              <li class="nav-header">External Links</li>
+                              
+      <li>
+  
+                          <a href="http://www.apache.org/"; 
class="externalLink" title="Apache Software Foundation">
+          <span class="none"></span>
+        Apache Software Foundation</a>
+            </li>
+                
+      <li>
+  
+                          <a 
href="http://www.comp.nus.edu.sg/~dbsystem/singa/"; class="externalLink" 
title="NUS Site">
+          <span class="none"></span>
+        NUS Site</a>
+            </li>
+            </ul>
+                
+                    
+                
+          <hr />
+
+           <div id="poweredBy">
+                            <div class="clear"></div>
+                            <div class="clear"></div>
+                            <div class="clear"></div>
+                            <div class="clear"></div>
+                                                                               
                                    <a href="http://incubator.apache.org"; 
title="apache-incubator" class="builtBy">
+        <img class="builtBy"  alt="Apache Incubator" 
src="http://incubator.apache.org/images/egg-logo.png";    />
+      </a>
+                      </div>
+          </div>
+        </div>
+        
+                        
+        <div id="bodyColumn"  class="span10" >
+                                  
+            <h1>How to Debug</h1>
+<hr />
+<p>Since SINGA is developed on Linux using C++, GDB is the preferred debugging 
tool. To use GDB, the code must be compiled with <tt>-g</tt> flag. This is 
enabled by</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">./configure --enable-debug
+make
+</pre></div></div>
+<div class="section">
+<h2><a name="Debugging_for_single_process_job"></a>Debugging for single 
process job</h2>
+<p>If your job launches only one process, then use the default 
<i>conf/singa.conf</i> for debugging. The process will be launched locally.</p>
+<p>To debug, first start zookeeper if it is not started yet, and launch GDB</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint"># do this for only once
+./bin/zk-service.sh start
+# do this every time
+gdb .libs/singa
+</pre></div></div>
+<p>Then set the command line arguments</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">set args -conf JOBCONF
+</pre></div></div>
+<p>Now you can set your breakpoints and start running.</p></div>
+<div class="section">
+<h2><a name="Debugging_for_jobs_with_multiple_processes"></a>Debugging for 
jobs with multiple processes</h2></div>
+                  </div>
+            </div>
+          </div>
+
+    <hr/>
+
+    <footer>
+            <div class="container-fluid">
+                      <div class="row-fluid">
+                                                                          
+<p>Copyright © 2015 The Apache Software Foundation. All rights reserved. 
Apache Singa, Apache, the Apache feather logo, and the Apache Singa project 
logos are trademarks of The Apache Software Foundation. All other marks 
mentioned may be trademarks or registered trademarks of their respective 
owners.</p>
+                          </div>
+
+        
+                </div>
+    </footer>
+        </body>
+</html>

Added: websites/staging/singa/trunk/content/v0.2.0/distributed-training.html
==============================================================================
--- websites/staging/singa/trunk/content/v0.2.0/distributed-training.html 
(added)
+++ websites/staging/singa/trunk/content/v0.2.0/distributed-training.html Tue 
Apr 12 06:24:50 2016
@@ -0,0 +1,372 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia at 2016-04-12 
+ | Rendered using Apache Maven Fluido Skin 1.4
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta name="Date-Revision-yyyymmdd" content="20160412" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>Apache SINGA &#x2013; Distributed Training</title>
+    <link rel="stylesheet" href="../css/apache-maven-fluido-1.4.min.css" />
+    <link rel="stylesheet" href="../css/site.css" />
+    <link rel="stylesheet" href="../css/print.css" media="print" />
+
+      
+    
+    
+  
+    <script type="text/javascript" 
src="../js/apache-maven-fluido-1.4.min.js"></script>
+
+                          
+        
+<script 
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
 type="text/javascript"></script>
+                      
+        
+<script type="text/x-mathjax-config">MathJax.Hub.Config({tex2jax: {inlineMath: 
[['$','$'], ['\\(','\\)']]}});</script>
+                      
+        
+<meta content="Apache SINGA" name="author"/>
+                      
+        
+<meta content="SINGA, Deep Learning, Distributed training" name="keywords"/>
+          
+                  </head>
+        <body class="topBarEnabled">
+          
+    
+    
+            
+    
+        
+    <a href="https://github.com/apache/incubator-singa";>
+      <img style="position: absolute; top: 0; right: 0; border: 0; z-index: 
10000;"
+        
src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png";
+        alt="Fork me on GitHub">
+    </a>
+  
+                
+                    
+                
+
+    <div id="topbar" class="navbar navbar-fixed-top navbar-inverse">
+      <div class="navbar-inner">
+                <div class="container-fluid">
+        <a data-target=".nav-collapse" data-toggle="collapse" class="btn 
btn-navbar">
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+        </a>
+                
+                                <ul class="nav">
+                          <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Apache 
SINGA <b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="../docs/overview.html"  
title="Introduction">Introduction</a>
+</li>
+                  
+                      <li>      <a href="../docs/quick-start.html"  
title="Quick Start">Quick Start</a>
+</li>
+                  
+                      <li>      <a href="../downloads.html"  
title="Downloads">Downloads</a>
+</li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" 
data-toggle="dropdown">Documentaion <b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li class="dropdown-submenu">
+                                      <a href="../docs/index.html"  
title="v0.3.0">v0.3.0</a>
+              <ul class="dropdown-menu">
+                                  <li>      <a href="../docs/index.html"  
title="English">English</a>
+</li>
+                                  <li>      <a href="../docs/zh/index.html"  
title="中文">中文</a>
+</li>
+                                  <li>      <a href="../docs/jp/index.html"  
title="日本語">日本語</a>
+</li>
+                                  <li>      <a href="../docs/kr/index.html"  
title="한국어">한국어</a>
+</li>
+                              </ul>
+            </li>
+                  
+                      <li>      <a href="../v0.2.0/index.html"  
title="v0.2.0">v0.2.0</a>
+</li>
+                  
+                      <li>      <a href="../v0.1.0/index.html"  
title="v0.1.0">v0.1.0</a>
+</li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Development 
<b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="../develop/schedule.html"  
title="Schedule">Schedule</a>
+</li>
+                  
+                      <li class="dropdown-submenu">
+                                      <a href="../develop/how-contribute.html" 
 title="How to Contribute">How to Contribute</a>
+              <ul class="dropdown-menu">
+                                  <li>      <a 
href="../develop/contribute-code.html"  title="Code">Code</a>
+</li>
+                                  <li>      <a 
href="../develop/contribute-docs.html"  title="Documentation">Documentation</a>
+</li>
+                              </ul>
+            </li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Community 
<b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="../community/source-repository.html"  
title="Source Repository">Source Repository</a>
+</li>
+                  
+                      <li>      <a href="../community/mail-lists.html"  
title="Mailing Lists">Mailing Lists</a>
+</li>
+                  
+                      <li>      <a href="../community/issue-tracking.html"  
title="Issue Tracking">Issue Tracking</a>
+</li>
+                  
+                      <li>      <a href="../community/team-list.html"  
title="SINGA Team">SINGA Team</a>
+</li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">External 
Links <b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="http://www.apache.org/";  
title="Apache Software Foundation">Apache Software Foundation</a>
+</li>
+                  
+                      <li>      <a 
href="http://www.comp.nus.edu.sg/~dbsystem/singa/";  title="NUS Site">NUS 
Site</a>
+</li>
+                          </ul>
+      </li>
+                  </ul>
+          
+          
+          
+                   
+                      </div>
+          
+        </div>
+      </div>
+    </div>
+    
+        <div class="container-fluid">
+          <div id="banner">
+        <div class="pull-left">
+                                                  <a href="../index.html" 
id="bannerLeft" title="Apache SINGA">
+                                                                               
                 <img src="../images/singa-logo.png"  alt="Apache SINGA"/>
+                </a>
+                      </div>
+        <div class="pull-right">              <div id="bannerRight">
+                                                                               
                 <img src="../images/singa-title.png"  alt="Apache SINGA"/>
+                </div>
+      </div>
+        <div class="clear"><hr/></div>
+      </div>
+
+      <div id="breadcrumbs">
+        <ul class="breadcrumb">
+                
+                    
+                              <li class="">
+                    <a href="../index.html" title="Apache SINGA">
+        Apache SINGA</a>
+                    <span class="divider">/</span>
+      </li>
+        <li class="active ">Distributed Training</li>
+        
+                
+                    
+      
+                            </ul>
+      </div>
+
+                  
+      <div class="row-fluid">
+        <div id="leftColumn" class="span2">
+          <div class="well sidebar-nav">
+                
+                    
+                <ul class="nav nav-list">
+                    <li class="nav-header">Apache SINGA</li>
+                              
+      <li>
+  
+                          <a href="../docs/overview.html" title="Introduction">
+          <span class="none"></span>
+        Introduction</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../docs/quick-start.html" title="Quick 
Start">
+          <span class="none"></span>
+        Quick Start</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../downloads.html" title="Downloads">
+          <span class="none"></span>
+        Downloads</a>
+            </li>
+                              <li class="nav-header">Documentaion</li>
+                                                                               
                                                       
+      <li>
+  
+                          <a href="../docs/index.html" title="v0.3.0">
+          <span class="icon-chevron-right"></span>
+        v0.3.0</a>
+                  </li>
+                
+      <li>
+  
+                          <a href="../v0.2.0/index.html" title="v0.2.0">
+          <span class="none"></span>
+        v0.2.0</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../v0.1.0/index.html" title="v0.1.0">
+          <span class="none"></span>
+        v0.1.0</a>
+            </li>
+                              <li class="nav-header">Development</li>
+                              
+      <li>
+  
+                          <a href="../develop/schedule.html" title="Schedule">
+          <span class="none"></span>
+        Schedule</a>
+            </li>
+                                                                               
     
+      <li>
+  
+                          <a href="../develop/how-contribute.html" title="How 
to Contribute">
+          <span class="icon-chevron-right"></span>
+        How to Contribute</a>
+                  </li>
+                              <li class="nav-header">Community</li>
+                              
+      <li>
+  
+                          <a href="../community/source-repository.html" 
title="Source Repository">
+          <span class="none"></span>
+        Source Repository</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../community/mail-lists.html" 
title="Mailing Lists">
+          <span class="none"></span>
+        Mailing Lists</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../community/issue-tracking.html" 
title="Issue Tracking">
+          <span class="none"></span>
+        Issue Tracking</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../community/team-list.html" title="SINGA 
Team">
+          <span class="none"></span>
+        SINGA Team</a>
+            </li>
+                              <li class="nav-header">External Links</li>
+                              
+      <li>
+  
+                          <a href="http://www.apache.org/"; 
class="externalLink" title="Apache Software Foundation">
+          <span class="none"></span>
+        Apache Software Foundation</a>
+            </li>
+                
+      <li>
+  
+                          <a 
href="http://www.comp.nus.edu.sg/~dbsystem/singa/"; class="externalLink" 
title="NUS Site">
+          <span class="none"></span>
+        NUS Site</a>
+            </li>
+            </ul>
+                
+                    
+                
+          <hr />
+
+           <div id="poweredBy">
+                            <div class="clear"></div>
+                            <div class="clear"></div>
+                            <div class="clear"></div>
+                            <div class="clear"></div>
+                                                                               
                                    <a href="http://incubator.apache.org"; 
title="apache-incubator" class="builtBy">
+        <img class="builtBy"  alt="Apache Incubator" 
src="http://incubator.apache.org/images/egg-logo.png";    />
+      </a>
+                      </div>
+          </div>
+        </div>
+        
+                        
+        <div id="bodyColumn"  class="span10" >
+                                  
+            <h1>Distributed Training</h1>
+<hr />
+<p>SINGA is designed for distributed training of large deep learning models 
with huge amount of training data. We also provide high-level descriptions of 
design behind SINGA&#x2019;s distributed architecture. </p>
+
+<ul>
+  
+<li>
+<p><a href="architecture.html">System Architecture</a></p></li>
+  
+<li>
+<p><a href="frameworks.html">Training Frameworks</a></p></li>
+  
+<li>
+<p><a href="communication.html">System Communication</a></p></li>
+</ul>
+<p>SINGA supports different options for training a model in parallel, 
includeing data parallelism, model parallelism and hybrid parallelism.</p>
+
+<ul>
+  
+<li><a href="hybrid.html">Hybrid Parallelism</a></li>
+</ul>
+<p>SINGA is intergrated with Mesos, so that distributed training can be 
started as a Mesos framework. Currently, the Mesos cluster can be set up from 
SINGA containers, i.e. we provide Docker images that bundles Mesos and SINGA 
together. Refer to the guide below for instructions as how to start and use the 
cluster.</p>
+
+<ul>
+  
+<li><a href="mesos.html">Distributed training on Mesos</a></li>
+</ul>
+<p>SINGA can run on top of distributed storage system to achieve scalability. 
The current version of SINGA supports HDFS.</p>
+
+<ul>
+  
+<li><a href="hdfs.html">Running SINGA on HDFS</a></li>
+</ul>
+                  </div>
+            </div>
+          </div>
+
+    <hr/>
+
+    <footer>
+            <div class="container-fluid">
+                      <div class="row-fluid">
+                                                                          
+<p>Copyright © 2015 The Apache Software Foundation. All rights reserved. 
Apache Singa, Apache, the Apache feather logo, and the Apache Singa project 
logos are trademarks of The Apache Software Foundation. All other marks 
mentioned may be trademarks or registered trademarks of their respective 
owners.</p>
+                          </div>
+
+        
+                </div>
+    </footer>
+        </body>
+</html>


Reply via email to