Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
fa4f00d9
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
fa4f00d9
编写于
6月 28, 2017
作者:
Q
qiaolongfei
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' of
https://github.com/PaddlePaddle/Paddle
into scope-impl
上级
5e8d8e07
4db23bba
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
40 addition
and
11 deletion
+40
-11
cmake/generic.cmake
cmake/generic.cmake
+1
-1
paddle/framework/variable.h
paddle/framework/variable.h
+8
-5
paddle/gserver/layers/Layer.cpp
paddle/gserver/layers/Layer.cpp
+5
-0
paddle/math/Matrix.cpp
paddle/math/Matrix.cpp
+2
-0
paddle/math/Matrix.h
paddle/math/Matrix.h
+2
-1
paddle/math/Vector.cpp
paddle/math/Vector.cpp
+2
-0
paddle/math/Vector.h
paddle/math/Vector.h
+4
-4
paddle/math/tests/test_matrixCompare.cpp
paddle/math/tests/test_matrixCompare.cpp
+14
-0
paddle/scripts/docker/build.sh
paddle/scripts/docker/build.sh
+2
-0
未找到文件。
cmake/generic.cmake
浏览文件 @
fa4f00d9
...
...
@@ -296,7 +296,7 @@ function(go_library TARGET_NAME)
COMMAND rm -rf
${
PADDLE_IN_GOPATH
}
COMMAND ln -sf
${
CMAKE_SOURCE_DIR
}
${
PADDLE_IN_GOPATH
}
# Automatically get all dependencies specified in the source code
COMMAND env GOPATH=
${
GOPATH
}
${
CMAKE_Go_COMPILER
}
get -d ./..
COMMAND env GOPATH=
${
GOPATH
}
${
CMAKE_Go_COMPILER
}
get -d ./..
.
# Golang build source code
COMMAND env GOPATH=
${
GOPATH
}
${
CMAKE_Go_COMPILER
}
build
${
BUILD_MODE
}
-o
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
LIB_NAME
}
"
...
...
paddle/framework/variable.h
浏览文件 @
fa4f00d9
...
...
@@ -25,21 +25,24 @@ class Variable {
public:
template
<
typename
T
>
const
T
&
Get
()
const
{
PADDLE_ASSERT
(
holder_
!=
nullptr
);
PADDLE_ASSERT
(
std
::
type_index
(
typeid
(
T
))
==
std
::
type_index
(
holder_
->
Type
()));
PADDLE_ASSERT
(
IsType
<
T
>
());
return
*
static_cast
<
const
T
*>
(
holder_
->
Ptr
());
}
template
<
typename
T
>
T
*
GetMutable
()
{
if
(
holder_
==
nullptr
||
std
::
type_index
(
typeid
(
T
))
!=
std
::
type_index
(
holder_
->
Type
()))
{
if
(
!
IsType
<
T
>
())
{
holder_
.
reset
(
new
PlaceholderImpl
<
T
>
(
new
T
()));
}
return
static_cast
<
T
*>
(
holder_
->
Ptr
());
}
template
<
typename
T
>
bool
IsType
()
const
{
return
holder_
!=
nullptr
&&
std
::
type_index
(
typeid
(
T
))
==
std
::
type_index
(
holder_
->
Type
());
}
private:
struct
Placeholder
{
virtual
~
Placeholder
()
{}
...
...
paddle/gserver/layers/Layer.cpp
浏览文件 @
fa4f00d9
...
...
@@ -191,6 +191,11 @@ void Layer::addOutputArgument(int deviceId) {
void
Layer
::
copyOutputToOtherDevice
()
{
for
(
size_t
i
=
0
;
i
!=
outputOtherDevice_
.
size
();
i
++
)
{
SetDevice
device
(
outputOtherDevice_
[
i
].
deviceId
);
// If outputOtherDevice_[i].value is a CpuMatrix,
// the copyFrom is a synchronous interface.
// If outputOtherDevice_[i].value is a GpuMatrix, since subsequent
// calculations are all on HPPL_STREAM_DEFAULT,
// copyFrom can be an asynchronous interface.
outputOtherDevice_
[
i
].
value
->
copyFrom
(
*
getOutputValue
(),
HPPL_STREAM_DEFAULT
);
outputOtherDevice_
[
i
].
sequenceStartPositions
=
...
...
paddle/math/Matrix.cpp
浏览文件 @
fa4f00d9
...
...
@@ -1565,6 +1565,8 @@ void CpuMatrix::copyFrom(const Matrix& src, hl_stream_t stream) {
const_cast
<
real
*>
(
src
.
getData
()),
sizeof
(
real
)
*
elementCnt_
,
stream
);
// There is a need to add synchronization to ensure that the data is copied.
hl_stream_synchronize
(
stream
);
}
else
if
(
typeid
(
src
)
==
typeid
(
CpuMatrix
))
{
memcpy
(
data_
,
src
.
getData
(),
sizeof
(
real
)
*
elementCnt_
);
}
else
{
...
...
paddle/math/Matrix.h
浏览文件 @
fa4f00d9
...
...
@@ -239,7 +239,8 @@ public:
LOG
(
FATAL
)
<<
"Not implemented"
;
}
// asynchronous copy
// For GpuMatrix this is an asynchronous copy interface
// For CpuMatrix this is an synchronous copy interface
virtual
void
copyFrom
(
const
Matrix
&
src
,
hl_stream_t
stream
)
{
LOG
(
FATAL
)
<<
"Not implemented"
;
}
...
...
paddle/math/Vector.cpp
浏览文件 @
fa4f00d9
...
...
@@ -657,6 +657,8 @@ void CpuVectorT<T>::copyFrom(const VectorT<T>& src, hl_stream_t stream) {
(
void
*
)
src
.
getData
(),
sizeof
(
T
)
*
this
->
getSize
(),
stream
);
// There is a need to add synchronization to ensure that the data is copied.
hl_stream_synchronize
(
stream
);
}
else
{
src
.
copyTo
(
this
);
}
...
...
paddle/math/Vector.h
浏览文件 @
fa4f00d9
...
...
@@ -168,11 +168,11 @@ public:
virtual
void
copyFrom
(
const
VectorT
<
T
>&
src
)
=
0
;
/**
* If
use_gpu, this function will push the copy-task to the specifed-stream
* and return immediately.
* If
GpuVector, this function is an asynchronous interface,
*
will push the copy-task to the specifed-stream
and return immediately.
*
* If
not use GPU, this function is same as
*
the copyFrom(const VectorT<T>& src), which use stream HPPL_STREAM_DEFAULT
.
* If
CpuVector, this function is an synchronous interface,
*
same as the copyFrom(const VectorT<T>& src)
.
*/
virtual
void
copyFrom
(
const
VectorT
<
T
>&
src
,
hl_stream_t
stream
)
=
0
;
...
...
paddle/math/tests/test_matrixCompare.cpp
浏览文件 @
fa4f00d9
...
...
@@ -1127,4 +1127,18 @@ TEST(Matrix, MaxOutFwdBwd) {
}
}
TEST
(
CpuMatrix
,
copyFrom
)
{
const
size_t
height
=
1000
;
const
size_t
width
=
1000
;
CpuMatrix
cpu
(
height
,
width
);
GpuMatrix
gpu
(
height
,
width
);
CpuMatrix
copy
(
height
,
width
);
cpu
.
randomizeUniform
();
gpu
.
copyFrom
(
cpu
);
copy
.
copyFrom
(
gpu
,
HPPL_STREAM_DEFAULT
);
TensorCheckEqual
(
cpu
,
copy
);
}
#endif
paddle/scripts/docker/build.sh
浏览文件 @
fa4f00d9
...
...
@@ -31,6 +31,7 @@ Configuring cmake in /paddle/build ...
-DWITH_DOC=OFF
-DWITH_GPU=
${
WITH_GPU
:-
OFF
}
-DWITH_AVX=
${
WITH_AVX
:-
OFF
}
-DWITH_GOLANG=
${
WITH_GOLANG
:-
OFF
}
-DWITH_SWIG_PY=ON
-DCUDNN_ROOT=/usr/
-DWITH_STYLE_CHECK=
${
WITH_STYLE_CHECK
:-
OFF
}
...
...
@@ -43,6 +44,7 @@ cmake .. \
-DWITH_DOC
=
OFF
\
-DWITH_GPU
=
${
WITH_GPU
:-
OFF
}
\
-DWITH_AVX
=
${
WITH_AVX
:-
OFF
}
\
-DWITH_GOLANG
=
${
WITH_GOLANG
:-
OFF
}
\
-DWITH_SWIG_PY
=
ON
\
-DCUDNN_ROOT
=
/usr/
\
-DWITH_STYLE_CHECK
=
${
WITH_STYLE_CHECK
:-
OFF
}
\
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录