Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
95df4700
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
95df4700
编写于
8月 10, 2017
作者:
Q
qijun
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'baidu/develop' into port_blas
上级
688c43b1
478efa2e
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
77 addition
and
31 deletion
+77
-31
CMakeLists.txt
CMakeLists.txt
+2
-0
Dockerfile
Dockerfile
+1
-1
cmake/generic.cmake
cmake/generic.cmake
+1
-1
paddle/framework/CMakeLists.txt
paddle/framework/CMakeLists.txt
+5
-0
paddle/framework/attribute.h
paddle/framework/attribute.h
+1
-1
paddle/framework/ddim.h
paddle/framework/ddim.h
+1
-1
paddle/framework/operator.h
paddle/framework/operator.h
+1
-1
paddle/framework/tensor.h
paddle/framework/tensor.h
+2
-2
paddle/framework/tensor_impl.h
paddle/framework/tensor_impl.h
+11
-5
paddle/operators/gaussian_random_op.cu
paddle/operators/gaussian_random_op.cu
+3
-3
paddle/platform/dynload/cublas.h
paddle/platform/dynload/cublas.h
+7
-7
paddle/platform/dynload/curand.h
paddle/platform/dynload/curand.h
+1
-0
paddle/platform/place.h
paddle/platform/place.h
+1
-1
paddle/platform/variant.h
paddle/platform/variant.h
+32
-0
paddle/scripts/docker/build.sh
paddle/scripts/docker/build.sh
+1
-1
python/CMakeLists.txt
python/CMakeLists.txt
+5
-5
python/paddle/v2/framework/.gitignore
python/paddle/v2/framework/.gitignore
+1
-0
python/paddle/v2/framework/tests/CMakeLists.txt
python/paddle/v2/framework/tests/CMakeLists.txt
+1
-2
未找到文件。
CMakeLists.txt
浏览文件 @
95df4700
...
...
@@ -164,10 +164,12 @@ if(WITH_GOLANG)
add_subdirectory
(
go
)
endif
(
WITH_GOLANG
)
set
(
PADDLE_PYTHON_BUILD_DIR
"
${
CMAKE_CURRENT_BINARY_DIR
}
/python/build"
)
add_subdirectory
(
paddle
)
if
(
WITH_PYTHON
)
add_subdirectory
(
python
)
endif
()
if
(
WITH_DOC
)
add_subdirectory
(
doc
)
endif
()
Dockerfile
浏览文件 @
95df4700
...
...
@@ -64,7 +64,7 @@ RUN pip install --upgrade pip && \
pip
install
-U
sphinx-rtd-theme
==
0.1.9 recommonmark
&&
\
pip
install
pre-commit
'requests==2.9.2'
'ipython==5.3.0'
&&
\
pip
install
'ipykernel==4.6.0'
'jupyter==1.0.0'
&&
\
pip
install
rarfile
pip
install
opencv-python rarfile
'scipy>=0.19.0'
'nltk>=3.2.2'
# To fix https://github.com/PaddlePaddle/Paddle/issues/1954, we use
# the solution in https://urllib3.readthedocs.io/en/latest/user-guide.html#ssl-py2
...
...
cmake/generic.cmake
浏览文件 @
95df4700
...
...
@@ -411,7 +411,7 @@ function(py_test TARGET_NAME)
set
(
multiValueArgs SRCS DEPS
)
cmake_parse_arguments
(
py_test
"
${
options
}
"
"
${
oneValueArgs
}
"
"
${
multiValueArgs
}
"
${
ARGN
}
)
add_test
(
NAME
${
TARGET_NAME
}
COMMAND env PYTHONPATH=
${
PADDLE_PYTHON_
PACKAGE_DIR
}
COMMAND env PYTHONPATH=
${
PADDLE_PYTHON_
BUILD_DIR
}
/lib-python
python2
${
py_test_SRCS
}
WORKING_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
)
endif
()
...
...
paddle/framework/CMakeLists.txt
浏览文件 @
95df4700
...
...
@@ -35,6 +35,11 @@ py_proto_compile(framework_py_proto SRCS attribute.proto op_proto.proto op_desc.
# Generate an empty __init__.py to make framework_py_proto as a valid python module.
add_custom_target
(
framework_py_proto_init ALL COMMAND
${
CMAKE_COMMAND
}
-E touch __init__.py
)
add_dependencies
(
framework_py_proto framework_py_proto_init
)
add_custom_command
(
TARGET framework_py_proto POST_BUILD
COMMAND
${
CMAKE_COMMAND
}
-E make_directory
${
PROJ_ROOT
}
/python/paddle/v2/framework/proto
COMMAND cp *.py
${
PROJ_ROOT
}
/python/paddle/v2/framework/proto/
COMMENT
"Copy generated python proto into directory paddle/v2/framework/proto."
WORKING_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
)
cc_library
(
backward SRCS backward.cc DEPS net_op
)
cc_test
(
backward_test SRCS backward_test.cc DEPS backward
)
...
...
paddle/framework/attribute.h
浏览文件 @
95df4700
...
...
@@ -14,7 +14,6 @@ limitations under the License. */
#pragma once
#include <boost/variant.hpp>
#include <functional>
#include <string>
#include <unordered_map>
...
...
@@ -24,6 +23,7 @@ limitations under the License. */
#include "paddle/framework/attribute.pb.h"
#include "paddle/framework/op_desc.pb.h"
#include "paddle/platform/enforce.h"
#include "paddle/platform/variant.h"
namespace
paddle
{
namespace
framework
{
...
...
paddle/framework/ddim.h
浏览文件 @
95df4700
...
...
@@ -14,12 +14,12 @@ limitations under the License. */
#pragma once
#include <boost/variant.hpp>
#include <initializer_list>
#include <stdexcept>
#include <vector>
#include "paddle/framework/dim.h"
#include "paddle/platform/enforce.h"
#include "paddle/platform/variant.h"
#include "unsupported/Eigen/CXX11/Tensor"
namespace
paddle
{
...
...
paddle/framework/operator.h
浏览文件 @
95df4700
...
...
@@ -15,7 +15,6 @@ limitations under the License. */
#pragma once
#include <algorithm>
#include <boost/variant.hpp>
#include <string>
#include <unordered_map>
#include <vector>
...
...
@@ -27,6 +26,7 @@ limitations under the License. */
#include "paddle/framework/tensor.h"
#include "paddle/platform/device_context.h"
#include "paddle/platform/place.h"
#include "paddle/platform/variant.h"
#include "paddle/utils/Error.h"
namespace
paddle
{
...
...
paddle/framework/tensor.h
浏览文件 @
95df4700
...
...
@@ -79,11 +79,11 @@ class Tensor {
inline
const
DDim
&
dims
()
const
;
/*! Resize the dimensions of the memory block. */
inline
void
Resize
(
const
DDim
&
dims
);
inline
Tensor
&
Resize
(
const
DDim
&
dims
);
/*! The internal of two tensors share the same memory block. */
template
<
typename
T
>
inline
void
ShareDataWith
(
const
Tensor
&
src
);
inline
Tensor
&
ShareDataWith
(
const
Tensor
&
src
);
/**
* @brief Copy the content of external tensor to a new place.
...
...
paddle/framework/tensor_impl.h
浏览文件 @
95df4700
...
...
@@ -23,9 +23,11 @@ template <typename T>
inline
void
Tensor
::
check_memory_size
()
const
{
PADDLE_ENFORCE_NOT_NULL
(
holder_
,
"Tenosr holds no memory. Call Tensor::mutable_data first."
);
PADDLE_ENFORCE_GE
(
holder_
->
size
(),
product
(
dims_
)
*
sizeof
(
T
)
+
offset_
,
"Tensor's dims_ is out of bound. Call Tensor::mutable_data "
"first to re-allocate memory."
);
PADDLE_ENFORCE_GE
(
holder_
->
size
(),
product
(
dims_
)
*
sizeof
(
T
)
+
offset_
,
"Tensor's dims_ is out of bound. Call Tensor::mutable_data "
"first to re-allocate memory.
\n
"
"or maybe the required data-type mismatches the data already stored."
);
}
template
<
typename
T
>
...
...
@@ -78,9 +80,10 @@ inline T* Tensor::mutable_data(platform::Place place) {
}
template
<
typename
T
>
inline
void
Tensor
::
ShareDataWith
(
const
Tensor
&
src
)
{
inline
Tensor
&
Tensor
::
ShareDataWith
(
const
Tensor
&
src
)
{
src
.
check_memory_size
<
T
>
();
*
this
=
src
;
return
*
this
;
}
template
<
typename
T
>
...
...
@@ -136,7 +139,10 @@ inline Tensor Tensor::Slice(const int& begin_idx, const int& end_idx) const {
return
dst
;
}
inline
void
Tensor
::
Resize
(
const
DDim
&
dims
)
{
dims_
=
dims
;
}
inline
Tensor
&
Tensor
::
Resize
(
const
DDim
&
dims
)
{
dims_
=
dims
;
return
*
this
;
}
inline
const
DDim
&
Tensor
::
dims
()
const
{
return
dims_
;
}
...
...
paddle/operators/gaussian_random_op.cu
浏览文件 @
95df4700
...
...
@@ -40,8 +40,8 @@ class GaussianRandomKernel : public framework::OpKernel {
&
g
,
CURAND_RNG_PSEUDO_DEFAULT
));
PADDLE_ENFORCE
(
platform
::
dynload
::
curandSetPseudoRandomGeneratorSeed
(
g
,
seed
));
curandGenerateNormal
(
g
,
data
,
framework
::
product
(
tensor
->
dims
()),
mean
,
std
);
platform
::
dynload
::
curandGenerateNormal
(
g
,
data
,
framework
::
product
(
tensor
->
dims
()),
mean
,
std
);
}
};
...
...
@@ -49,4 +49,4 @@ class GaussianRandomKernel : public framework::OpKernel {
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
REGISTER_OP_GPU_KERNEL
(
gaussian_random
,
ops
::
GaussianRandomKernel
<
float
>
);
\ No newline at end of file
REGISTER_OP_GPU_KERNEL
(
gaussian_random
,
ops
::
GaussianRandomKernel
<
float
>
);
paddle/platform/dynload/cublas.h
浏览文件 @
95df4700
...
...
@@ -48,13 +48,13 @@ extern void *cublas_dso_handle;
}; \
extern DynLoad__##__name __name
#else
#define DECLARE_DYNAMIC_LOAD_CUBLAS_WRAP(__name) \
struct DynLoad__##__name { \
inline template <typename... Args>
\
cublasStatus_t operator()(Args... args) {
\
return __name(args...); \
} \
}; \
#define DECLARE_DYNAMIC_LOAD_CUBLAS_WRAP(__name)
\
struct DynLoad__##__name {
\
template <typename... Args>
\
inline cublasStatus_t operator()(Args... args) {
\
return __name(args...);
\
}
\
};
\
extern DynLoad__##__name __name
#endif
...
...
paddle/platform/dynload/curand.h
浏览文件 @
95df4700
...
...
@@ -55,6 +55,7 @@ extern void *curand_dso_handle;
__macro(curandSetPseudoRandomGeneratorSeed); \
__macro(curandGenerateUniform); \
__macro(curandGenerateUniformDouble); \
__macro(curandGenerateNormal); \
__macro(curandDestroyGenerator);
CURAND_RAND_ROUTINE_EACH
(
DECLARE_DYNAMIC_LOAD_CURAND_WRAP
);
...
...
paddle/platform/place.h
浏览文件 @
95df4700
...
...
@@ -14,8 +14,8 @@ limitations under the License. */
#pragma once
#include <boost/variant.hpp>
#include <iostream>
#include "paddle/platform/variant.h"
namespace
paddle
{
namespace
platform
{
...
...
paddle/platform/variant.h
0 → 100644
浏览文件 @
95df4700
/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
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. */
#pragma once
#include <boost/config.hpp>
#ifndef PADDLE_ONLY_CPU
// Because boost's variadic templates has bug on nvcc, boost will disable
// variadic template support when GPU enabled on nvcc.
// Define BOOST_NO_CXX11_VARIADIC_TEMPLATES on gcc/clang to generate same
// function symbols.
//
// https://github.com/PaddlePaddle/Paddle/issues/3386
#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES
#define BOOST_NO_CXX11_VARIADIC_TEMPLATES
#endif
#endif
#include <boost/variant.hpp>
paddle/scripts/docker/build.sh
浏览文件 @
95df4700
...
...
@@ -74,11 +74,11 @@ cat <<EOF
Running unit tests ...
========================================
EOF
ctest
--output-on-failure
# make install should also be test when unittest
make
install
-j
`
nproc
`
pip
install
/usr/local/opt/paddle/share/wheels/
*
.whl
paddle version
ctest
--output-on-failure
fi
...
...
python/CMakeLists.txt
浏览文件 @
95df4700
set
(
OUTPUT_DIR
"
${
CMAKE_CURRENT_BINARY_DIR
}
/build"
)
file
(
GLOB TRAINER_PY_FILES . ./paddle/trainer/*.py
)
file
(
GLOB HELPERS_PY_FILES . ./paddle/trainer_config_helpers/*.py
)
...
...
@@ -33,13 +31,15 @@ add_custom_command(OUTPUT ${PROJ_ROOT}/python/paddle/v2/framework/core.so
add_custom_target
(
copy_paddle_pybind ALL DEPENDS
${
PROJ_ROOT
}
/python/paddle/v2/framework/core.so
)
add_custom_command
(
OUTPUT
${
OUTPUT
_DIR
}
/.timestamp
add_custom_command
(
OUTPUT
${
PADDLE_PYTHON_BUILD
_DIR
}
/.timestamp
COMMAND env
${
py_env
}
${
PYTHON_EXECUTABLE
}
setup.py bdist_wheel
COMMAND
${
CMAKE_COMMAND
}
-E touch
${
OUTPUT_DIR
}
/.timestamp
COMMAND
${
CMAKE_COMMAND
}
-E touch
${
PADDLE_PYTHON_BUILD_DIR
}
/.timestamp
COMMAND
${
CMAKE_COMMAND
}
-E remove_directory
${
PADDLE_PYTHON_BUILD_DIR
}
/lib-python
COMMAND
${
CMAKE_COMMAND
}
-E copy_directory
${
PADDLE_PYTHON_BUILD_DIR
}
/lib*
${
PADDLE_PYTHON_BUILD_DIR
}
/lib-python
DEPENDS gen_proto_py copy_paddle_pybind framework_py_proto
${
PY_FILES
}
${
external_project_dependencies
}
${
COPY_PADDLE_MASTER
}
)
add_custom_target
(
paddle_python ALL DEPENDS
${
OUTPUT
_DIR
}
/.timestamp paddle_pserver_main paddle_trainer paddle_merge_model python_api_wheel
)
${
PADDLE_PYTHON_BUILD
_DIR
}
/.timestamp paddle_pserver_main paddle_trainer paddle_merge_model python_api_wheel
)
set
(
PADDLE_PYTHON_PACKAGE_DIR
${
CMAKE_CURRENT_BINARY_DIR
}
/dist/
)
...
...
python/paddle/v2/framework/.gitignore
0 → 100644
浏览文件 @
95df4700
proto
python/paddle/v2/framework/tests/CMakeLists.txt
浏览文件 @
95df4700
...
...
@@ -23,6 +23,5 @@ py_test(test_rowwise_add_op SRCS test_rowwise_add_op.py)
py_test
(
test_default_scope_funcs SRCS test_default_scope_funcs.py
)
py_test
(
test_operator SRCS test_operator.py
)
py_test
(
test_gaussian_random_op SRCS test_gaussian_random_op.py
)
# py_test(test_gaussian_random_op SRCS test_gaussian_random_op.py)
py_test
(
test_uniform_random_op SRCS test_uniform_random_op.py
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录