Skip to content

Commit

Permalink
remove conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
chengduoZH committed Dec 29, 2017
2 parents 24cf2fc + 5bf37b9 commit 812c5f6
Show file tree
Hide file tree
Showing 100 changed files with 1,705 additions and 547 deletions.
16 changes: 10 additions & 6 deletions benchmark/paddle/image/run_openblas_infer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,19 @@ function clock_to_seconds() {
}

function infer() {
unset OMP_NUM_THREADS MKL_NUM_THREADS OMP_DYNAMIC KMP_AFFINITY
topology=$1
layer_num=$2
bs=$3
thread=`nproc`
if [ $thread -gt $bs ]; then
thread=$bs
trainers=`nproc`
if [ $trainers -gt $bs ]; then
trainers=$bs
fi
log="logs/infer-${topology}-${layer_num}-${thread}openblas-${bs}.log"
log="logs/infer-${topology}-${layer_num}-${trainers}openblas-${bs}.log"
threads=$((`nproc` / trainers))
if [ $threads -eq 0 ]; then
threads=1
fi
export OPENBLAS_NUM_THREADS=$threads

models_in="models/${topology}-${layer_num}/pass-00000/"
if [ ! -d $models_in ]; then
Expand All @@ -28,7 +32,7 @@ function infer() {
--config="${topology}.py" \
--use_mkldnn=False \
--use_gpu=False \
--trainer_count=$thread \
--trainer_count=$trainers \
--log_period=$log_period \
--config_args="batch_size=${bs},layer_num=${layer_num},is_infer=True,num_samples=256" \
--init_model_path=$models_in \
Expand Down
2 changes: 1 addition & 1 deletion benchmark/paddle/image/run_openblas_train.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
set -e

function train() {
unset OMP_NUM_THREADS MKL_NUM_THREADS OMP_DYNAMIC KMP_AFFINITY
export OPENBLAS_NUM_THREADS=1
topology=$1
layer_num=$2
bs=$3
Expand Down
5 changes: 5 additions & 0 deletions doc/api/v2/config/layer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,11 @@ first_seq
.. autoclass:: paddle.v2.layer.first_seq
:noindex:

sub_seq
---------
.. autoclass:: paddle.v2.layer.sub_seq
:noindex:

concat
------
.. autoclass:: paddle.v2.layer.concat
Expand Down
6 changes: 0 additions & 6 deletions doc/api/v2/fluid/layers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,6 @@ scale
:noindex:


reshape
---------
.. autofunction:: paddle.v2.fluid.layers.reshape
:noindex:


transpose
---------
.. autofunction:: paddle.v2.fluid.layers.transpose
Expand Down
2 changes: 1 addition & 1 deletion doc/design/optimizer.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class Optimizer(object):
def minimize(self, loss, parameter_list):
"""Add operations to minimize `loss` by updating `parameter_list`.
This method combines interface `append_backward_ops()` and
This method combines interface `append_backward()` and
`create_optimization_pass()` into one.
"""
params_grads = self.create_backward_pass(loss, parameter_list)
Expand Down
8 changes: 4 additions & 4 deletions doc/getstarted/build_and_install/docker_install_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
获取PaddlePaddle的Docker镜像
------------------------------

执行下面的命令获取最新的PaddlePaddle Docker镜像
执行下面的命令获取最新的PaddlePaddle Docker镜像,版本为cpu_avx_mkl:

.. code-block:: bash
Expand All @@ -27,7 +27,7 @@
docker pull docker.paddlepaddle.org/paddle
下载GPU版本的Docker镜像
下载GPU版本(cuda8.0_cudnn5_avx_mkl)的Docker镜像

.. code-block:: bash
Expand All @@ -54,7 +54,7 @@
.. _docker_run:

在Docker中执行PaddlePaddle训练程序
------------------------------
----------------------------------

假设您已经在当前目录(比如在/home/work)编写了一个PaddlePaddle的程序 :code:`train.py` (可以参考
`PaddlePaddleBook <http://www.paddlepaddle.org/docs/develop/book/01.fit_a_line/index.cn.html>`_
Expand Down Expand Up @@ -82,7 +82,7 @@
.. _docker_run_book:

使用Docker启动PaddlePaddle Book教程
------------------------------
-----------------------------------

使用Docker可以快速在本地启动一个包含了PaddlePaddle官方Book教程的Jupyter Notebook,可以通过网页浏览。
PaddlePaddle Book是为用户和开发者制作的一个交互式的Jupyter Notebook。
Expand Down
6 changes: 3 additions & 3 deletions doc/getstarted/build_and_install/docker_install_en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ After you've read above tutorials you may proceed the following steps.
Pull PaddlePaddle Docker Image
------------------------------

Run the following command to download the latest Docker images:
Run the following command to download the latest Docker images, the version is cpu_avx_mkl:

.. code-block:: bash
Expand All @@ -28,7 +28,7 @@ For users in China, we provide a faster mirror:
docker pull docker.paddlepaddle.org/paddle
Download GPU version images:
Download GPU version (cuda8.0_cudnn5_avx_mkl) images:

.. code-block:: bash
Expand Down Expand Up @@ -58,7 +58,7 @@ and run:
.. _docker_run:

Launch your training program in Docker
------------------------------
--------------------------------------

Assume that you have already written a PaddlePaddle program
named :code:`train.py` under directory :code:`/home/work` (refer to
Expand Down
4 changes: 2 additions & 2 deletions doc/getstarted/build_and_install/pip_install_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ PaddlePaddle可以使用常用的Python包管理工具
------------------------------


执行下面的命令即可在当前机器上安装PaddlePaddle的运行时环境,并自动下载安装依赖软件。
执行下面的命令即可在当前机器上安装PaddlePaddle的运行时环境,并自动下载安装依赖软件,版本为cpu_avx_openblas

.. code-block:: bash
pip install paddlepaddle
如果需要安装支持GPU的版本,需要执行:
如果需要安装支持GPU的版本(cuda7.5_cudnn5_avx_openblas),需要执行:

.. code-block:: bash
Expand Down
4 changes: 2 additions & 2 deletions doc/getstarted/build_and_install/pip_install_en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ Install Using pip
------------------------------

Run the following command to install PaddlePaddle on the current
machine, it will also download requirements.
machine, it will also download requirements, the version is cpu_avx_openblas.

.. code-block:: bash
pip install paddlepaddle
If you wish to install GPU version, just run:
If you wish to install GPU version (cuda7.5_cudnn5_avx_openblas), just run:

.. code-block:: bash
Expand Down
4 changes: 2 additions & 2 deletions doc/getstarted/index_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
++++++++

PaddlePaddle支持使用pip快速安装,目前支持CentOS 6以上, Ubuntu 14.04以及MacOS 10.12,并安装有Python2.7。
执行下面的命令完成快速安装:
执行下面的命令完成快速安装,版本为cpu_avx_openblas

.. code-block:: bash
pip install paddlepaddle
如果需要安装支持GPU的版本,需要执行:
如果需要安装支持GPU的版本(cuda7.5_cudnn5_avx_openblas),需要执行:

.. code-block:: bash
Expand Down
4 changes: 2 additions & 2 deletions doc/getstarted/index_en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ Quick Install

You can use pip to install PaddlePaddle with a single command, supports
CentOS 6 above, Ubuntu 14.04 above or MacOS 10.12, with Python 2.7 installed.
Simply run the following command to install:
Simply run the following command to install, the version is cpu_avx_openblas:

.. code-block:: bash
pip install paddlepaddle
If you need to install GPU version, run:
If you need to install GPU version (cuda7.5_cudnn5_avx_openblas), run:

.. code-block:: bash
Expand Down
12 changes: 10 additions & 2 deletions paddle/framework/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,18 @@ cc_library(ddim SRCS ddim.cc DEPS eigen3)
cc_test(ddim_test SRCS ddim_test.cc DEPS ddim)
nv_test(dim_test SRCS dim_test.cu DEPS ddim)

cc_library(tensor SRCS tensor.cc DEPS ddim place paddle_memory device_context)
if (WITH_GPU)
nv_library(tensor SRCS tensor.cc tensor_util.cu DEPS ddim place paddle_memory device_context framework_proto)
else()
cc_library(tensor SRCS tensor.cc tensor_util.cc DEPS ddim place paddle_memory device_context framework_proto)
endif ()

cc_test(tensor_test SRCS tensor_test.cc DEPS tensor)
cc_test(tensor_util_test SRCS tensor_util_test.cc DEPS tensor)
if (WITH_GPU)
nv_test(tensor_util_test SRCS tensor_util_test.cc tensor_util_test.cu DEPS tensor)
else()
cc_test(tensor_util_test SRCS tensor_util_test.cc DEPS tensor)
endif()

cc_test(eigen_test SRCS eigen_test.cc DEPS tensor)

Expand Down
1 change: 1 addition & 0 deletions paddle/framework/data_transform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. */

#include "paddle/framework/data_transform.h"
#include "paddle/framework/lod_tensor.h"

namespace paddle {
namespace framework {
Expand Down
17 changes: 8 additions & 9 deletions paddle/framework/data_transform.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ limitations under the License. */
namespace paddle {
namespace framework {

using DataTransformFN =
std::function<void(const std::vector<platform::DeviceContext*> ctx,
const Variable& in, Variable* out)>;
using DataTransformFn = std::function<void(const platform::DeviceContext* ctx,
const Variable& in, Variable* out)>;
using KernelTypePair = std::pair<OpKernelType, OpKernelType>;

struct KernelTypePairHash {
Expand All @@ -47,7 +46,7 @@ struct KernelTypePairHash {
};

using DataTransformMap =
std::unordered_map<KernelTypePair, DataTransformFN, KernelTypePairHash>;
std::unordered_map<KernelTypePair, DataTransformFn, KernelTypePairHash>;

class DataTransformFnMap {
public:
Expand All @@ -58,25 +57,25 @@ class DataTransformFnMap {
}

void Insert(const OpKernelType& left, const OpKernelType& right,
const DataTransformFN& data_tranform_fn) {
const DataTransformFn& data_tranform_fn) {
Insert(std::make_pair(left, right), data_tranform_fn);
}

void Insert(const KernelTypePair& kernel_type_pair,
const DataTransformFN& data_tranform_fn) {
const DataTransformFn& data_tranform_fn) {
PADDLE_ENFORCE(!Has(kernel_type_pair),
"KernelTypePair %s has been registered", "");
map_.insert({kernel_type_pair, data_tranform_fn});
}

const DataTransformFN& Get(const KernelTypePair& key_pair) const {
const DataTransformFn& Get(const KernelTypePair& key_pair) const {
auto data_transformer = GetNullable(key_pair);
PADDLE_ENFORCE_NOT_NULL(data_transformer,
"DataTransformFN should not be NULL");
"DataTransformFn should not be NULL");
return *data_transformer;
}

const DataTransformFN* GetNullable(const KernelTypePair& key_pair) const {
const DataTransformFn* GetNullable(const KernelTypePair& key_pair) const {
auto it = map_.find(key_pair);
if (it == map_.end()) {
return nullptr;
Expand Down
Loading

0 comments on commit 812c5f6

Please sign in to comment.