Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
f27fd9dc
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f27fd9dc
编写于
5月 02, 2017
作者:
L
liaogang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
follow comments
上级
8cde2d11
变更
46
隐藏空白更改
内联
并排
Showing
46 changed file
with
222 addition
and
251 deletion
+222
-251
cmake/cblas.cmake
cmake/cblas.cmake
+0
-3
cmake/external/openblas.cmake
cmake/external/openblas.cmake
+0
-2
paddle/cuda/include/hl_activation_functions.h
paddle/cuda/include/hl_activation_functions.h
+3
-3
paddle/cuda/include/hl_cnn.h
paddle/cuda/include/hl_cnn.h
+17
-17
paddle/cuda/src/hl_cuda_cublas.cc
paddle/cuda/src/hl_cuda_cublas.cc
+1
-1
paddle/cuda/src/hl_cuda_cudnn.cc
paddle/cuda/src/hl_cuda_cudnn.cc
+1
-1
paddle/cuda/src/hl_cuda_device.cc
paddle/cuda/src/hl_cuda_device.cc
+1
-1
paddle/cuda/src/hl_warpctc_wrap.cc
paddle/cuda/src/hl_warpctc_wrap.cc
+1
-1
paddle/function/BufferArgTest.cpp
paddle/function/BufferArgTest.cpp
+1
-1
paddle/function/CosSimOp.cpp
paddle/function/CosSimOp.cpp
+6
-6
paddle/function/FunctionTest.cpp
paddle/function/FunctionTest.cpp
+1
-1
paddle/function/MulOpTest.cpp
paddle/function/MulOpTest.cpp
+9
-9
paddle/function/TensorShapeTest.cpp
paddle/function/TensorShapeTest.cpp
+1
-1
paddle/function/TensorTypeTest.cpp
paddle/function/TensorTypeTest.cpp
+1
-1
paddle/gserver/dataproviders/PyDataProvider.cpp
paddle/gserver/dataproviders/PyDataProvider.cpp
+2
-2
paddle/gserver/evaluators/Evaluator.cpp
paddle/gserver/evaluators/Evaluator.cpp
+3
-3
paddle/gserver/gradientmachines/GradientMachine.cpp
paddle/gserver/gradientmachines/GradientMachine.cpp
+0
-1
paddle/gserver/gradientmachines/RecurrentGradientMachine.cpp
paddle/gserver/gradientmachines/RecurrentGradientMachine.cpp
+1
-1
paddle/gserver/gradientmachines/RecurrentGradientMachine.h
paddle/gserver/gradientmachines/RecurrentGradientMachine.h
+15
-15
paddle/gserver/layers/Layer.cpp
paddle/gserver/layers/Layer.cpp
+3
-2
paddle/gserver/layers/Layer.h
paddle/gserver/layers/Layer.h
+6
-6
paddle/gserver/layers/RotateLayer.h
paddle/gserver/layers/RotateLayer.h
+1
-1
paddle/gserver/layers/SequencePoolLayer.cpp
paddle/gserver/layers/SequencePoolLayer.cpp
+1
-1
paddle/gserver/tests/test_RecurrentLayer.cpp
paddle/gserver/tests/test_RecurrentLayer.cpp
+20
-19
paddle/math/MathFunctions.cpp
paddle/math/MathFunctions.cpp
+23
-55
paddle/math/MathFunctions.h
paddle/math/MathFunctions.h
+0
-4
paddle/math/MatrixBitCode.cpp
paddle/math/MatrixBitCode.cpp
+16
-14
paddle/math/tests/TensorCheck.h
paddle/math/tests/TensorCheck.h
+2
-2
paddle/math/tests/TestUtils.h
paddle/math/tests/TestUtils.h
+1
-1
paddle/math/tests/test_SIMDFunctions.cpp
paddle/math/tests/test_SIMDFunctions.cpp
+9
-9
paddle/math/tests/test_matrixCompare.cpp
paddle/math/tests/test_matrixCompare.cpp
+10
-4
paddle/parameter/Argument.cpp
paddle/parameter/Argument.cpp
+26
-24
paddle/parameter/AverageOptimizer.cpp
paddle/parameter/AverageOptimizer.cpp
+3
-2
paddle/parameter/FirstOrderOptimizer.h
paddle/parameter/FirstOrderOptimizer.h
+1
-1
paddle/parameter/Parameter.cpp
paddle/parameter/Parameter.cpp
+2
-2
paddle/pserver/LightNetwork.cpp
paddle/pserver/LightNetwork.cpp
+2
-2
paddle/pserver/ParameterClient2.cpp
paddle/pserver/ParameterClient2.cpp
+6
-6
paddle/pserver/ParameterServer2.cpp
paddle/pserver/ParameterServer2.cpp
+2
-2
paddle/pserver/ParameterServer2.h
paddle/pserver/ParameterServer2.h
+4
-4
paddle/pserver/ProtoServer.cpp
paddle/pserver/ProtoServer.cpp
+2
-2
paddle/trainer/TrainerInternal.cpp
paddle/trainer/TrainerInternal.cpp
+1
-1
paddle/trainer/tests/picojson.h
paddle/trainer/tests/picojson.h
+2
-2
paddle/utils/BarrierStat.h
paddle/utils/BarrierStat.h
+8
-8
paddle/utils/ClassRegistrar.h
paddle/utils/ClassRegistrar.h
+2
-2
paddle/utils/DynamicLoader.cpp
paddle/utils/DynamicLoader.cpp
+4
-4
paddle/utils/DynamicLoader.h
paddle/utils/DynamicLoader.h
+1
-1
未找到文件。
cmake/cblas.cmake
浏览文件 @
f27fd9dc
...
...
@@ -44,7 +44,6 @@ if(MKL_INC_DIR AND MKL_CORE_LIB AND MKL_SEQUENTIAL_LIB AND MKL_INTEL_LP64)
message
(
STATUS
"Found MKL (include:
${
CBLAS_INC_DIR
}
, library:
${
CBLAS_LIBRARIES
}
)"
)
set
(
CBLAS_FOUND ON
)
if
(
${
MKL_LAPACK_INC_DIR
}
)
add_definitions
(
-DPADDLE_USE_LAPACK
)
message
(
STATUS
"Found lapack in MKL (include:
${
MKL_LAPACK_INC_DIR
}
)"
)
endif
()
return
()
# return file.
...
...
@@ -80,7 +79,6 @@ if(ATLAS_INC_DIR AND ATLAS_CBLAS_LIB AND ATLAS_LIB AND NOT CBLAS_FOUND)
message
(
STATUS
"Found ATLAS (include:
${
CBLAS_INC_DIR
}
, library:
${
CBLAS_LIBRARIES
}
)"
)
set
(
CBLAS_FOUND ON
)
if
(
ATLAS_CLAPACK_INC_DIR
)
add_definitions
(
-DPADDLE_USE_LAPACK
)
message
(
STATUS
"Found lapack in ATLAS (include:
${
ATLAS_CLAPACK_INC_DIR
}
)"
)
endif
()
return
()
...
...
@@ -114,7 +112,6 @@ if(OPENBLAS_INC_DIR AND OPENBLAS_LIB)
message
(
STATUS
"Found OpenBLAS (include:
${
CBLAS_INC_DIR
}
, library:
${
CBLAS_LIBRARIES
}
)"
)
set
(
CBLAS_FOUND ON
)
if
(
OPENBLAS_LAPACKE_INC_DIR
)
add_definitions
(
-DPADDLE_USE_LAPACK
)
message
(
STATUS
"Found lapack in OpenBLAS (include:
${
OPENBLAS_LAPACKE_INC_DIR
}
)"
)
endif
()
return
()
...
...
cmake/external/openblas.cmake
浏览文件 @
f27fd9dc
...
...
@@ -27,8 +27,6 @@ IF(NOT ${CBLAS_FOUND})
SET
(
CBLAS_LIBRARIES
"
${
CBLAS_INSTALL_DIR
}
/lib/libopenblas.a"
CACHE FILEPATH
"openblas library"
FORCE
)
ENDIF
(
WIN32
)
ADD_DEFINITIONS
(
-DPADDLE_USE_LAPACK
)
ExternalProject_Add
(
openblas
${
EXTERNAL_PROJECT_LOG_ARGS
}
...
...
paddle/cuda/include/hl_activation_functions.h
浏览文件 @
f27fd9dc
...
...
@@ -40,18 +40,18 @@ public:
namespace
gpu
{
static
__device__
Active
<
real
>::
forward
forward
[]
=
HPPL_ACTIVE_FUNCTION
;
static
__device__
Active
<
real
>::
backward
backward
[]
=
HPPL_ACTIVE_FUNCTION
;
}
}
// namespace gpu
#else
namespace
cpu
{
static
Active
<
real
>::
forward
forward
[]
=
HPPL_ACTIVE_FUNCTION
;
static
Active
<
real
>::
backward
backward
[]
=
HPPL_ACTIVE_FUNCTION
;
}
}
// namespace cpu
#ifdef __AVX__
namespace
avx
{
static
Active
<
__m256
>::
forward
forward
[]
=
HPPL_ACTIVE_FUNCTION
;
static
Active
<
__m256
>::
backward
backward
[]
=
HPPL_ACTIVE_FUNCTION
;
}
}
// namespace avx
#endif
#endif
...
...
paddle/cuda/include/hl_cnn.h
浏览文件 @
f27fd9dc
...
...
@@ -273,23 +273,23 @@ extern void hl_bilinear_forward(const real* inData,
const
real
ratioW
);
/**
* @brief Bilinear interpolation backward.
*
* @param[out] inGrad input gradient.
* @param[in] inImgH input image height.
* @param[in] inImgW input image width.
* @param[in] inputH input batchSize.
* @param[in] inputW input image data dim.
* @param[in] outGrad output gradient.
* @param[in] outImgH output image height.
* @param[in] outImgW output image width.
* @param[in] outputH output batchSize.
* @param[in] outputW output image data dim.
* @param[in] numChannels number of channels.
* @param[in] ratioH inImgH / outImgH.
* @param[in] ratioW inImgW / outImgW.
*
*/
* @brief Bilinear interpolation backward.
*
* @param[out] inGrad input gradient.
* @param[in] inImgH input image height.
* @param[in] inImgW input image width.
* @param[in] inputH input batchSize.
* @param[in] inputW input image data dim.
* @param[in] outGrad output gradient.
* @param[in] outImgH output image height.
* @param[in] outImgW output image width.
* @param[in] outputH output batchSize.
* @param[in] outputW output image data dim.
* @param[in] numChannels number of channels.
* @param[in] ratioH inImgH / outImgH.
* @param[in] ratioW inImgW / outImgW.
*
*/
extern
void
hl_bilinear_backward
(
real
*
inGrad
,
const
size_t
inImgH
,
const
size_t
inImgW
,
...
...
paddle/cuda/src/hl_cuda_cublas.cc
浏览文件 @
f27fd9dc
...
...
@@ -16,7 +16,7 @@ limitations under the License. */
#include <sys/time.h>
#include "hl_cuda.h"
#include "hl_thread.ph"
#include "paddle/utils/DynamicLoad.h"
#include "paddle/utils/DynamicLoad
er
.h"
#include "paddle/utils/Logging.h"
namespace
dynload
{
...
...
paddle/cuda/src/hl_cuda_cudnn.cc
浏览文件 @
f27fd9dc
...
...
@@ -17,7 +17,7 @@ limitations under the License. */
#include <gflags/gflags.h>
#include "hl_cuda_cudnn.ph"
#include "hl_thread.ph"
#include "paddle/utils/DynamicLoad.h"
#include "paddle/utils/DynamicLoad
er
.h"
#include "paddle/utils/Logging.h"
DEFINE_int32
(
cudnn_conv_workspace_limit_in_mb
,
...
...
paddle/cuda/src/hl_cuda_device.cc
浏览文件 @
f27fd9dc
...
...
@@ -24,7 +24,7 @@ limitations under the License. */
#include "hl_cuda.ph"
#include "hl_thread.ph"
#include "paddle/utils/Logging.h"
#include "paddle/utils/DynamicLoad.h"
#include "paddle/utils/DynamicLoad
er
.h"
// clang-format on
namespace
dynload
{
...
...
paddle/cuda/src/hl_warpctc_wrap.cc
浏览文件 @
f27fd9dc
...
...
@@ -14,7 +14,7 @@ limitations under the License. */
#include "hl_warpctc_wrap.h"
#include <mutex>
#include "paddle/utils/DynamicLoad.h"
#include "paddle/utils/DynamicLoad
er
.h"
#include "paddle/utils/Logging.h"
namespace
dynload
{
...
...
paddle/function/BufferArgTest.cpp
浏览文件 @
f27fd9dc
...
...
@@ -12,8 +12,8 @@ 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. */
#include "BufferArg.h"
#include <gtest/gtest.h>
#include "BufferArg.h"
#include "paddle/math/MemoryHandle.h"
namespace
paddle
{
...
...
paddle/function/CosSimOp.cpp
浏览文件 @
f27fd9dc
...
...
@@ -165,12 +165,12 @@ void CosSimBackward<DEVICE_TYPE_CPU>(const CpuMatrix& out_grad,
real
reciprocal_square_sum_x
=
1.0
f
/
square_sum_x
;
real
reciprocal_square_sum_y
=
1.0
f
/
square_sum_y
;
for
(
size_t
j
=
0
;
j
<
dim
;
++
j
)
{
prev_grad_x
[
j
]
+=
out
[
i
]
*
grad
[
i
]
*
(
prev_out_y
[
j
]
*
reciprocal_xy
-
prev_out_x
[
j
]
*
reciprocal_square_sum_x
);
prev_grad_y
[
j
]
+=
out
[
i
]
*
grad
[
i
]
*
(
prev_out_x
[
j
]
*
reciprocal_xy
-
prev_out_y
[
j
]
*
reciprocal_square_sum_y
);
prev_grad_x
[
j
]
+=
out
[
i
]
*
grad
[
i
]
*
(
prev_out_y
[
j
]
*
reciprocal_xy
-
prev_out_x
[
j
]
*
reciprocal_square_sum_x
);
prev_grad_y
[
j
]
+=
out
[
i
]
*
grad
[
i
]
*
(
prev_out_x
[
j
]
*
reciprocal_xy
-
prev_out_y
[
j
]
*
reciprocal_square_sum_y
);
}
}
}
...
...
paddle/function/FunctionTest.cpp
浏览文件 @
f27fd9dc
...
...
@@ -12,8 +12,8 @@ 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. */
#include "Function.h"
#include <gtest/gtest.h>
#include "Function.h"
#include "paddle/math/SparseMatrix.h"
namespace
paddle
{
...
...
paddle/function/MulOpTest.cpp
浏览文件 @
f27fd9dc
...
...
@@ -74,9 +74,9 @@ TEST(MulOp, DDDMatrixMul) {
}
/**
* C += A * B, B, C dense, A sparse
* dense = sparse * dense
*/
* C += A * B, B, C dense, A sparse
* dense = sparse * dense
*/
void
testFuncDSparseDMatrix
(
size_t
dimM
,
size_t
dimN
,
size_t
dimK
,
size_t
nnz
,
SparseFormat
FORMAT
)
{
real
scaleT
=
1.0
;
...
...
@@ -119,9 +119,9 @@ TEST(MuLOp, DSparseDMul) {
}
/**
* C += A * B, A, C dense, B sparse
* dense = dense * sparse
*/
* C += A * B, A, C dense, B sparse
* dense = dense * sparse
*/
void
testFuncDDSparseMatrix
(
size_t
dimM
,
size_t
dimN
,
size_t
dimK
,
size_t
nnz
,
SparseFormat
FORMAT
)
{
real
scaleT
=
1.0
;
...
...
@@ -165,9 +165,9 @@ TEST(MulOp, DDSparseMul) {
}
/**
* C += A * B, A sparse, B, C dense
* sparse = dense * dense
*/
* C += A * B, A sparse, B, C dense
* sparse = dense * dense
*/
void
testFuncSparseDDMatrix
(
size_t
dimM
,
size_t
dimN
,
size_t
dimK
,
size_t
nnz
,
SparseFormat
FORMAT
)
{
real
scaleT
=
1.0
;
...
...
paddle/function/TensorShapeTest.cpp
浏览文件 @
f27fd9dc
...
...
@@ -12,8 +12,8 @@ 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. */
#include "TensorShape.h"
#include <gtest/gtest.h>
#include "TensorShape.h"
namespace
paddle
{
...
...
paddle/function/TensorTypeTest.cpp
浏览文件 @
f27fd9dc
...
...
@@ -12,8 +12,8 @@ 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. */
#include "TensorType.h"
#include <gtest/gtest.h>
#include "TensorType.h"
namespace
paddle
{
...
...
paddle/gserver/dataproviders/PyDataProvider.cpp
浏览文件 @
f27fd9dc
...
...
@@ -194,8 +194,8 @@ void PyDataProvider::fillSlotsByStr(const std::string& samples) {
auto
&
slot
=
slots_
[
j
];
CHECK
(
SlotDef
::
INDEX
>=
slot
.
type
||
SlotDef
::
STRING
==
slot
.
type
)
<<
" Slot type:"
<<
slot
.
type
<<
" is out of range."
;
CHECK_GE
(
slot
.
type
,
SlotDef
::
VECTOR_DENSE
)
<<
" Slot type:"
<<
slot
.
type
<<
" is out of range."
;
CHECK_GE
(
slot
.
type
,
SlotDef
::
VECTOR_DENSE
)
<<
" Slot type:"
<<
slot
.
type
<<
" is out of range."
;
switch
(
slot
.
type
)
{
case
SlotDef
::
VECTOR_DENSE
:
fillDenseSlot
(
slot
,
data
,
dataEnd
);
...
...
paddle/gserver/evaluators/Evaluator.cpp
浏览文件 @
f27fd9dc
...
...
@@ -446,9 +446,9 @@ real AucEvaluator::evalImp(std::vector<Argument>& arguments) {
for
(
size_t
i
=
0
;
i
<
insNum
;
++
i
)
{
real
value
=
outputD
[
pos
];
uint32_t
binIdx
=
static_cast
<
uint32_t
>
(
value
*
kBinNum_
);
CHECK
(
binIdx
<=
kBinNum_
)
<<
"bin index ["
<<
binIdx
<<
"] out of range, predict value["
<<
value
<<
"]"
;
CHECK
(
binIdx
<=
kBinNum_
)
<<
"bin index ["
<<
binIdx
<<
"] out of range, predict value["
<<
value
<<
"]"
;
real
w
=
supportWeight
?
weightD
[
i
]
:
1.0
;
if
(
labelD
[
i
]
==
kNegativeLabel_
)
{
statNeg_
[
binIdx
]
+=
w
;
...
...
paddle/gserver/gradientmachines/GradientMachine.cpp
浏览文件 @
f27fd9dc
...
...
@@ -21,7 +21,6 @@ limitations under the License. */
#include "MultiGradientMachine.h"
#include "MultiNetwork.h"
#include "NeuralNetwork.h"
#include "NeuralNetwork.h"
#include "ParallelNeuralNetwork.h"
#include "hl_gpu.h"
...
...
paddle/gserver/gradientmachines/RecurrentGradientMachine.cpp
浏览文件 @
f27fd9dc
...
...
@@ -637,7 +637,7 @@ void RecurrentGradientMachine::removeBeamSearchStatisticsCallbacks() {
/* create scattered id infomation for all realLayer of inFrameLines one time.
* If hasSubseq, will also create scattered sequenceStartPositions infomation
* for all realLayer of inFrameLines one time.
*/
*/
void
RecurrentGradientMachine
::
createInFrameInfo
(
int
inlinkId
,
const
Argument
&
input
,
...
...
paddle/gserver/gradientmachines/RecurrentGradientMachine.h
浏览文件 @
f27fd9dc
...
...
@@ -107,18 +107,18 @@ public:
DropCallback
;
/**
* @brief NormOrDropNodeCallback
*
* Normalize a path's probabilities or just drop it by modifying path.logProb
*
* The first parameter is sequence index in a batch
*
* The second parameter is path.ids
*
* The third parameter is probabilites for each node in this path.
*
* The fourth parameter is the probability of the whole path.
*/
* @brief NormOrDropNodeCallback
*
* Normalize a path's probabilities or just drop it by modifying path.logProb
*
* The first parameter is sequence index in a batch
*
* The second parameter is path.ids
*
* The third parameter is probabilites for each node in this path.
*
* The fourth parameter is the probability of the whole path.
*/
typedef
std
::
function
<
void
(
int
seqId
,
const
std
::
vector
<
int
>&
,
std
::
vector
<
real
>&
,
real
*
)
>
NormOrDropNodeCallback
;
...
...
@@ -348,9 +348,9 @@ protected:
int
targetInfoInlinkId_
;
/* create scattered id infomation for all realLayer of inFrameLines one time.
* If hasSubseq, will also create scattered sequenceStartPositions infomation
* for all realLayer of inFrameLines one time.
*/
* If hasSubseq, will also create scattered sequenceStartPositions infomation
* for all realLayer of inFrameLines one time.
*/
void
createInFrameInfo
(
int
inlinks_id
,
const
Argument
&
input
,
PassType
passType
);
...
...
paddle/gserver/layers/Layer.cpp
浏览文件 @
f27fd9dc
...
...
@@ -263,8 +263,9 @@ void Layer::zeroGrad() {
}
void
Layer
::
initNeedFlags
()
{
auto
initFlag
=
[
this
](
bool
&
flag
,
bool
(
Layer
::*
flagQueryFunc
)()
const
,
ParameterType
type
)
{
auto
initFlag
=
[
this
](
bool
&
flag
,
bool
(
Layer
::*
flagQueryFunc
)()
const
,
ParameterType
type
)
{
flag
=
false
;
if
(
biasParameter_
&&
biasParameter_
->
hasType
(
type
))
{
flag
=
true
;
...
...
paddle/gserver/layers/Layer.h
浏览文件 @
f27fd9dc
...
...
@@ -106,9 +106,9 @@ protected:
public:
/**
* Wait until all input value ready.
* Called before Layer::forward() function.
*/
* Wait until all input value ready.
* Called before Layer::forward() function.
*/
virtual
void
waitInputValue
();
/**
...
...
@@ -118,9 +118,9 @@ public:
virtual
void
copyOutputToOtherDevice
();
/**
* Wait until all output grad ready and merge them to output_.grad.
* Called before Layer::backward() function.
*/
* Wait until all output grad ready and merge them to output_.grad.
* Called before Layer::backward() function.
*/
virtual
void
waitAndMergeOutputGrad
();
/**
...
...
paddle/gserver/layers/RotateLayer.h
浏览文件 @
f27fd9dc
...
...
@@ -29,7 +29,7 @@ namespace paddle {
*
* The config file api is rotate_layer
*
*/
*/
class
RotateLayer
:
public
Layer
{
public:
...
...
paddle/gserver/layers/SequencePoolLayer.cpp
浏览文件 @
f27fd9dc
...
...
@@ -60,7 +60,7 @@ void SequencePoolLayer::forward(PassType passType) {
* thus, in this case, output_ has no sequenceStartPositions.
* If type_ = kSeq, seq has sub-seq degrades to a seq, thus, only in this
* case, we should compute the new sequenceStartPositions.
*/
*/
if
(
type_
)
{
CHECK
(
input
.
subSequenceStartPositions
)
<<
"when trans_type = seq, input must hasSubseq"
;
...
...
paddle/gserver/tests/test_RecurrentLayer.cpp
浏览文件 @
f27fd9dc
...
...
@@ -292,26 +292,27 @@ void checkRecurrentLayer(LayerConfig layerConfig,
TestRecurrentLayer
<
T
>
testGpu
(
layerConfig
,
true
,
gpuBatch
);
testCpu
.
init
(
batchSize
);
testGpu
.
init
(
batchSize
);
auto
checkError
=
[](
MatrixPtr
cpu
,
MatrixPtr
gpu
,
int
numSequences
,
const
char
*
str
)
{
CpuMatrix
check
(
gpu
->
getHeight
(),
gpu
->
getWidth
());
check
.
copyFrom
(
*
gpu
);
int
height
=
cpu
->
getHeight
();
int
width
=
cpu
->
getWidth
();
const
real
*
data1
=
cpu
->
getData
();
const
real
*
data2
=
check
.
getData
();
int
count
=
0
;
for
(
int
i
=
0
;
i
<
height
;
i
++
)
{
for
(
int
j
=
0
;
j
<
width
;
j
++
)
{
if
(
fabs
(
data1
[
i
*
width
+
j
]
-
data2
[
i
*
width
+
j
])
/
numSequences
>
1e-4
)
{
count
++
;
auto
checkError
=
[](
MatrixPtr
cpu
,
MatrixPtr
gpu
,
int
numSequences
,
const
char
*
str
)
{
CpuMatrix
check
(
gpu
->
getHeight
(),
gpu
->
getWidth
());
check
.
copyFrom
(
*
gpu
);
int
height
=
cpu
->
getHeight
();
int
width
=
cpu
->
getWidth
();
const
real
*
data1
=
cpu
->
getData
();
const
real
*
data2
=
check
.
getData
();
int
count
=
0
;
for
(
int
i
=
0
;
i
<
height
;
i
++
)
{
for
(
int
j
=
0
;
j
<
width
;
j
++
)
{
if
(
fabs
(
data1
[
i
*
width
+
j
]
-
data2
[
i
*
width
+
j
])
/
numSequences
>
1e-4
)
{
count
++
;
}
}
}
}
}
EXPECT_EQ
(
count
,
0
)
<<
"["
<<
str
<<
"]"
<<
"There are "
<<
count
<<
" different element."
;
};
EXPECT_EQ
(
count
,
0
)
<<
"["
<<
str
<<
"]"
<<
"There are "
<<
count
<<
" different element."
;
};
T
*
cpuLayer
=
dynamic_cast
<
T
*>
(
testCpu
.
testLayer_
.
get
());
T
*
gpuLayer
=
dynamic_cast
<
T
*>
(
testGpu
.
testLayer_
.
get
());
...
...
paddle/math/MathFunctions.cpp
浏览文件 @
f27fd9dc
...
...
@@ -15,7 +15,7 @@ limitations under the License. */
#include "MathFunctions.h"
#include "hl_matrix_apply.cuh"
#include "hl_matrix_ops.cuh"
#include "paddle/utils/DynamicLoad.h"
#include "paddle/utils/DynamicLoad
er
.h"
namespace
dynload
{
...
...
@@ -32,7 +32,7 @@ void* lapack_dso_handle = nullptr;
#define DYNAMIC_LOAD_LAPACK_WRAP(__name) \
struct DynLoad__##__name { \
template <typename... Args> \
auto operator()(Args... args)
->decltype(__name(args...)) {
\
auto operator()(Args... args)
-> decltype(__name(args...)) {
\
using lapack_func = decltype(__name(args...)) (*)(Args...); \
std::call_once(lapack_dso_flag, GetLapackDsoHandle, &lapack_dso_handle); \
void* p_##__name = dlsym(lapack_dso_handle, #__name); \
...
...
@@ -41,24 +41,27 @@ void* lapack_dso_handle = nullptr;
} __name; // struct DynLoad__##__name
// clang-format off
#ifdef PADDLE_USE_LAPACK
#ifdef PADDLE_USE_ATLAS
#define LAPACK_ROUTINE_EACH(__macro) \
__macro(clapack_sgetrf) \
__macro(clapack_dgetrf) \
__macro(clapack_sgetri) \
__macro(clapack_dgetri)
#define PADDLE_SGETRF clapack_sgetrf
#define PADDLE_DGETRF clapack_dgetrf
#define PADDLE_SGETRI clapack_sgetri
#define PADDLE_DGETRI clapack_dgetri
#else
#define LAPACK_ROUTINE_EACH(__macro) \
__macro(LAPACKE_sgetrf) \
__macro(LAPACKE_dgetrf) \
__macro(LAPACKE_sgetri) \
__macro(LAPACKE_dgetri)
#endif
#define PADDLE_SGETRF LAPACKE_sgetrf
#define PADDLE_DGETRF LAPACKE_dgetrf
#define PADDLE_SGETRI LAPACKE_sgetri
#define PADDLE_DGETRI LAPACKE_dgetri
#endif
#define LAPACK_ROUTINE_EACH(__macro) \
__macro(PADDLE_SGETRF) \
__macro(PADDLE_DGETRF) \
__macro(PADDLE_SGETRI) \
__macro(PADDLE_DGETRI)
// clang-format on
LAPACK_ROUTINE_EACH
(
DYNAMIC_LOAD_LAPACK_WRAP
)
#endif
// clang-format on
}
// namespace dynload
namespace
paddle
{
...
...
@@ -130,16 +133,7 @@ int getrf<float>(const CBLAS_ORDER order,
float
*
A
,
const
int
lda
,
int
*
ipiv
)
{
#ifdef PADDLE_USE_LAPACK
#ifdef PADDLE_USE_ATLAS
return
dynload
::
clapack_sgetrf
(
order
,
M
,
N
,
A
,
lda
,
ipiv
);
#else
return
dynload
::
LAPACKE_sgetrf
(
order
,
M
,
N
,
A
,
lda
,
ipiv
);
#endif
#else
LOG
(
FATAL
)
<<
"Not implemented"
;
#endif
return
0
;
return
dynload
::
PADDLE_SGETRF
(
order
,
M
,
N
,
A
,
lda
,
ipiv
);
}
template
<
>
...
...
@@ -149,16 +143,7 @@ int getrf<double>(const CBLAS_ORDER order,
double
*
A
,
const
int
lda
,
int
*
ipiv
)
{
#ifdef PADDLE_USE_LAPACK
#ifdef PADDLE_USE_ATLAS
return
dynload
::
clapack_dgetrf
(
order
,
M
,
N
,
A
,
lda
,
ipiv
);
#else
return
dynload
::
LAPACKE_dgetrf
(
order
,
M
,
N
,
A
,
lda
,
ipiv
);
#endif
#else
LOG
(
FATAL
)
<<
"Not implemented"
;
#endif
return
0
;
return
dynload
::
PADDLE_DGETRF
(
order
,
M
,
N
,
A
,
lda
,
ipiv
);
}
template
<
>
...
...
@@ -167,16 +152,7 @@ int getri<float>(const CBLAS_ORDER order,
float
*
A
,
const
int
lda
,
const
int
*
ipiv
)
{
#ifdef PADDLE_USE_LAPACK
#ifdef PADDLE_USE_ATLAS
return
dynload
::
clapack_sgetri
(
order
,
N
,
A
,
lda
,
ipiv
);
#else
return
dynload
::
LAPACKE_sgetri
(
order
,
N
,
A
,
lda
,
ipiv
);
#endif
#else
LOG
(
FATAL
)
<<
"Not implemented"
;
#endif
return
0
;
return
dynload
::
PADDLE_SGETRI
(
order
,
N
,
A
,
lda
,
ipiv
);
}
template
<
>
...
...
@@ -185,15 +161,7 @@ int getri<double>(const CBLAS_ORDER order,
double
*
A
,
const
int
lda
,
const
int
*
ipiv
)
{
#ifdef PADDLE_USE_LAPACK
#ifdef PADDLE_USE_ATLAS
return
dynload
::
clapack_dgetri
(
order
,
N
,
A
,
lda
,
ipiv
);
#else
return
dynload
::
LAPACKE_dgetri
(
order
,
N
,
A
,
lda
,
ipiv
);
#endif
#else
LOG
(
FATAL
)
<<
"Not implemented"
;
#endif
return
dynload
::
PADDLE_DGETRI
(
order
,
N
,
A
,
lda
,
ipiv
);
return
0
;
}
...
...
paddle/math/MathFunctions.h
浏览文件 @
f27fd9dc
...
...
@@ -17,14 +17,11 @@ limitations under the License. */
#ifdef PADDLE_USE_MKL
#include <mkl.h>
#ifdef PADDLE_USE_LAPACK
#include <mkl_lapacke.h>
#endif
#else
extern
"C"
{
#include <cblas.h>
}
#ifdef PADDLE_USE_LAPACK
#ifdef PADDLE_USE_ATLAS
extern
"C"
{
#include <clapack.h>
...
...
@@ -33,7 +30,6 @@ extern "C" {
#include <lapacke.h>
#endif
#endif
#endif
#include <cmath>
...
...
paddle/math/MatrixBitCode.cpp
浏览文件 @
f27fd9dc
...
...
@@ -174,8 +174,10 @@ void CpuMatrix::mulByBitCode(size_t numClasses,
const
IVector
&
codes
,
const
Matrix
&
weight
,
const
Matrix
&
input
)
{
auto
op
=
[](
real
&
t
,
const
real
*
weightRow
,
const
real
*
inputRow
,
size_t
inputDim
)
{
auto
op
=
[](
real
&
t
,
const
real
*
weightRow
,
const
real
*
inputRow
,
size_t
inputDim
)
{
real
sum
=
0
;
for
(
size_t
k
=
0
;
k
<
inputDim
;
++
k
)
{
sum
+=
weightRow
[
k
]
*
inputRow
[
k
];
...
...
@@ -193,12 +195,12 @@ void CpuMatrix::mulByBitCodeBackwardWeight(size_t numClasses,
const
IVector
&
codes
,
Matrix
&
weight
,
const
Matrix
&
input
)
{
auto
op
=
[](
const
real
t
,
real
*
weightRow
,
const
real
*
inputRow
,
size_t
inputDim
)
{
for
(
size_t
k
=
0
;
k
<
inputDim
;
++
k
)
{
weightRow
[
k
]
+=
t
*
inputRow
[
k
];
}
};
auto
op
=
[](
const
real
t
,
real
*
weightRow
,
const
real
*
inputRow
,
size_t
inputDim
)
{
for
(
size_t
k
=
0
;
k
<
inputDim
;
++
k
)
{
weightRow
[
k
]
+=
t
*
inputRow
[
k
];
}
};
mulByBitCodeT
(
op
,
SimpleCodeTable
(
numClasses
),
codes
,
*
this
,
weight
,
input
);
}
...
...
@@ -210,12 +212,12 @@ void CpuMatrix::mulByBitCodeBackwardError(size_t numClasses,
const
IVector
&
codes
,
const
Matrix
&
weight
,
Matrix
&
input
)
{
auto
op
=
[](
const
real
t
,
const
real
*
weightRow
,
real
*
inputRow
,
size_t
inputDim
)
{
for
(
size_t
k
=
0
;
k
<
inputDim
;
++
k
)
{
inputRow
[
k
]
+=
t
*
weightRow
[
k
];
}
};
auto
op
=
[](
const
real
t
,
const
real
*
weightRow
,
real
*
inputRow
,
size_t
inputDim
)
{
for
(
size_t
k
=
0
;
k
<
inputDim
;
++
k
)
{
inputRow
[
k
]
+=
t
*
weightRow
[
k
];
}
};
mulByBitCodeT
(
op
,
SimpleCodeTable
(
numClasses
),
codes
,
*
this
,
weight
,
input
);
}
...
...
paddle/math/tests/TensorCheck.h
浏览文件 @
f27fd9dc
...
...
@@ -183,8 +183,8 @@ void TensorCheck(AssertEq compare,
template
<
typename
AssertEq
>
void
TensorCheck
(
AssertEq
compare
,
real
args1
,
real
args2
)
{
EXPECT_EQ
(
compare
(
args1
,
args2
),
true
)
<<
"[Test error] args1 = "
<<
args1
<<
", args2 = "
<<
args2
;
EXPECT_EQ
(
compare
(
args1
,
args2
),
true
)
<<
"[Test error] args1 = "
<<
args1
<<
", args2 = "
<<
args2
;
}
template
<
typename
AssertEq
>
...
...
paddle/math/tests/TestUtils.h
浏览文件 @
f27fd9dc
...
...
@@ -37,7 +37,7 @@ limitations under the License. */
*
* AutoCompare test;
* test.cmpWithoutArg<I...>(function, height, width)
*/
*/
#include <gtest/gtest.h>
#include "TensorCheck.h"
...
...
paddle/math/tests/test_SIMDFunctions.cpp
浏览文件 @
f27fd9dc
...
...
@@ -126,15 +126,15 @@ TEST(SIMDFunction, decayL1_WithLR) {
typedef
std
::
function
<
void
(
float
*
,
float
*
,
float
*
,
float
,
size_t
)
>
DecayL1MethodType
;
DecayL1MethodType
naive
=
[](
float
*
d
,
float
*
s
,
float
*
lr
,
float
l
,
size_t
len
)
{
paddle
::
simd
::
naive
::
decayL1
<
float
>
(
d
,
s
,
lr
,
l
,
len
);
};
DecayL1MethodType
simd
=
[](
float
*
d
,
float
*
s
,
float
*
lr
,
float
l
,
size_t
len
)
{
paddle
::
simd
::
decayL1
<
float
>
(
d
,
s
,
lr
,
l
,
len
);
};
DecayL1MethodType
naive
=
[](
float
*
d
,
float
*
s
,
float
*
lr
,
float
l
,
size_t
len
)
{
paddle
::
simd
::
naive
::
decayL1
<
float
>
(
d
,
s
,
lr
,
l
,
len
);
};
DecayL1MethodType
simd
=
[](
float
*
d
,
float
*
s
,
float
*
lr
,
float
l
,
size_t
len
)
{
paddle
::
simd
::
decayL1
<
float
>
(
d
,
s
,
lr
,
l
,
len
);
};
naive
(
dest
.
get
(),
src
.
get
(),
lr
.
get
(),
lambda
,
VECTOR_LEN
);
simd
(
simd_dest
.
get
(),
src
.
get
(),
lr
.
get
(),
lambda
,
VECTOR_LEN
);
...
...
paddle/math/tests/test_matrixCompare.cpp
浏览文件 @
f27fd9dc
...
...
@@ -21,6 +21,7 @@ limitations under the License. */
#include "paddle/math/Matrix.h"
#include "paddle/math/SparseMatrix.h"
#include "paddle/testing/TestUtil.h"
#include "paddle/utils/DynamicLoader.h"
#include "paddle/utils/Stat.h"
#include "paddle/utils/Util.h"
...
...
@@ -235,10 +236,15 @@ TEST(Matrix, unary) {
testMatrixTranspose
(
height
,
width
);
testMatrixRotate
(
height
,
width
);
}
// inverse
#ifdef PADDLE_USE_LAPACK
testMatrixInverse
(
height
);
#endif
// inverse matrix
void
**
dso_handler
=
nullptr
;
GetLapackDsoHandle
(
dso_handler
);
if
(
nullptr
==
*
dso_handler
)
{
LOG
(
WARNING
)
<<
"Failed to find liblapack.so, please specify its path "
"using LD_LIBRARY_PATH."
;
}
else
{
testMatrixInverse
(
height
);
}
}
}
...
...
paddle/parameter/Argument.cpp
浏览文件 @
f27fd9dc
...
...
@@ -379,7 +379,7 @@ void Argument::concat(const std::vector<Argument>& args,
}
auto
copyArg
=
[
batchSize
,
stream
](
MatrixPtr
&
dst
,
MatrixPtr
src
,
int
startRow
,
bool
useGpu
)
{
MatrixPtr
&
dst
,
MatrixPtr
src
,
int
startRow
,
bool
useGpu
)
{
if
(
!
src
)
{
dst
.
reset
();
return
;
...
...
@@ -395,29 +395,31 @@ void Argument::concat(const std::vector<Argument>& args,
tmpMatrix
->
copyFrom
(
*
src
,
stream
);
};
auto
copyIds
=
[
batchSize
,
stream
](
IVectorPtr
&
dst
,
const
IVectorPtr
&
src
,
int
startRow
,
bool
useGpu
)
{
if
(
!
src
)
{
dst
.
reset
();
return
;
}
IVector
::
resizeOrCreate
(
dst
,
batchSize
,
useGpu
);
dst
->
subVec
(
startRow
,
src
->
getSize
())
->
copyFrom
(
*
src
,
stream
);
};
auto
copyStrs
=
[
batchSize
,
stream
](
SVectorPtr
&
dst
,
const
SVectorPtr
&
src
,
int
startRow
,
bool
useGpu
)
{
if
(
!
src
)
{
dst
.
reset
();
return
;
}
if
(
!
dst
)
{
dst
=
std
::
make_shared
<
std
::
vector
<
std
::
string
>>
(
batchSize
);
}
else
{
dst
->
resize
(
batchSize
);
}
std
::
copy
(
src
->
begin
(),
src
->
end
(),
dst
->
begin
()
+
startRow
);
};
auto
copyIds
=
[
batchSize
,
stream
](
IVectorPtr
&
dst
,
const
IVectorPtr
&
src
,
int
startRow
,
bool
useGpu
)
{
if
(
!
src
)
{
dst
.
reset
();
return
;
}
IVector
::
resizeOrCreate
(
dst
,
batchSize
,
useGpu
);
dst
->
subVec
(
startRow
,
src
->
getSize
())
->
copyFrom
(
*
src
,
stream
);
};
auto
copyStrs
=
[
batchSize
,
stream
](
SVectorPtr
&
dst
,
const
SVectorPtr
&
src
,
int
startRow
,
bool
useGpu
)
{
if
(
!
src
)
{
dst
.
reset
();
return
;
}
if
(
!
dst
)
{
dst
=
std
::
make_shared
<
std
::
vector
<
std
::
string
>>
(
batchSize
);
}
else
{
dst
->
resize
(
batchSize
);
}
std
::
copy
(
src
->
begin
(),
src
->
end
(),
dst
->
begin
()
+
startRow
);
};
auto
copySequencePos
=
[](
ICpuGpuVectorPtr
&
dstSeq
,
const
ICpuGpuVectorPtr
&
srcSeq
,
...
...
paddle/parameter/AverageOptimizer.cpp
浏览文件 @
f27fd9dc
...
...
@@ -155,8 +155,9 @@ ParameterOptimizer::TraverseCallback AverageOptimizer::restore() {
return
nullptr
;
}
return
[](
const
VectorPtr
vecs
[],
const
ParameterConfig
&
config
,
size_t
sparseId
)
{
return
[](
const
VectorPtr
vecs
[],
const
ParameterConfig
&
config
,
size_t
sparseId
)
{
vecs
[
PARAMETER_VALUE
]
->
copyFrom
(
*
vecs
[
PARAMETER_GRADIENT
]);
vecs
[
PARAMETER_GRADIENT
]
->
zeroMem
();
};
...
...
paddle/parameter/FirstOrderOptimizer.h
浏览文件 @
f27fd9dc
...
...
@@ -126,7 +126,7 @@ protected:
/*
* AdaDelta Optimization.
* http://www.matthewzeiler.com/pubs/googleTR2012/googleTR2012.pdf
*/
*/
class
AdaDeltaParameterOptimizer
:
public
ParameterOptimizer
{
public:
explicit
AdaDeltaParameterOptimizer
(
const
OptimizationConfig
&
optConfig
)
...
...
paddle/parameter/Parameter.cpp
浏览文件 @
f27fd9dc
...
...
@@ -352,8 +352,8 @@ bool Parameter::load(std::istream& s) {
Header
header
;
CHECK
(
s
.
read
(
reinterpret_cast
<
char
*>
(
&
header
),
sizeof
(
header
)))
<<
"Fail to read parameter "
<<
getName
();
CHECK_EQ
(
header
.
version
,
kFormatVersion
)
<<
"Incorrect format version: "
<<
header
.
version
;
CHECK_EQ
(
header
.
version
,
kFormatVersion
)
<<
"Incorrect format version: "
<<
header
.
version
;
CHECK_EQ
(
header
.
size
,
getSize
())
<<
"The size ("
<<
header
.
size
<<
") in the file does not match the size "
<<
"("
<<
getSize
()
<<
") of the parameter: "
<<
getName
();
...
...
paddle/pserver/LightNetwork.cpp
浏览文件 @
f27fd9dc
...
...
@@ -359,8 +359,8 @@ void SocketClient::TcpClient(const std::string &serverAddr, int serverPort) {
#if defined(__OSX__) || defined(__APPLE__)
server
=
getipnodebyname
(
serverAddr
.
c_str
(),
AF_INET
,
AI_DEFAULT
,
&
errRet
);
CHECK_NE
(
HOST_NOT_FOUND
,
errRet
)
<<
"ERROR, no such host: "
<<
serverAddr
<<
" ret = "
<<
errRet
;
CHECK_NE
(
HOST_NOT_FOUND
,
errRet
)
<<
"ERROR, no such host: "
<<
serverAddr
<<
" ret = "
<<
errRet
;
CHECK
(
server
)
<<
"getipnodebyname error!"
;
#else
struct
hostent
hostinfo
;
...
...
paddle/pserver/ParameterClient2.cpp
浏览文件 @
f27fd9dc
...
...
@@ -549,9 +549,9 @@ PServerVector ParameterClient2::createVector() {
if
(
handle
==
-
1
)
{
handle
=
response
.
handle
();
}
else
{
CHECK_EQ
(
handle
,
response
.
handle
())
<<
"Inconsistent handle from client"
<<
&
response
-
&
responses
[
0
]
<<
" "
<<
handle
<<
" "
<<
response
.
handle
();
CHECK_EQ
(
handle
,
response
.
handle
())
<<
"Inconsistent handle from client"
<<
&
response
-
&
responses
[
0
]
<<
" "
<<
handle
<<
" "
<<
response
.
handle
();
}
}
return
PServerVector
{
handle
};
...
...
@@ -579,9 +579,9 @@ PServerMatrix ParameterClient2::createMatrix(int32_t numCols) {
if
(
handle
==
-
1
)
{
handle
=
response
.
handle
();
}
else
{
CHECK_EQ
(
handle
,
response
.
handle
())
<<
"Inconsistent handle from client"
<<
&
response
-
&
responses
[
0
]
<<
" "
<<
handle
<<
" "
<<
response
.
handle
();
CHECK_EQ
(
handle
,
response
.
handle
())
<<
"Inconsistent handle from client"
<<
&
response
-
&
responses
[
0
]
<<
" "
<<
handle
<<
" "
<<
response
.
handle
();
}
}
return
PServerMatrix
{
handle
};
...
...
paddle/pserver/ParameterServer2.cpp
浏览文件 @
f27fd9dc
...
...
@@ -1213,8 +1213,8 @@ void ParameterServer2::loadValueVector(const LoadValueRequest& request,
CHECK_EQ
(
header
.
size
,
(
size_t
)
size_
)
<<
"The size ("
<<
header
.
size
<<
") in the file does not match the size "
<<
"("
<<
size_
<<
") of the pserver: "
<<
serverId_
;
CHECK_EQ
(
header
.
valueSize
,
sizeof
(
real
))
<<
"Unsupported valueSize "
<<
header
.
valueSize
;
CHECK_EQ
(
header
.
valueSize
,
sizeof
(
real
))
<<
"Unsupported valueSize "
<<
header
.
valueSize
;
CHECK
(
fs
.
read
(
reinterpret_cast
<
char
*>
(
vec
.
getData
()),
header
.
size
*
sizeof
(
real
)));
...
...
paddle/pserver/ParameterServer2.h
浏览文件 @
f27fd9dc
...
...
@@ -545,11 +545,11 @@ protected:
std
::
vector
<
ParameterServer2
::
Buffer
>*
buffers
);
const
ParameterConfig
&
getParameterConfig
(
const
ParameterBlock
&
block
)
{
CHECK_LT
(
block
.
para_id
(),
-
1UL
)
<<
"invalid parameter id:"
<<
block
.
para_id
();
CHECK_LT
(
block
.
para_id
(),
-
1UL
)
<<
"invalid parameter id:"
<<
block
.
para_id
();
const
auto
it
=
configMap_
.
find
(
block
.
para_id
());
CHECK
(
it
!=
configMap_
.
end
())
<<
"can not find parameter id: "
<<
block
.
para_id
();
CHECK
(
it
!=
configMap_
.
end
())
<<
"can not find parameter id: "
<<
block
.
para_id
();
return
it
->
second
;
}
...
...
paddle/pserver/ProtoServer.cpp
浏览文件 @
f27fd9dc
...
...
@@ -41,8 +41,8 @@ void ProtoServer::handleRequest(std::unique_ptr<MsgReader> msgReader,
void
ProtoServer
::
registerServiceFunctionImp
(
const
std
::
string
&
funcName
,
ServiceFunction
func
)
{
CHECK
(
!
nameToFuncMap_
.
count
(
funcName
))
<<
"Duplicated registration: "
<<
funcName
;
CHECK
(
!
nameToFuncMap_
.
count
(
funcName
))
<<
"Duplicated registration: "
<<
funcName
;
nameToFuncMap_
[
funcName
]
=
func
;
}
...
...
paddle/trainer/TrainerInternal.cpp
浏览文件 @
f27fd9dc
...
...
@@ -97,7 +97,7 @@ void TrainerInternal::trainOneBatch(int64_t batchId,
}
UpdateCallback
updateCallback
=
[
this
,
showStats
,
&
paraStats
](
Parameter
*
para
)
{
Parameter
*
para
)
{
if
(
showStats
)
{
//! @TODO(yuyang18) Show stats is actually a ParameterHook, refactor
// it
...
...
paddle/trainer/tests/picojson.h
浏览文件 @
f27fd9dc
...
...
@@ -1059,14 +1059,14 @@ inline bool operator==(const value& x, const value& y) {
}
inline
bool
operator
!=
(
const
value
&
x
,
const
value
&
y
)
{
return
!
(
x
==
y
);
}
}
}
// namespace picojson
namespace
std
{
template
<
>
inline
void
swap
(
picojson
::
value
&
x
,
picojson
::
value
&
y
)
{
x
.
swap
(
y
);
}
}
}
// namespace std
inline
std
::
istream
&
operator
>>
(
std
::
istream
&
is
,
picojson
::
value
&
x
)
{
picojson
::
set_last_error
(
std
::
string
());
...
...
paddle/utils/BarrierStat.h
浏览文件 @
f27fd9dc
...
...
@@ -344,14 +344,14 @@ private:
} while (0);
// check end barrier
#define __CHECK_BARRIER_TIMER(set, statName, numConnThreads, ...)
\
do {
\
std::string internalName =
\
std::string(statName) + std::string(__VA_ARGS__);
\
BarrierStatPtr __stat =
\
(set).getStat(numConnThreads, internalName, BARRIER_END);
\
PCHECK(__stat->checkPassBarrier())
<< internalName
\
<< ": invalid barrier data";
\
#define __CHECK_BARRIER_TIMER(set, statName, numConnThreads, ...) \
do { \
std::string internalName = \
std::string(statName) + std::string(__VA_ARGS__); \
BarrierStatPtr __stat = \
(set).getStat(numConnThreads, internalName, BARRIER_END); \
PCHECK(__stat->checkPassBarrier())
\
<< internalName << ": invalid barrier data";
\
} while (0);
/*
...
...
paddle/utils/ClassRegistrar.h
浏览文件 @
f27fd9dc
...
...
@@ -62,8 +62,8 @@ public:
// Create a class instance of type @type using args
BaseClass
*
createByType
(
const
std
::
string
&
type
,
CreateArgs
...
args
)
{
ClassCreator
creator
;
CHECK
(
mapGet
(
type
,
creatorMap_
,
&
creator
))
<<
"Unknown class type: "
<<
type
;
CHECK
(
mapGet
(
type
,
creatorMap_
,
&
creator
))
<<
"Unknown class type: "
<<
type
;
return
creator
(
args
...);
}
...
...
paddle/utils/DynamicLoad.cpp
→
paddle/utils/DynamicLoad
er
.cpp
浏览文件 @
f27fd9dc
...
...
@@ -12,9 +12,9 @@ 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. */
#include "DynamicLoad.h"
#include "Logging.h"
#include "DynamicLoader.h"
#include <gflags/gflags.h>
#include "Logging.h"
DEFINE_string
(
cudnn_dir
,
""
,
...
...
@@ -165,8 +165,8 @@ void GetWarpCTCDsoHandle(void** dso_handle) {
void
GetLapackDsoHandle
(
void
**
dso_handle
)
{
#if defined(__APPLE__) || defined(__OSX__)
GetDsoHandleFromSearchPath
(
FLAGS_
warpctc
_dir
,
"liblapack.dylib"
,
dso_handle
);
GetDsoHandleFromSearchPath
(
FLAGS_
lapack
_dir
,
"liblapack.dylib"
,
dso_handle
);
#else
GetDsoHandleFromSearchPath
(
FLAGS_
warpctc
_dir
,
"liblapack.so"
,
dso_handle
);
GetDsoHandleFromSearchPath
(
FLAGS_
lapack
_dir
,
"liblapack.so"
,
dso_handle
);
#endif
}
paddle/utils/DynamicLoad.h
→
paddle/utils/DynamicLoad
er
.h
浏览文件 @
f27fd9dc
...
...
@@ -17,8 +17,8 @@ limitations under the License. */
#include <dlfcn.h>
#include <memory>
#include <string>
#include <mutex>
#include <string>
/**
* @brief load the DSO of CUBLAS
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录