Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
12e2402f
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
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看板
提交
12e2402f
编写于
3月 23, 2017
作者:
L
Liu Yiqun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Disable SpinLock and ThreadBarrier.
上级
2a601e02
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
47 addition
and
11 deletion
+47
-11
paddle/gserver/tests/LayerGradUtil.cpp
paddle/gserver/tests/LayerGradUtil.cpp
+4
-2
paddle/math/MathFunctions.cpp
paddle/math/MathFunctions.cpp
+3
-3
paddle/utils/arch/linux/Locks.cpp
paddle/utils/arch/linux/Locks.cpp
+40
-6
未找到文件。
paddle/gserver/tests/LayerGradUtil.cpp
浏览文件 @
12e2402f
...
...
@@ -778,8 +778,10 @@ void testProjectionGrad(ProjectionConfig conf,
config
.
biasSize
=
biasSize
==
0
?
config
.
layerConfig
.
size
()
:
biasSize
;
config
.
layerConfig
.
set_bias_size
(
config
.
biasSize
);
config
.
layerConfig
.
set_shared_biases
(
sharedBias
);
config
.
inputDefs
.
push_back
(
{
inputType
,
"layer_0"
,
conf
.
input_size
(),
parameterSize
});
config
.
inputDefs
.
push_back
({
inputType
,
"layer_0"
,
static_cast
<
size_t
>
(
conf
.
input_size
()),
parameterSize
});
*
config
.
layerConfig
.
add_inputs
()
->
mutable_proj_conf
()
=
conf
;
config
.
testState
=
testState
;
testLayerGrad
(
config
,
"mixed"
,
batchSize
,
false
,
useGpu
);
...
...
paddle/math/MathFunctions.cpp
浏览文件 @
12e2402f
...
...
@@ -111,7 +111,7 @@ int getrf<double>(const CBLAS_ORDER order,
return
LAPACKE_dgetrf
(
order
,
M
,
N
,
A
,
lda
,
ipiv
);
#endif
#else
LOG
(
FATAL
)
<<
"Not implemented"
.
LOG
(
FATAL
)
<<
"Not implemented"
;
#endif
return
0
;
}
...
...
@@ -129,7 +129,7 @@ int getri<float>(const CBLAS_ORDER order,
return
LAPACKE_sgetri
(
order
,
N
,
A
,
lda
,
ipiv
);
#endif
#else
LOG
(
FATAL
)
<<
"Not implemented"
.
LOG
(
FATAL
)
<<
"Not implemented"
;
#endif
return
0
;
}
...
...
@@ -147,7 +147,7 @@ int getri<double>(const CBLAS_ORDER order,
return
LAPACKE_dgetri
(
order
,
N
,
A
,
lda
,
ipiv
);
#endif
#else
LOG
(
FATAL
)
<<
"Not implemented"
.
LOG
(
FATAL
)
<<
"Not implemented"
;
#endif
return
0
;
}
...
...
paddle/utils/arch/linux/Locks.cpp
浏览文件 @
12e2402f
...
...
@@ -38,34 +38,68 @@ void Semaphore::post() { sem_post(&m->sem); }
class
SpinLockPrivate
{
public:
inline
SpinLockPrivate
()
{
pthread_spin_init
(
&
lock_
,
0
);
}
inline
~
SpinLockPrivate
()
{
pthread_spin_destroy
(
&
lock_
);
}
inline
SpinLockPrivate
()
{
#ifndef __ANDROID__
pthread_spin_init
(
&
lock_
,
0
);
#else
lock_
=
0
;
#endif
}
inline
~
SpinLockPrivate
()
{
#ifndef __ANDROID__
pthread_spin_destroy
(
&
lock_
);
#endif
}
#ifndef __ANDROID__
pthread_spinlock_t
lock_
;
char
padding_
[
64
-
sizeof
(
pthread_spinlock_t
)];
#else
unsigned
long
lock_
;
#endif
char
padding_
[
64
-
sizeof
(
lock_
)];
};
SpinLock
::
SpinLock
()
:
m
(
new
SpinLockPrivate
())
{}
SpinLock
::~
SpinLock
()
{
delete
m
;
}
void
SpinLock
::
lock
()
{
pthread_spin_lock
(
&
m
->
lock_
);
}
void
SpinLock
::
lock
()
{
#ifndef __ANDROID__
pthread_spin_lock
(
&
m
->
lock_
);
#endif
}
void
SpinLock
::
unlock
()
{
pthread_spin_unlock
(
&
m
->
lock_
);
}
void
SpinLock
::
unlock
()
{
#ifndef __ANDROID__
pthread_spin_unlock
(
&
m
->
lock_
);
#endif
}
class
ThreadBarrierPrivate
{
public:
#ifndef __ANDROID__
pthread_barrier_t
barrier_
;
#else
unsigned
long
barrier_
;
#endif
};
ThreadBarrier
::
ThreadBarrier
(
int
count
)
:
m
(
new
ThreadBarrierPrivate
())
{
#ifndef __ANDROID__
pthread_barrier_init
(
&
m
->
barrier_
,
nullptr
,
count
);
#endif
}
ThreadBarrier
::~
ThreadBarrier
()
{
#ifndef __ANDROID__
pthread_barrier_destroy
(
&
m
->
barrier_
);
#endif
delete
m
;
}
void
ThreadBarrier
::
wait
()
{
pthread_barrier_wait
(
&
m
->
barrier_
);
}
void
ThreadBarrier
::
wait
()
{
#ifndef __ANDROID__
pthread_barrier_wait
(
&
m
->
barrier_
);
#endif
}
}
// namespace paddle
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录