Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into make_get_test_program_private
commit
fab6287edf
@ -0,0 +1,57 @@
|
|||||||
|
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
OPTION(WITH_LIBXSMM "Compile with libxsmm" OFF)
|
||||||
|
|
||||||
|
IF(NOT WITH_LIBXSMM)
|
||||||
|
return()
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
IF(WIN32 OR APPLE OR ANDROID OR IOS)
|
||||||
|
MESSAGE(WARNING "Windows, Mac or Mobile are not supported with libxsmm in Paddle yet.")
|
||||||
|
SET(WITH_LIBXSMM OFF CACHE STRING "Disable LIBXSMM" FORCE)
|
||||||
|
return()
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
INCLUDE (ExternalProject)
|
||||||
|
|
||||||
|
SET(LIBXSMM_SOURCES_DIR ${THIRD_PARTY_PATH}/libxsmm)
|
||||||
|
SET(LIBXSMM_INSTALL_DIR ${THIRD_PARTY_PATH}/install/libxsmm)
|
||||||
|
SET(LIBXSMM_INCLUDE_DIR "${LIBXSMM_INSTALL_DIR}/include" CACHE PATH "LIBXSMM include directory." FORCE)
|
||||||
|
SET(LIBXSMM_LIBRARY_DIR "${LIBXSMM_INSTALL_DIR}/lib" CACHE PATH "LIBXSMM library directory." FORCE)
|
||||||
|
SET(LIBXSMM_LIBS "${LIBXSMM_LIBRARY_DIR}/libxsmm.a"
|
||||||
|
"${LIBXSMM_LIBRARY_DIR}/libxsmmnoblas.a")
|
||||||
|
|
||||||
|
ExternalProject_Add(
|
||||||
|
extern_libxsmm
|
||||||
|
GIT_REPOSITORY "https://github.com/hfp/libxsmm.git"
|
||||||
|
GIT_TAG "7cc03b5b342fdbc6b6d990b190671c5dbb8489a2"
|
||||||
|
PREFIX ${LIBXSMM_SOURCES_DIR}
|
||||||
|
UPDATE_COMMAND ""
|
||||||
|
CONFIGURE_COMMAND ""
|
||||||
|
BUILD_IN_SOURCE 1
|
||||||
|
BUILD_COMMAND $(MAKE) --silent PREFIX=${LIBXSMM_INSTALL_DIR} CXX=g++ CC=gcc WARP=0 install
|
||||||
|
INSTALL_COMMAND ""
|
||||||
|
)
|
||||||
|
ADD_LIBRARY(libxsmm STATIC IMPORTED GLOBAL)
|
||||||
|
SET_PROPERTY(TARGET libxsmm PROPERTY IMPORTED_LOCATION "${LIBXSMM_LIBRARY_DIR}/libxsmm.a")
|
||||||
|
SET_PROPERTY(TARGET libxsmm PROPERTY IMPORTED_LOCATION "${LIBXSMM_LIBRARY_DIR}/libxsmmnoblas.a")
|
||||||
|
|
||||||
|
MESSAGE(STATUS "Libxsmm library: ${LIBXSMM_LIBS}")
|
||||||
|
include_directories(${LIBXSMM_INCLUDE_DIR})
|
||||||
|
ADD_DEFINITIONS(-DPADDLE_WITH_LIBXSMM)
|
||||||
|
ADD_DEPENDENCIES(libxsmm extern_libxsmm)
|
||||||
|
LIST(APPEND external_project_dependencies libxsmm)
|
||||||
|
|
@ -0,0 +1,89 @@
|
|||||||
|
## Motivation
|
||||||
|
|
||||||
|
There is a ```gap``` between the ```Program``` defined by
|
||||||
|
user and the ```Executable``` that can be scheduled
|
||||||
|
efficiently on heterogeneous hardware, either locally
|
||||||
|
or distributedly.
|
||||||
|
|
||||||
|
Usually, the ```gap``` is bridged by
|
||||||
|
|
||||||
|
* A serious transformations with defined order.
|
||||||
|
|
||||||
|
* These transformations usually involve
|
||||||
|
```insert, delete, clustering, split, dependency analysis```.
|
||||||
|
|
||||||
|
* Has a simple way to verify and debug each transformation.
|
||||||
|
|
||||||
|
* Flexible to add, remove or customize transformations to fit
|
||||||
|
the requirements of various algorithms (models) and hardware secenarios.
|
||||||
|
|
||||||
|
Some other events also push us to a better unified pattern.
|
||||||
|
|
||||||
|
* The deep learning framework is built around the concepts of graphs.
|
||||||
|
To leverage tools such as compilation (e.g. TVM and nGraph) or
|
||||||
|
cross-framework conversion (e.g. ONNX), we also need a intermediate
|
||||||
|
representation that can be connected to the rest of the ecosystem.
|
||||||
|
|
||||||
|
|
||||||
|
We need a unified pattern to naturally support the requirements
|
||||||
|
described above. The pattern should fit both training, inference
|
||||||
|
and other offline serielized model transformations.
|
||||||
|
Learned from LLVM and other deep learning framework, we draft the
|
||||||
|
design below.
|
||||||
|
|
||||||
|
|
||||||
|
## Design
|
||||||
|
|
||||||
|
### Major Concepts
|
||||||
|
|
||||||
|
#### Node
|
||||||
|
|
||||||
|
```Node``` represents an operation that performs some computation or
|
||||||
|
a variable that is input or output of operation.
|
||||||
|
|
||||||
|
```Node```s are connected to other ```Node```s via inputs and outputs.
|
||||||
|
|
||||||
|
Other properties (maybe device placement information) can be added
|
||||||
|
to ```Node``` in the future if it's a
|
||||||
|
common requirement of many other ```Pass```es. Otherwise, it should live
|
||||||
|
in a ```Node``` wrapper class that is private to some ```Pass``` or be
|
||||||
|
a local member of a ```Pass```.
|
||||||
|
|
||||||
|
#### Graph
|
||||||
|
|
||||||
|
```Graph``` contains a list of ```Node```s, which are connected to
|
||||||
|
each other via inputs and outputs.
|
||||||
|
|
||||||
|
TODO: Better definitions for the graph.
|
||||||
|
|
||||||
|
```Graph``` can also contain ```Attribute```s. ```Attribute```s
|
||||||
|
can be ``any`` thing. For example, it can be a list of "wraper"
|
||||||
|
nodes. The ```wrapper``` nodes compose ```Node```s and provide
|
||||||
|
helper method for execution or transformation. ```Attribute```
|
||||||
|
can also contain other things that describe some properties of
|
||||||
|
the ```Graph``` or ```Graph``` nodes. ```Attribute``` can be passed
|
||||||
|
across ```Pass```. However, it should be used with care.
|
||||||
|
|
||||||
|
#### Pass
|
||||||
|
|
||||||
|
```Pass``` represents a transformation of ```Graph```. Its input
|
||||||
|
is a ```Graph``` and its output is also a ```Graph```. For example,
|
||||||
|
a ```Pass``` can simply print out the ```Graph```. A ```Pass```
|
||||||
|
can also fuse some ```Graph```'s ```Node```s.
|
||||||
|
|
||||||
|
#### Optimize
|
||||||
|
|
||||||
|
```Optimize``` contains a series of ```Pass``` with defined order.
|
||||||
|
```Optimize``` transforms a ```Graph``` that only contains raw
|
||||||
|
modeling logic to a ```Graph``` that can be run efficiently while
|
||||||
|
maintaining the original modeling logic.
|
||||||
|
|
||||||
|
|
||||||
|
### Optimize Process
|
||||||
|
|
||||||
|
* Program is first converted to Graph.
|
||||||
|
* Graph goes through a series of Pass
|
||||||
|
* Graph is transformed from raw model logic to a
|
||||||
|
form that is efficient to execute.
|
||||||
|
|
||||||
|
Program->ProgramToGraph->Graph->Pass1->Graph->Pass2->Graph->Pass3->Graph->Executor
|
@ -1,12 +1,16 @@
|
|||||||
PaddlePaddle Fluid
|
.. PaddlePaddle Fluid documentation master file, created by
|
||||||
==========================
|
sphinx-quickstart on Thu Jun 7 17:04:53 2018.
|
||||||
|
You can adapt this file completely to your liking, but it should at least
|
||||||
|
contain the root `toctree` directive.
|
||||||
|
|
||||||
|
##############
|
||||||
|
欢迎使用 Fluid
|
||||||
|
##############
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 1
|
:maxdepth: 1
|
||||||
|
|
||||||
getstarted/index_cn.rst
|
new_docs/beginners_guide/index.rst
|
||||||
build_and_install/index_cn.rst
|
new_docs/user_guides/index.rst
|
||||||
design/index_cn.rst
|
new_docs/advanced_usage/index.rst
|
||||||
howto/index_cn.rst
|
new_docs/faq/index_cn.rst
|
||||||
dev/index_cn.rst
|
|
||||||
faq/index_cn.rst
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue