In the [fluid](https://github.com/PaddlePaddle/Paddle/blob/develop/doc/design/fluid.md), we encourage user use deep learning programming paradigms to describe training process. When the user-written Python program is executed, it will create a protobuf message
In [fluid](https://github.com/PaddlePaddle/Paddle/blob/develop/doc/design/fluid.md), we encourage the user to use deep learning programming paradigms to describe the training process. When the user-written Python program is executed, it will first create a protobuf message
[`ProgramDesc`](https://github.com/PaddlePaddle/Paddle/blob/a91efdde6910ce92a78e3aa7157412c4c88d9ee8/paddle/framework/framework.proto#L145) that describes the process and is conceptually like an [abstract syntax tree](https://en.wikipedia.org/wiki/Abstract_syntax_tree).
The executor runs the `ProgramDesc` like an interpreter. `ProgramDesc` contains intrinsics/operators and variables which will be used, executor explicitly execute the stored precompiled code.
The executor runs the `ProgramDesc` like an interpreter. `ProgramDesc` contains the intrinsics (operators in this case) and variables which will be used, executor explicitly executes the stored precompiled code.
## Overview
An executor takes a `ProgramDesc`, a `block_id` and a `Scope`. The `ProgramDesc` is a list of blocks and each block contains the protobuf definition of all the parameters and operators. The `block_id` specifies the entrance block. And the `Scope` is the container of all the variable instance, which is persistent throughout different runs.
An executor takes a `ProgramDesc`, a `block_id` and a `Scope`. The `ProgramDesc` is a list of blocks and each block contains the protobuf definition of all the parameters and operators in the block. The `block_id` specifies the entrance block. And the `Scope` is the container of all the variable instances, which is persistent throughout different runs.
## Executor
`Executor` explicitly executes all the intrinsics/operators in the `block_id`th block of a `ProgramDesc`. Essentially, it instantiates Variables and Operators, then runs all the operators in sequence. It is very similar to push stack frame when entering the block, it will destroy the temporary variables when mini-batch is finished, but it does not have stack frame pop process.
The `Executor` explicitly executes all the intrinsics (operators here) in the `block_id`th block of a `ProgramDesc`. Essentially, it instantiates Variables and Operators, then runs all the operators in sequence one-by-one.
It is very similar to how a push stack frame works when entering a block, following which it cleans up all the temporary variables when a mini-batch is finished. It does not however, have the stack frame pop process.
### Interface
### The interface
```c++
Executor(places);
```
A executor does not own any computing resources, user can only construct an executor with specified places.
A executor does not own any computing resources, a user can only construct an executor using the specified places.
A executor only provides an unified way to execute `ProgramDesc`. `ProgramDesc` is the target will be executed, scope specifies the variable container. `block_id` indicates the entrance block, `create_local_scope` means if it will destroy the temporary variables after execution finished.
An `Executor` only provides a unified way to execute `ProgramDesc`. `ProgramDesc` is the target that will be executed, the `Scope` specifies the variable container, the `block_id` indicates the entrance block and `create_local_scope` is a boolean that states whether it will destroy the temporary variables after the execution is finished.
<spanid="executor-design-doc"></span><h1>Executor Design Doc<aclass="headerlink"href="#executor-design-doc"title="Permalink to this headline">¶</a></h1>
<divclass="section"id="motivation">
<spanid="motivation"></span><h2>Motivation<aclass="headerlink"href="#motivation"title="Permalink to this headline">¶</a></h2>
<p>In the <aclass="reference external"href="https://github.com/PaddlePaddle/Paddle/blob/develop/doc/design/fluid.md">fluid</a>, we encourage user use deep learning programming paradigms to describe training process. When the user-written Python program is executed, it will create a protobuf message
<p>In <aclass="reference external"href="https://github.com/PaddlePaddle/Paddle/blob/develop/doc/design/fluid.md">fluid</a>, we encourage the user to use deep learning programming paradigms to describe the training process. When the user-written Python program is executed, it will first create a protobuf message
<aclass="reference external"href="https://github.com/PaddlePaddle/Paddle/blob/a91efdde6910ce92a78e3aa7157412c4c88d9ee8/paddle/framework/framework.proto#L145"><codeclass="docutils literal"><spanclass="pre">ProgramDesc</span></code></a> that describes the process and is conceptually like an <aclass="reference external"href="https://en.wikipedia.org/wiki/Abstract_syntax_tree">abstract syntax tree</a>.</p>
<p>The executor runs the <codeclass="docutils literal"><spanclass="pre">ProgramDesc</span></code> like an interpreter. <codeclass="docutils literal"><spanclass="pre">ProgramDesc</span></code> contains intrinsics/operators and variables which will be used, executor explicitly execute the stored precompiled code.</p>
<p>The executor runs the <codeclass="docutils literal"><spanclass="pre">ProgramDesc</span></code> like an interpreter. <codeclass="docutils literal"><spanclass="pre">ProgramDesc</span></code> contains the intrinsics (operators in this case) and variables which will be used, executor explicitly executes the stored precompiled code.</p>
</div>
<divclass="section"id="overview">
<spanid="overview"></span><h2>Overview<aclass="headerlink"href="#overview"title="Permalink to this headline">¶</a></h2>
<p>An executor takes a <codeclass="docutils literal"><spanclass="pre">ProgramDesc</span></code>, a <codeclass="docutils literal"><spanclass="pre">block_id</span></code> and a <codeclass="docutils literal"><spanclass="pre">Scope</span></code>. The <codeclass="docutils literal"><spanclass="pre">ProgramDesc</span></code> is a list of blocks and each block contains the protobuf definition of all the parameters and operators. The <codeclass="docutils literal"><spanclass="pre">block_id</span></code> specifies the entrance block. And the <codeclass="docutils literal"><spanclass="pre">Scope</span></code> is the container of all the variable instance, which is persistent throughout different runs.</p>
<p>An executor takes a <codeclass="docutils literal"><spanclass="pre">ProgramDesc</span></code>, a <codeclass="docutils literal"><spanclass="pre">block_id</span></code> and a <codeclass="docutils literal"><spanclass="pre">Scope</span></code>. The <codeclass="docutils literal"><spanclass="pre">ProgramDesc</span></code> is a list of blocks and each block contains the protobuf definition of all the parameters and operators in the block. The <codeclass="docutils literal"><spanclass="pre">block_id</span></code> specifies the entrance block. And the <codeclass="docutils literal"><spanclass="pre">Scope</span></code> is the container of all the variable instances, which is persistent throughout different runs.</p>
</div>
<divclass="section"id="executor">
<spanid="executor"></span><h2>Executor<aclass="headerlink"href="#executor"title="Permalink to this headline">¶</a></h2>
<p><codeclass="docutils literal"><spanclass="pre">Executor</span></code> explicitly executes all the intrinsics/operators in the <codeclass="docutils literal"><spanclass="pre">block_id</span></code>th block of a <codeclass="docutils literal"><spanclass="pre">ProgramDesc</span></code>. Essentially, it instantiates Variables and Operators, then runs all the operators in sequence. It is very similar to push stack frame when entering the block, it will destroy the temporary variables when mini-batch is finished, but it does not have stack frame pop process.</p>
<divclass="section"id="interface">
<spanid="interface"></span><h3>Interface<aclass="headerlink"href="#interface"title="Permalink to this headline">¶</a></h3>
<p>The <codeclass="docutils literal"><spanclass="pre">Executor</span></code> explicitly executes all the intrinsics (operators here) in the <codeclass="docutils literal"><spanclass="pre">block_id</span></code>th block of a <codeclass="docutils literal"><spanclass="pre">ProgramDesc</span></code>. Essentially, it instantiates Variables and Operators, then runs all the operators in sequence one-by-one.
It is very similar to how a push stack frame works when entering a block, following which it cleans up all the temporary variables when a mini-batch is finished. It does not however, have the stack frame pop process.</p>
<divclass="section"id="the-interface">
<spanid="the-interface"></span><h3>The interface<aclass="headerlink"href="#the-interface"title="Permalink to this headline">¶</a></h3>
<p>A executor does not own any computing resources, user can only construct an executor with specified places.</p>
<p>A executor does not own any computing resources, a user can only construct an executor using the specified places.</p>
</div>
<divclass="section"id="running-an-executor">
<spanid="running-an-executor"></span><h3>Running an Executor<aclass="headerlink"href="#running-an-executor"title="Permalink to this headline">¶</a></h3>
<p>A executor only provides an unified way to execute <codeclass="docutils literal"><spanclass="pre">ProgramDesc</span></code>. <codeclass="docutils literal"><spanclass="pre">ProgramDesc</span></code> is the target will be executed, scope specifies the variable container. <codeclass="docutils literal"><spanclass="pre">block_id</span></code> indicates the entrance block, <codeclass="docutils literal"><spanclass="pre">create_local_scope</span></code> means if it will destroy the temporary variables after execution finished.</p>
<p>An <codeclass="docutils literal"><spanclass="pre">Executor</span></code> only provides a unified way to execute <codeclass="docutils literal"><spanclass="pre">ProgramDesc</span></code>. <codeclass="docutils literal"><spanclass="pre">ProgramDesc</span></code> is the target that will be executed, the <codeclass="docutils literal"><spanclass="pre">Scope</span></code> specifies the variable container, the <codeclass="docutils literal"><spanclass="pre">block_id</span></code> indicates the entrance block and <codeclass="docutils literal"><spanclass="pre">create_local_scope</span></code> is a boolean that states whether it will destroy the temporary variables after the execution is finished.</p>
In the [fluid](https://github.com/PaddlePaddle/Paddle/blob/develop/doc/design/fluid.md), we encourage user use deep learning programming paradigms to describe training process. When the user-written Python program is executed, it will create a protobuf message
In [fluid](https://github.com/PaddlePaddle/Paddle/blob/develop/doc/design/fluid.md), we encourage the user to use deep learning programming paradigms to describe the training process. When the user-written Python program is executed, it will first create a protobuf message
[`ProgramDesc`](https://github.com/PaddlePaddle/Paddle/blob/a91efdde6910ce92a78e3aa7157412c4c88d9ee8/paddle/framework/framework.proto#L145) that describes the process and is conceptually like an [abstract syntax tree](https://en.wikipedia.org/wiki/Abstract_syntax_tree).
The executor runs the `ProgramDesc` like an interpreter. `ProgramDesc` contains intrinsics/operators and variables which will be used, executor explicitly execute the stored precompiled code.
The executor runs the `ProgramDesc` like an interpreter. `ProgramDesc` contains the intrinsics (operators in this case) and variables which will be used, executor explicitly executes the stored precompiled code.
## Overview
An executor takes a `ProgramDesc`, a `block_id` and a `Scope`. The `ProgramDesc` is a list of blocks and each block contains the protobuf definition of all the parameters and operators. The `block_id` specifies the entrance block. And the `Scope` is the container of all the variable instance, which is persistent throughout different runs.
An executor takes a `ProgramDesc`, a `block_id` and a `Scope`. The `ProgramDesc` is a list of blocks and each block contains the protobuf definition of all the parameters and operators in the block. The `block_id` specifies the entrance block. And the `Scope` is the container of all the variable instances, which is persistent throughout different runs.
## Executor
`Executor` explicitly executes all the intrinsics/operators in the `block_id`th block of a `ProgramDesc`. Essentially, it instantiates Variables and Operators, then runs all the operators in sequence. It is very similar to push stack frame when entering the block, it will destroy the temporary variables when mini-batch is finished, but it does not have stack frame pop process.
The `Executor` explicitly executes all the intrinsics (operators here) in the `block_id`th block of a `ProgramDesc`. Essentially, it instantiates Variables and Operators, then runs all the operators in sequence one-by-one.
It is very similar to how a push stack frame works when entering a block, following which it cleans up all the temporary variables when a mini-batch is finished. It does not however, have the stack frame pop process.
### Interface
### The interface
```c++
Executor(places);
```
A executor does not own any computing resources, user can only construct an executor with specified places.
A executor does not own any computing resources, a user can only construct an executor using the specified places.
A executor only provides an unified way to execute `ProgramDesc`. `ProgramDesc` is the target will be executed, scope specifies the variable container. `block_id` indicates the entrance block, `create_local_scope` means if it will destroy the temporary variables after execution finished.
An `Executor` only provides a unified way to execute `ProgramDesc`. `ProgramDesc` is the target that will be executed, the `Scope` specifies the variable container, the `block_id` indicates the entrance block and `create_local_scope` is a boolean that states whether it will destroy the temporary variables after the execution is finished.
<p>In the <aclass="reference external"href="https://github.com/PaddlePaddle/Paddle/blob/develop/doc/design/fluid.md">fluid</a>, we encourage user use deep learning programming paradigms to describe training process. When the user-written Python program is executed, it will create a protobuf message
<p>In <aclass="reference external"href="https://github.com/PaddlePaddle/Paddle/blob/develop/doc/design/fluid.md">fluid</a>, we encourage the user to use deep learning programming paradigms to describe the training process. When the user-written Python program is executed, it will first create a protobuf message
<aclass="reference external"href="https://github.com/PaddlePaddle/Paddle/blob/a91efdde6910ce92a78e3aa7157412c4c88d9ee8/paddle/framework/framework.proto#L145"><codeclass="docutils literal"><spanclass="pre">ProgramDesc</span></code></a> that describes the process and is conceptually like an <aclass="reference external"href="https://en.wikipedia.org/wiki/Abstract_syntax_tree">abstract syntax tree</a>.</p>
<p>The executor runs the <codeclass="docutils literal"><spanclass="pre">ProgramDesc</span></code> like an interpreter. <codeclass="docutils literal"><spanclass="pre">ProgramDesc</span></code> contains intrinsics/operators and variables which will be used, executor explicitly execute the stored precompiled code.</p>
<p>The executor runs the <codeclass="docutils literal"><spanclass="pre">ProgramDesc</span></code> like an interpreter. <codeclass="docutils literal"><spanclass="pre">ProgramDesc</span></code> contains the intrinsics (operators in this case) and variables which will be used, executor explicitly executes the stored precompiled code.</p>
<p>An executor takes a <codeclass="docutils literal"><spanclass="pre">ProgramDesc</span></code>, a <codeclass="docutils literal"><spanclass="pre">block_id</span></code> and a <codeclass="docutils literal"><spanclass="pre">Scope</span></code>. The <codeclass="docutils literal"><spanclass="pre">ProgramDesc</span></code> is a list of blocks and each block contains the protobuf definition of all the parameters and operators. The <codeclass="docutils literal"><spanclass="pre">block_id</span></code> specifies the entrance block. And the <codeclass="docutils literal"><spanclass="pre">Scope</span></code> is the container of all the variable instance, which is persistent throughout different runs.</p>
<p>An executor takes a <codeclass="docutils literal"><spanclass="pre">ProgramDesc</span></code>, a <codeclass="docutils literal"><spanclass="pre">block_id</span></code> and a <codeclass="docutils literal"><spanclass="pre">Scope</span></code>. The <codeclass="docutils literal"><spanclass="pre">ProgramDesc</span></code> is a list of blocks and each block contains the protobuf definition of all the parameters and operators in the block. The <codeclass="docutils literal"><spanclass="pre">block_id</span></code> specifies the entrance block. And the <codeclass="docutils literal"><spanclass="pre">Scope</span></code> is the container of all the variable instances, which is persistent throughout different runs.</p>
<p><codeclass="docutils literal"><spanclass="pre">Executor</span></code> explicitly executes all the intrinsics/operators in the <codeclass="docutils literal"><spanclass="pre">block_id</span></code>th block of a <codeclass="docutils literal"><spanclass="pre">ProgramDesc</span></code>. Essentially, it instantiates Variables and Operators, then runs all the operators in sequence. It is very similar to push stack frame when entering the block, it will destroy the temporary variables when mini-batch is finished, but it does not have stack frame pop process.</p>
<p>The <codeclass="docutils literal"><spanclass="pre">Executor</span></code> explicitly executes all the intrinsics (operators here) in the <codeclass="docutils literal"><spanclass="pre">block_id</span></code>th block of a <codeclass="docutils literal"><spanclass="pre">ProgramDesc</span></code>. Essentially, it instantiates Variables and Operators, then runs all the operators in sequence one-by-one.
It is very similar to how a push stack frame works when entering a block, following which it cleans up all the temporary variables when a mini-batch is finished. It does not however, have the stack frame pop process.</p>
<p>A executor only provides an unified way to execute <codeclass="docutils literal"><spanclass="pre">ProgramDesc</span></code>. <codeclass="docutils literal"><spanclass="pre">ProgramDesc</span></code> is the target will be executed, scope specifies the variable container. <codeclass="docutils literal"><spanclass="pre">block_id</span></code> indicates the entrance block, <codeclass="docutils literal"><spanclass="pre">create_local_scope</span></code> means if it will destroy the temporary variables after execution finished.</p>
<p>An <codeclass="docutils literal"><spanclass="pre">Executor</span></code> only provides a unified way to execute <codeclass="docutils literal"><spanclass="pre">ProgramDesc</span></code>. <codeclass="docutils literal"><spanclass="pre">ProgramDesc</span></code> is the target that will be executed, the <codeclass="docutils literal"><spanclass="pre">Scope</span></code> specifies the variable container, the <codeclass="docutils literal"><spanclass="pre">block_id</span></code> indicates the entrance block and <codeclass="docutils literal"><spanclass="pre">create_local_scope</span></code> is a boolean that states whether it will destroy the temporary variables after the execution is finished.</p>