Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
5fdaa966
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
5fdaa966
编写于
11月 21, 2016
作者:
B
backyes
提交者:
GitHub
11月 21, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #541 from reyoung/feature/fix_diff_type_compare
Fix several cpp issues
上级
42dec297
5e738ca3
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
60 addition
and
43 deletion
+60
-43
paddle/gserver/evaluators/CTCErrorEvaluator.cpp
paddle/gserver/evaluators/CTCErrorEvaluator.cpp
+1
-1
paddle/gserver/evaluators/ChunkEvaluator.cpp
paddle/gserver/evaluators/ChunkEvaluator.cpp
+1
-1
paddle/gserver/evaluators/Evaluator.cpp
paddle/gserver/evaluators/Evaluator.cpp
+3
-3
paddle/gserver/evaluators/Evaluator.h
paddle/gserver/evaluators/Evaluator.h
+8
-8
paddle/gserver/gradientmachines/MultiNetwork.cpp
paddle/gserver/gradientmachines/MultiNetwork.cpp
+1
-1
paddle/gserver/gradientmachines/NeuralNetwork.cpp
paddle/gserver/gradientmachines/NeuralNetwork.cpp
+1
-1
paddle/math/BaseMatrix.cu
paddle/math/BaseMatrix.cu
+10
-10
paddle/math/Vector.cpp
paddle/math/Vector.cpp
+3
-3
paddle/pserver/ParameterServer2.cpp
paddle/pserver/ParameterServer2.cpp
+0
-2
paddle/utils/BarrierStat.cpp
paddle/utils/BarrierStat.cpp
+5
-5
paddle/utils/BarrierStat.h
paddle/utils/BarrierStat.h
+6
-5
paddle/utils/CompilerMacros.h
paddle/utils/CompilerMacros.h
+17
-0
paddle/utils/Logging.cpp
paddle/utils/Logging.cpp
+2
-2
paddle/utils/Logging.h
paddle/utils/Logging.h
+2
-1
未找到文件。
paddle/gserver/evaluators/CTCErrorEvaluator.cpp
浏览文件 @
5fdaa966
...
@@ -240,7 +240,7 @@ public:
...
@@ -240,7 +240,7 @@ public:
seqClassficationError_
=
0
;
seqClassficationError_
=
0
;
}
}
virtual
void
printStats
(
std
::
ostream
&
os
)
{
virtual
void
printStats
(
std
::
ostream
&
os
)
const
{
os
<<
config_
.
name
()
<<
"="
os
<<
config_
.
name
()
<<
"="
<<
(
numSequences_
?
totalScore_
/
numSequences_
:
0
);
<<
(
numSequences_
?
totalScore_
/
numSequences_
:
0
);
os
<<
" deletions error"
os
<<
" deletions error"
...
...
paddle/gserver/evaluators/ChunkEvaluator.cpp
浏览文件 @
5fdaa966
...
@@ -114,7 +114,7 @@ public:
...
@@ -114,7 +114,7 @@ public:
numCorrect_
=
0
;
numCorrect_
=
0
;
}
}
virtual
void
printStats
(
std
::
ostream
&
os
)
{
virtual
void
printStats
(
std
::
ostream
&
os
)
const
{
double
precision
=
(
double
)
numCorrect_
/
numOutputSegments_
;
double
precision
=
(
double
)
numCorrect_
/
numOutputSegments_
;
double
recall
=
(
double
)
numCorrect_
/
numLabelSegments_
;
double
recall
=
(
double
)
numCorrect_
/
numLabelSegments_
;
double
f1
=
double
f1
=
...
...
paddle/gserver/evaluators/Evaluator.cpp
浏览文件 @
5fdaa966
...
@@ -315,7 +315,7 @@ public:
...
@@ -315,7 +315,7 @@ public:
return
0
;
return
0
;
}
}
virtual
void
printStats
(
std
::
ostream
&
os
)
{
virtual
void
printStats
(
std
::
ostream
&
os
)
const
{
CHECK
(
colIdx_
+
(
int32_t
)
colNum_
>=
0
&&
colIdx_
-
(
int32_t
)
colNum_
<
0
)
CHECK
(
colIdx_
+
(
int32_t
)
colNum_
>=
0
&&
colIdx_
-
(
int32_t
)
colNum_
<
0
)
<<
"column index ["
<<
colIdx_
<<
"] out of range [-"
<<
colNum_
<<
", "
<<
"column index ["
<<
colIdx_
<<
"] out of range [-"
<<
colNum_
<<
", "
<<
colNum_
<<
")"
;
<<
colNum_
<<
")"
;
...
@@ -421,7 +421,7 @@ void AucEvaluator::distributeEval(ParameterClient2* client) {
...
@@ -421,7 +421,7 @@ void AucEvaluator::distributeEval(ParameterClient2* client) {
client
->
reduce
(
statNeg_
,
statNeg_
,
kBinNum_
+
1
,
FLAGS_trainer_id
,
0
);
client
->
reduce
(
statNeg_
,
statNeg_
,
kBinNum_
+
1
,
FLAGS_trainer_id
,
0
);
}
}
double
AucEvaluator
::
calcAuc
()
{
double
AucEvaluator
::
calcAuc
()
const
{
double
totPos
=
0.0
;
double
totPos
=
0.0
;
double
totNeg
=
0.0
;
double
totNeg
=
0.0
;
double
totPosPrev
=
0.0
;
double
totPosPrev
=
0.0
;
...
@@ -584,7 +584,7 @@ real PrecisionRecallEvaluator::evalImp(std::vector<Argument>& arguments) {
...
@@ -584,7 +584,7 @@ real PrecisionRecallEvaluator::evalImp(std::vector<Argument>& arguments) {
return
0
;
return
0
;
}
}
void
PrecisionRecallEvaluator
::
printStats
(
std
::
ostream
&
os
)
{
void
PrecisionRecallEvaluator
::
printStats
(
std
::
ostream
&
os
)
const
{
int
label
=
config_
.
positive_label
();
int
label
=
config_
.
positive_label
();
if
(
label
!=
-
1
)
{
if
(
label
!=
-
1
)
{
CHECK
(
label
>=
0
&&
label
<
(
int
)
statsInfo_
.
size
())
CHECK
(
label
>=
0
&&
label
<
(
int
)
statsInfo_
.
size
())
...
...
paddle/gserver/evaluators/Evaluator.h
浏览文件 @
5fdaa966
...
@@ -99,19 +99,19 @@ public:
...
@@ -99,19 +99,19 @@ public:
* @brief print the statistics of evaluate result
* @brief print the statistics of evaluate result
* @note finish() should be called before printStats
* @note finish() should be called before printStats
*/
*/
virtual
void
printStats
(
std
::
ostream
&
os
)
{
virtual
void
printStats
(
std
::
ostream
&
os
)
const
{
os
<<
config_
.
name
()
<<
"="
os
<<
config_
.
name
()
<<
"="
<<
(
numSamples_
?
totalScore_
/
numSamples_
:
0
);
<<
(
numSamples_
?
totalScore_
/
numSamples_
:
0
);
}
}
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
Evaluator
&
evaluator
)
{
const
Evaluator
&
evaluator
)
{
evaluator
.
printStats
(
os
);
evaluator
.
printStats
(
os
);
return
os
;
return
os
;
}
}
friend
std
::
ostream
&&
operator
<<
(
std
::
ostream
&&
os
,
// NOLINT
friend
std
::
ostream
&&
operator
<<
(
std
::
ostream
&&
os
,
// NOLINT
Evaluator
&
evaluator
)
{
const
Evaluator
&
evaluator
)
{
evaluator
.
printStats
(
os
);
evaluator
.
printStats
(
os
);
return
std
::
move
(
os
);
return
std
::
move
(
os
);
}
}
...
@@ -135,7 +135,7 @@ public:
...
@@ -135,7 +135,7 @@ public:
return
-
1
;
return
-
1
;
}
}
virtual
void
finish
()
{}
virtual
void
finish
()
{}
virtual
void
printStats
(
std
::
ostream
&
)
{}
virtual
void
printStats
(
std
::
ostream
&
)
const
{}
};
};
/**
/**
* @brief evaluate AUC using colIdx-th column as prediction.
* @brief evaluate AUC using colIdx-th column as prediction.
...
@@ -165,7 +165,7 @@ public:
...
@@ -165,7 +165,7 @@ public:
virtual
real
evalImp
(
std
::
vector
<
Argument
>&
arguments
);
virtual
real
evalImp
(
std
::
vector
<
Argument
>&
arguments
);
virtual
void
printStats
(
std
::
ostream
&
os
)
{
virtual
void
printStats
(
std
::
ostream
&
os
)
const
{
os
<<
config_
.
name
()
<<
"="
<<
calcAuc
();
os
<<
config_
.
name
()
<<
"="
<<
calcAuc
();
}
}
...
@@ -189,7 +189,7 @@ private:
...
@@ -189,7 +189,7 @@ private:
return
(
X1
>
X2
?
(
X1
-
X2
)
:
(
X2
-
X1
))
*
(
Y1
+
Y2
)
/
2.0
;
return
(
X1
>
X2
?
(
X1
-
X2
)
:
(
X2
-
X1
))
*
(
Y1
+
Y2
)
/
2.0
;
}
}
double
calcAuc
();
double
calcAuc
()
const
;
};
};
/**
/**
...
@@ -244,7 +244,7 @@ public:
...
@@ -244,7 +244,7 @@ public:
virtual
real
evalImp
(
std
::
vector
<
Argument
>&
arguments
);
virtual
real
evalImp
(
std
::
vector
<
Argument
>&
arguments
);
virtual
void
printStats
(
std
::
ostream
&
os
);
virtual
void
printStats
(
std
::
ostream
&
os
)
const
;
virtual
void
distributeEval
(
ParameterClient2
*
client
);
virtual
void
distributeEval
(
ParameterClient2
*
client
);
...
@@ -339,7 +339,7 @@ public:
...
@@ -339,7 +339,7 @@ public:
virtual
void
finish
()
{
calc
(
predictArray_
);
}
virtual
void
finish
()
{
calc
(
predictArray_
);
}
virtual
void
printStats
(
std
::
ostream
&
os
)
{
virtual
void
printStats
(
std
::
ostream
&
os
)
const
{
os
<<
" pos/neg"
os
<<
" pos/neg"
<<
"="
<<
pairArray_
[
0
]
/
((
pairArray_
[
1
]
<=
0
)
?
1.0
:
pairArray_
[
1
]);
<<
"="
<<
pairArray_
[
0
]
/
((
pairArray_
[
1
]
<=
0
)
?
1.0
:
pairArray_
[
1
]);
}
}
...
...
paddle/gserver/gradientmachines/MultiNetwork.cpp
浏览文件 @
5fdaa966
...
@@ -154,7 +154,7 @@ public:
...
@@ -154,7 +154,7 @@ public:
return
-
1
;
return
-
1
;
}
}
virtual
void
printStats
(
std
::
ostream
&
os
)
{
virtual
void
printStats
(
std
::
ostream
&
os
)
const
{
for
(
auto
&
evaluator
:
evaluators_
)
{
for
(
auto
&
evaluator
:
evaluators_
)
{
evaluator
->
printStats
(
os
);
evaluator
->
printStats
(
os
);
os
<<
' '
;
os
<<
' '
;
...
...
paddle/gserver/gradientmachines/NeuralNetwork.cpp
浏览文件 @
5fdaa966
...
@@ -325,7 +325,7 @@ public:
...
@@ -325,7 +325,7 @@ public:
(
void
)
arguments
;
(
void
)
arguments
;
return
-
1
;
return
-
1
;
}
}
virtual
void
printStats
(
std
::
ostream
&
os
)
{
virtual
void
printStats
(
std
::
ostream
&
os
)
const
{
for
(
auto
&
evaluator
:
evaluators_
)
{
for
(
auto
&
evaluator
:
evaluators_
)
{
evaluator
->
printStats
(
os
);
evaluator
->
printStats
(
os
);
os
<<
' '
;
os
<<
' '
;
...
...
paddle/math/BaseMatrix.cu
浏览文件 @
5fdaa966
...
@@ -1449,8 +1449,8 @@ template<>
...
@@ -1449,8 +1449,8 @@ template<>
template
<
class
Agg
>
template
<
class
Agg
>
int
BaseMatrixT
<
real
>::
applyRow
(
Agg
agg
,
BaseMatrixT
&
b
)
{
int
BaseMatrixT
<
real
>::
applyRow
(
Agg
agg
,
BaseMatrixT
&
b
)
{
MatrixOffset
offset
(
0
,
0
,
0
,
0
,
0
,
0
);
MatrixOffset
offset
(
0
,
0
,
0
,
0
,
0
,
0
);
in
t
numRows
=
b
.
height_
;
size_
t
numRows
=
b
.
height_
;
in
t
numCols
=
b
.
width_
;
size_
t
numCols
=
b
.
width_
;
CHECK_EQ
(
height_
,
numRows
);
CHECK_EQ
(
height_
,
numRows
);
CHECK_EQ
(
width_
,
1UL
);
CHECK_EQ
(
width_
,
1UL
);
aggregate
(
agg
,
base
::
unary
::
identity
(),
base
::
binary
::
second
(),
b
,
numRows
,
aggregate
(
agg
,
base
::
unary
::
identity
(),
base
::
binary
::
second
(),
b
,
numRows
,
...
@@ -1463,8 +1463,8 @@ template<>
...
@@ -1463,8 +1463,8 @@ template<>
template
<
class
Agg
,
class
Saver
>
template
<
class
Agg
,
class
Saver
>
int
BaseMatrixT
<
real
>::
applyRow
(
Agg
agg
,
Saver
sv
,
BaseMatrixT
&
b
)
{
int
BaseMatrixT
<
real
>::
applyRow
(
Agg
agg
,
Saver
sv
,
BaseMatrixT
&
b
)
{
MatrixOffset
offset
(
0
,
0
,
0
,
0
,
0
,
0
);
MatrixOffset
offset
(
0
,
0
,
0
,
0
,
0
,
0
);
in
t
numRows
=
b
.
height_
;
size_
t
numRows
=
b
.
height_
;
in
t
numCols
=
b
.
width_
;
size_
t
numCols
=
b
.
width_
;
CHECK_EQ
(
height_
,
numRows
);
CHECK_EQ
(
height_
,
numRows
);
CHECK_EQ
(
width_
,
1UL
);
CHECK_EQ
(
width_
,
1UL
);
aggregate
(
agg
,
base
::
unary
::
identity
(),
sv
,
b
,
numRows
,
numCols
,
offset
,
aggregate
(
agg
,
base
::
unary
::
identity
(),
sv
,
b
,
numRows
,
numCols
,
offset
,
...
@@ -1493,8 +1493,8 @@ template <class Agg, class Op, class Saver>
...
@@ -1493,8 +1493,8 @@ template <class Agg, class Op, class Saver>
int
BaseMatrixT
<
real
>::
applyRow
(
Agg
agg
,
Op
op
,
Saver
sv
,
int
BaseMatrixT
<
real
>::
applyRow
(
Agg
agg
,
Op
op
,
Saver
sv
,
BaseMatrixT
&
b
,
BaseMatrixT
&
c
)
{
BaseMatrixT
&
b
,
BaseMatrixT
&
c
)
{
MatrixOffset
offset
(
0
,
0
,
0
,
0
,
0
,
0
);
MatrixOffset
offset
(
0
,
0
,
0
,
0
,
0
,
0
);
in
t
numRows
=
b
.
height_
;
size_
t
numRows
=
b
.
height_
;
in
t
numCols
=
b
.
width_
;
size_
t
numCols
=
b
.
width_
;
CHECK_EQ
(
height_
,
numRows
);
CHECK_EQ
(
height_
,
numRows
);
CHECK_EQ
(
width_
,
1UL
);
CHECK_EQ
(
width_
,
1UL
);
CHECK_EQ
(
c
.
height_
,
numRows
);
CHECK_EQ
(
c
.
height_
,
numRows
);
...
@@ -1524,8 +1524,8 @@ template<>
...
@@ -1524,8 +1524,8 @@ template<>
template
<
class
Agg
>
template
<
class
Agg
>
int
BaseMatrixT
<
real
>::
applyCol
(
Agg
agg
,
BaseMatrixT
&
b
)
{
int
BaseMatrixT
<
real
>::
applyCol
(
Agg
agg
,
BaseMatrixT
&
b
)
{
MatrixOffset
offset
(
0
,
0
,
0
,
0
,
0
,
0
);
MatrixOffset
offset
(
0
,
0
,
0
,
0
,
0
,
0
);
in
t
numRows
=
b
.
height_
;
size_
t
numRows
=
b
.
height_
;
in
t
numCols
=
b
.
width_
;
size_
t
numCols
=
b
.
width_
;
CHECK_EQ
(
width_
,
numCols
);
CHECK_EQ
(
width_
,
numCols
);
CHECK_EQ
(
height_
,
1UL
);
CHECK_EQ
(
height_
,
1UL
);
aggregate
(
agg
,
base
::
unary
::
identity
(),
base
::
binary
::
second
(),
b
,
numRows
,
aggregate
(
agg
,
base
::
unary
::
identity
(),
base
::
binary
::
second
(),
b
,
numRows
,
...
@@ -1538,8 +1538,8 @@ template<>
...
@@ -1538,8 +1538,8 @@ template<>
template
<
class
Agg
,
class
Saver
>
template
<
class
Agg
,
class
Saver
>
int
BaseMatrixT
<
real
>::
applyCol
(
Agg
agg
,
Saver
sv
,
BaseMatrixT
&
b
)
{
int
BaseMatrixT
<
real
>::
applyCol
(
Agg
agg
,
Saver
sv
,
BaseMatrixT
&
b
)
{
MatrixOffset
offset
(
0
,
0
,
0
,
0
,
0
,
0
);
MatrixOffset
offset
(
0
,
0
,
0
,
0
,
0
,
0
);
in
t
numRows
=
b
.
height_
;
size_
t
numRows
=
b
.
height_
;
in
t
numCols
=
b
.
width_
;
size_
t
numCols
=
b
.
width_
;
CHECK_EQ
(
width_
,
numCols
);
CHECK_EQ
(
width_
,
numCols
);
CHECK_EQ
(
height_
,
1UL
);
CHECK_EQ
(
height_
,
1UL
);
aggregate
(
agg
,
base
::
unary
::
identity
(),
sv
,
b
,
numRows
,
numCols
,
offset
,
aggregate
(
agg
,
base
::
unary
::
identity
(),
sv
,
b
,
numRows
,
numCols
,
offset
,
...
...
paddle/math/Vector.cpp
浏览文件 @
5fdaa966
...
@@ -82,8 +82,8 @@ MatrixPtr VectorT<real>::toOneHotSparseMatrix(size_t idRange, bool useGpu) {
...
@@ -82,8 +82,8 @@ MatrixPtr VectorT<real>::toOneHotSparseMatrix(size_t idRange, bool useGpu) {
template
<
>
template
<
>
MatrixPtr
VectorT
<
int
>::
toOneHotSparseMatrix
(
size_t
idRange
,
bool
useGpu
)
{
MatrixPtr
VectorT
<
int
>::
toOneHotSparseMatrix
(
size_t
idRange
,
bool
useGpu
)
{
in
t
height
=
getSize
();
size_
t
height
=
getSize
();
in
t
width
=
idRange
;
size_
t
width
=
idRange
;
MatrixPtr
mat
=
Matrix
::
createSparseMatrix
(
MatrixPtr
mat
=
Matrix
::
createSparseMatrix
(
height
,
idRange
,
height
,
NO_VALUE
,
SPARSE_CSR
,
false
,
useGpu
);
height
,
idRange
,
height
,
NO_VALUE
,
SPARSE_CSR
,
false
,
useGpu
);
...
@@ -91,7 +91,7 @@ MatrixPtr VectorT<int>::toOneHotSparseMatrix(size_t idRange, bool useGpu) {
...
@@ -91,7 +91,7 @@ MatrixPtr VectorT<int>::toOneHotSparseMatrix(size_t idRange, bool useGpu) {
cpuIds
.
copyFrom
(
*
this
);
cpuIds
.
copyFrom
(
*
this
);
int
*
idData
=
cpuIds
.
getData
();
int
*
idData
=
cpuIds
.
getData
();
for
(
int
i
=
0
;
i
<
height
;
i
++
)
{
for
(
decltype
(
height
)
i
=
0
;
i
<
height
;
i
++
)
{
const
unsigned
int
id
=
idData
[
i
];
const
unsigned
int
id
=
idData
[
i
];
CHECK_LT
(
id
,
width
);
CHECK_LT
(
id
,
width
);
mat
->
setRow
(
i
,
1
,
&
id
,
nullptr
);
mat
->
setRow
(
i
,
1
,
&
id
,
nullptr
);
...
...
paddle/pserver/ParameterServer2.cpp
浏览文件 @
5fdaa966
...
@@ -1469,7 +1469,6 @@ void ParameterServer2::waitPassFinish(const WaitPassFinishRequest& request,
...
@@ -1469,7 +1469,6 @@ void ParameterServer2::waitPassFinish(const WaitPassFinishRequest& request,
void
ParameterServer2
::
synchronize
(
const
SynchronizeRequest
&
request
,
void
ParameterServer2
::
synchronize
(
const
SynchronizeRequest
&
request
,
ProtoResponseCallback
callback
)
{
ProtoResponseCallback
callback
)
{
CHECK_LT
(
request
.
sync_object_id
(),
SyncObject_ARRAYSIZE
);
synchronizeBarriers_
[
request
.
sync_object_id
()]
->
wait
();
synchronizeBarriers_
[
request
.
sync_object_id
()]
->
wait
();
dataSize_
=
0
;
dataSize_
=
0
;
callback
(
SynchronizeResponse
());
callback
(
SynchronizeResponse
());
...
@@ -1477,7 +1476,6 @@ void ParameterServer2::synchronize(const SynchronizeRequest& request,
...
@@ -1477,7 +1476,6 @@ void ParameterServer2::synchronize(const SynchronizeRequest& request,
void
ParameterServer2
::
asyncFinishPass
(
const
SynchronizeRequest
&
request
,
void
ParameterServer2
::
asyncFinishPass
(
const
SynchronizeRequest
&
request
,
ProtoResponseCallback
callback
)
{
ProtoResponseCallback
callback
)
{
CHECK_LT
(
request
.
sync_object_id
(),
SyncObject_ARRAYSIZE
);
synchronizeBarriers_
[
request
.
sync_object_id
()]
->
wait
();
synchronizeBarriers_
[
request
.
sync_object_id
()]
->
wait
();
callback
(
SynchronizeResponse
());
callback
(
SynchronizeResponse
());
...
...
paddle/utils/BarrierStat.cpp
浏览文件 @
5fdaa966
...
@@ -29,10 +29,10 @@ P_DEFINE_bool(log_barrier_show_log, false, // for performance tuning insight
...
@@ -29,10 +29,10 @@ P_DEFINE_bool(log_barrier_show_log, false, // for performance tuning insight
namespace
paddle
{
namespace
paddle
{
std
::
ostream
&
operator
<<
(
std
::
ostream
&
output
,
BarrierStatBase
&
stat
)
{
std
::
ostream
&
operator
<<
(
std
::
ostream
&
output
,
const
BarrierStatBase
&
stat
)
{
if
(
FLAGS_log_barrier_abstract
)
{
if
(
FLAGS_log_barrier_abstract
)
{
std
::
lock_guard
<
std
::
mutex
>
guard
(
std
::
lock_guard
<
std
::
mutex
>
guard
(
stat
.
lock_
);
const_cast
<
BarrierStatBase
&>
(
stat
).
lock_
);
stat
.
showAbstract
(
output
);
stat
.
showAbstract
(
output
);
}
}
return
output
;
return
output
;
...
@@ -136,7 +136,7 @@ void BarrierEndStat::reset(bool clearRawData) {
...
@@ -136,7 +136,7 @@ void BarrierEndStat::reset(bool clearRawData) {
totAbstract_
.
minDelta
=
UINT64_MAX
;
totAbstract_
.
minDelta
=
UINT64_MAX
;
}
}
void
BarrierEndStat
::
showAbstract
(
std
::
ostream
&
output
)
{
void
BarrierEndStat
::
showAbstract
(
std
::
ostream
&
output
)
const
{
// do not support the case "<=2 pserver"
// do not support the case "<=2 pserver"
if
(
numConnThreads_
<=
2
||
!
totSamples_
)
{
if
(
numConnThreads_
<=
2
||
!
totSamples_
)
{
return
;
return
;
...
@@ -272,7 +272,7 @@ void BarrierDeltaStat::reset(bool clearRawData) {
...
@@ -272,7 +272,7 @@ void BarrierDeltaStat::reset(bool clearRawData) {
totAbstract_
.
minDelta
=
UINT64_MAX
;
totAbstract_
.
minDelta
=
UINT64_MAX
;
}
}
void
BarrierDeltaStat
::
showAbstract
(
std
::
ostream
&
output
)
{
void
BarrierDeltaStat
::
showAbstract
(
std
::
ostream
&
output
)
const
{
// do not support the case "<=2 pserver"
// do not support the case "<=2 pserver"
if
(
numConnThreads_
<=
2
||
!
totSamples_
)
{
if
(
numConnThreads_
<=
2
||
!
totSamples_
)
{
return
;
return
;
...
...
paddle/utils/BarrierStat.h
浏览文件 @
5fdaa966
...
@@ -218,11 +218,12 @@ public:
...
@@ -218,11 +218,12 @@ public:
}
}
protected:
protected:
virtual
void
showAbstract
(
std
::
ostream
&
output
)
{}
virtual
void
showAbstract
(
std
::
ostream
&
output
)
const
{}
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
output
,
BarrierStatBase
&
stat
);
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
output
,
const
BarrierStatBase
&
stat
);
protected:
protected:
std
::
mutex
lock_
;
mutable
std
::
mutex
lock_
;
std
::
mutex
abstractLock_
;
// see note on updaterStat
std
::
mutex
abstractLock_
;
// see note on updaterStat
// each freqency for each barrier trainer
// each freqency for each barrier trainer
std
::
vector
<
struct
Abstract
>
abstract_
;
std
::
vector
<
struct
Abstract
>
abstract_
;
...
@@ -262,7 +263,7 @@ protected:
...
@@ -262,7 +263,7 @@ protected:
* log_barrier_abstract, log_barrier_lowest_nodes, log_barrier_threshold
* log_barrier_abstract, log_barrier_lowest_nodes, log_barrier_threshold
* control details.
* control details.
*/
*/
virtual
void
showAbstract
(
std
::
ostream
&
output
);
virtual
void
showAbstract
(
std
::
ostream
&
output
)
const
;
private:
private:
std
::
unique_ptr
<
TimeVectorEnd
>
timeVector_
;
std
::
unique_ptr
<
TimeVectorEnd
>
timeVector_
;
...
@@ -286,7 +287,7 @@ public:
...
@@ -286,7 +287,7 @@ public:
virtual
bool
checkPassBarrier
()
{
return
timeVector_
->
empty
();
}
virtual
bool
checkPassBarrier
()
{
return
timeVector_
->
empty
();
}
protected:
protected:
virtual
void
showAbstract
(
std
::
ostream
&
outPut
);
virtual
void
showAbstract
(
std
::
ostream
&
outPut
)
const
;
private:
private:
// store delta time in uint64_t, eg BP time of all trainers
// store delta time in uint64_t, eg BP time of all trainers
...
...
paddle/utils/CompilerMacros.h
0 → 100644
浏览文件 @
5fdaa966
/* Copyright (c) 2016 Baidu, Inc. 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
#define ATTR_NORETURN __attribute__((noreturn))
paddle/utils/Logging.cpp
浏览文件 @
5fdaa966
...
@@ -134,7 +134,7 @@ static void initializeLogFds(char* argv0) {
...
@@ -134,7 +134,7 @@ static void initializeLogFds(char* argv0) {
gLogInited
=
true
;
gLogInited
=
true
;
}
}
static
void
(
*
gFailureFunctionPtr
)()
__attribute__
((
noreturn
))
=
abort
;
static
void
(
*
gFailureFunctionPtr
)()
ATTR_NORETURN
=
abort
;
LogMessage
::
LogMessage
(
const
char
*
fname
,
int
line
,
int
severity
)
LogMessage
::
LogMessage
(
const
char
*
fname
,
int
line
,
int
severity
)
:
fname_
(
fname
),
line_
(
line
),
severity_
(
severity
)
{}
:
fname_
(
fname
),
line_
(
line
),
severity_
(
severity
)
{}
...
@@ -171,7 +171,7 @@ void setMinLogLevel(int level) {
...
@@ -171,7 +171,7 @@ void setMinLogLevel(int level) {
paddle
::
internal
::
gMinLogLevel
=
level
;
paddle
::
internal
::
gMinLogLevel
=
level
;
}
}
void
installFailureFunction
(
void
(
*
callback
)())
{
void
installFailureFunction
(
void
(
*
callback
)()
ATTR_NORETURN
)
{
paddle
::
internal
::
gFailureFunctionPtr
=
callback
;
paddle
::
internal
::
gFailureFunctionPtr
=
callback
;
}
}
...
...
paddle/utils/Logging.h
浏览文件 @
5fdaa966
...
@@ -23,6 +23,7 @@ limitations under the License. */
...
@@ -23,6 +23,7 @@ limitations under the License. */
#include <string>
#include <string>
#ifndef PADDLE_USE_GLOG
#ifndef PADDLE_USE_GLOG
#include "CompilerMacros.h"
//! TODO(yuyang18): Move this utility macro into some global header.
//! TODO(yuyang18): Move this utility macro into some global header.
#define PP_CAT(a, b) PP_CAT_I(a, b)
#define PP_CAT(a, b) PP_CAT_I(a, b)
...
@@ -168,7 +169,7 @@ void setMinLogLevel(int level);
...
@@ -168,7 +169,7 @@ void setMinLogLevel(int level);
* @brief Install Log(Fatal) failure function. Default is abort();
* @brief Install Log(Fatal) failure function. Default is abort();
* @param callback: The failure function.
* @param callback: The failure function.
*/
*/
void
installFailureFunction
(
void
(
*
callback
)());
void
installFailureFunction
(
void
(
*
callback
)()
ATTR_NORETURN
);
/**
/**
* @brief installFailureWriter
* @brief installFailureWriter
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录