Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
38de512d
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看板
未验证
提交
38de512d
编写于
12月 11, 2017
作者:
T
tensor-tang
提交者:
GitHub
12月 11, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #6459 from tensor-tang/develop
unify MKL macro definition
上级
9f44af9d
69b44f2f
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
15 addition
and
15 deletion
+15
-15
cmake/cblas.cmake
cmake/cblas.cmake
+1
-1
cmake/external/mkldnn.cmake
cmake/external/mkldnn.cmake
+1
-1
paddle/gserver/activations/ActivationFunction.cpp
paddle/gserver/activations/ActivationFunction.cpp
+2
-2
paddle/gserver/gradientmachines/NeuralNetwork.cpp
paddle/gserver/gradientmachines/NeuralNetwork.cpp
+2
-2
paddle/math/Allocator.h
paddle/math/Allocator.h
+1
-1
paddle/math/MathFunctions.cpp
paddle/math/MathFunctions.cpp
+1
-1
paddle/math/MathFunctions.h
paddle/math/MathFunctions.h
+1
-1
paddle/memory/detail/system_allocator.cc
paddle/memory/detail/system_allocator.cc
+1
-1
paddle/operators/math/math_function.cc
paddle/operators/math/math_function.cc
+1
-1
paddle/operators/math/math_function.h
paddle/operators/math/math_function.h
+1
-1
paddle/parameter/FirstOrderOptimizer.h
paddle/parameter/FirstOrderOptimizer.h
+1
-1
paddle/parameter/ParameterUpdateFunctions.cpp
paddle/parameter/ParameterUpdateFunctions.cpp
+1
-1
paddle/utils/Flags.cpp
paddle/utils/Flags.cpp
+1
-1
未找到文件。
cmake/cblas.cmake
浏览文件 @
38de512d
...
@@ -17,7 +17,7 @@ if(WITH_MKLML AND MKLML_INC_DIR AND MKLML_LIB)
...
@@ -17,7 +17,7 @@ if(WITH_MKLML AND MKLML_INC_DIR AND MKLML_LIB)
set
(
CBLAS_INC_DIR
${
MKLML_INC_DIR
}
)
set
(
CBLAS_INC_DIR
${
MKLML_INC_DIR
}
)
set
(
CBLAS_LIBRARIES
${
MKLML_LIB
}
)
set
(
CBLAS_LIBRARIES
${
MKLML_LIB
}
)
add_definitions
(
-DPADDLE_
USE
_MKLML
)
add_definitions
(
-DPADDLE_
WITH
_MKLML
)
add_definitions
(
-DLAPACK_FOUND
)
add_definitions
(
-DLAPACK_FOUND
)
message
(
STATUS
"Found cblas and lapack in MKLML "
message
(
STATUS
"Found cblas and lapack in MKLML "
...
...
cmake/external/mkldnn.cmake
浏览文件 @
38de512d
...
@@ -67,5 +67,5 @@ ADD_LIBRARY(mkldnn SHARED IMPORTED GLOBAL)
...
@@ -67,5 +67,5 @@ ADD_LIBRARY(mkldnn SHARED IMPORTED GLOBAL)
SET_PROPERTY
(
TARGET mkldnn PROPERTY IMPORTED_LOCATION
${
MKLDNN_LIB
}
)
SET_PROPERTY
(
TARGET mkldnn PROPERTY IMPORTED_LOCATION
${
MKLDNN_LIB
}
)
ADD_DEPENDENCIES
(
mkldnn
${
MKLDNN_PROJECT
}
)
ADD_DEPENDENCIES
(
mkldnn
${
MKLDNN_PROJECT
}
)
MESSAGE
(
STATUS
"MKLDNN library:
${
MKLDNN_LIB
}
"
)
MESSAGE
(
STATUS
"MKLDNN library:
${
MKLDNN_LIB
}
"
)
add_definitions
(
-DPADDLE_
USE
_MKLDNN
)
add_definitions
(
-DPADDLE_
WITH
_MKLDNN
)
LIST
(
APPEND external_project_dependencies mkldnn
)
LIST
(
APPEND external_project_dependencies mkldnn
)
paddle/gserver/activations/ActivationFunction.cpp
浏览文件 @
38de512d
...
@@ -24,7 +24,7 @@ limitations under the License. */
...
@@ -24,7 +24,7 @@ limitations under the License. */
#include "paddle/utils/ClassRegistrar.h"
#include "paddle/utils/ClassRegistrar.h"
#include "paddle/utils/Logging.h"
#include "paddle/utils/Logging.h"
#ifdef PADDLE_
USE
_MKLDNN
#ifdef PADDLE_
WITH
_MKLDNN
#include "MKLDNNActivation.h"
#include "MKLDNNActivation.h"
#endif
#endif
...
@@ -490,7 +490,7 @@ Error __must_check backward(Argument& act) {
...
@@ -490,7 +490,7 @@ Error __must_check backward(Argument& act) {
END_DEFINE_ACTIVATION
(
log
)
END_DEFINE_ACTIVATION
(
log
)
ActivationFunction
*
ActivationFunction
::
create
(
const
std
::
string
&
type
)
{
ActivationFunction
*
ActivationFunction
::
create
(
const
std
::
string
&
type
)
{
#ifdef PADDLE_
USE
_MKLDNN
#ifdef PADDLE_
WITH
_MKLDNN
if
(
!
type
.
empty
()
&&
type
.
compare
(
0
,
7
,
"mkldnn_"
)
==
0
)
{
if
(
!
type
.
empty
()
&&
type
.
compare
(
0
,
7
,
"mkldnn_"
)
==
0
)
{
return
MKLDNNActivation
::
create
(
type
);
return
MKLDNNActivation
::
create
(
type
);
}
}
...
...
paddle/gserver/gradientmachines/NeuralNetwork.cpp
浏览文件 @
38de512d
...
@@ -20,7 +20,7 @@ limitations under the License. */
...
@@ -20,7 +20,7 @@ limitations under the License. */
#include "paddle/utils/Logging.h"
#include "paddle/utils/Logging.h"
#include "paddle/utils/Stat.h"
#include "paddle/utils/Stat.h"
#ifdef PADDLE_
USE
_MKLDNN
#ifdef PADDLE_
WITH
_MKLDNN
#include "paddle/gserver/layers/MKLDNNLayer.h"
#include "paddle/gserver/layers/MKLDNNLayer.h"
#endif
#endif
...
@@ -307,7 +307,7 @@ void NeuralNetwork::backward(const UpdateCallback& callback) {
...
@@ -307,7 +307,7 @@ void NeuralNetwork::backward(const UpdateCallback& callback) {
}
}
void
NeuralNetwork
::
finish
()
{
void
NeuralNetwork
::
finish
()
{
#ifdef PADDLE_
USE
_MKLDNN
#ifdef PADDLE_
WITH
_MKLDNN
FOR_EACH_R
(
layer
,
layers_
)
{
FOR_EACH_R
(
layer
,
layers_
)
{
MKLDNNLayerPtr
dnnLayer
=
std
::
dynamic_pointer_cast
<
MKLDNNLayer
>
(
*
layer
);
MKLDNNLayerPtr
dnnLayer
=
std
::
dynamic_pointer_cast
<
MKLDNNLayer
>
(
*
layer
);
if
(
dnnLayer
)
{
if
(
dnnLayer
)
{
...
...
paddle/math/Allocator.h
浏览文件 @
38de512d
...
@@ -48,7 +48,7 @@ public:
...
@@ -48,7 +48,7 @@ public:
*/
*/
virtual
void
*
alloc
(
size_t
size
)
{
virtual
void
*
alloc
(
size_t
size
)
{
void
*
ptr
;
void
*
ptr
;
#ifdef PADDLE_
USE
_MKLDNN
#ifdef PADDLE_
WITH
_MKLDNN
// refer to https://github.com/01org/mkl-dnn/blob/master/include/mkldnn.hpp
// refer to https://github.com/01org/mkl-dnn/blob/master/include/mkldnn.hpp
// memory alignment
// memory alignment
CHECK_EQ
(
posix_memalign
(
&
ptr
,
4096ul
,
size
),
0
);
CHECK_EQ
(
posix_memalign
(
&
ptr
,
4096ul
,
size
),
0
);
...
...
paddle/math/MathFunctions.cpp
浏览文件 @
38de512d
...
@@ -206,7 +206,7 @@ double dotProduct<double>(const int n, const double* x, const double* y) {
...
@@ -206,7 +206,7 @@ double dotProduct<double>(const int n, const double* x, const double* y) {
}
}
#endif
#endif
#if defined(PADDLE_
USE
_MKLML)
#if defined(PADDLE_
WITH
_MKLML)
template
<
>
template
<
>
void
vExp
<
float
>
(
const
int
n
,
const
float
*
a
,
float
*
r
)
{
void
vExp
<
float
>
(
const
int
n
,
const
float
*
a
,
float
*
r
)
{
...
...
paddle/math/MathFunctions.h
浏览文件 @
38de512d
...
@@ -15,7 +15,7 @@ limitations under the License. */
...
@@ -15,7 +15,7 @@ limitations under the License. */
#ifndef MATHFUNCTIONS_H_
#ifndef MATHFUNCTIONS_H_
#define MATHFUNCTIONS_H_
#define MATHFUNCTIONS_H_
#ifdef PADDLE_
USE
_MKLML
#ifdef PADDLE_
WITH
_MKLML
#include <mkl_cblas.h>
#include <mkl_cblas.h>
#include <mkl_lapacke.h>
#include <mkl_lapacke.h>
#include <mkl_vml_functions.h>
#include <mkl_vml_functions.h>
...
...
paddle/memory/detail/system_allocator.cc
浏览文件 @
38de512d
...
@@ -43,7 +43,7 @@ void* CPUAllocator::Alloc(size_t& index, size_t size) {
...
@@ -43,7 +43,7 @@ void* CPUAllocator::Alloc(size_t& index, size_t size) {
void
*
p
;
void
*
p
;
#ifdef PADDLE_
USE
_MKLDNN
#ifdef PADDLE_
WITH
_MKLDNN
// refer to https://github.com/01org/mkl-dnn/blob/master/include/mkldnn.hpp
// refer to https://github.com/01org/mkl-dnn/blob/master/include/mkldnn.hpp
// memory alignment
// memory alignment
PADDLE_ENFORCE_EQ
(
posix_memalign
(
&
p
,
4096ul
,
size
),
0
);
PADDLE_ENFORCE_EQ
(
posix_memalign
(
&
p
,
4096ul
,
size
),
0
);
...
...
paddle/operators/math/math_function.cc
浏览文件 @
38de512d
...
@@ -132,7 +132,7 @@ void matmul<platform::CPUPlace, double>(
...
@@ -132,7 +132,7 @@ void matmul<platform::CPUPlace, double>(
matrix_b
.
data
<
double
>
(),
beta
,
matrix_out
->
data
<
double
>
());
matrix_b
.
data
<
double
>
(),
beta
,
matrix_out
->
data
<
double
>
());
}
}
#ifdef PADDLE_
USE
_MKLML
#ifdef PADDLE_
WITH
_MKLML
// Use cblas_{s,d}gemm_batched if available: Run with 1 group of size batchSize.
// Use cblas_{s,d}gemm_batched if available: Run with 1 group of size batchSize.
template
<
>
template
<
>
void
batched_gemm
<
platform
::
CPUPlace
,
float
>
(
void
batched_gemm
<
platform
::
CPUPlace
,
float
>
(
...
...
paddle/operators/math/math_function.h
浏览文件 @
38de512d
...
@@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
...
@@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. */
limitations under the License. */
#pragma once
#pragma once
#ifdef PADDLE_
USE
_MKLML
#ifdef PADDLE_
WITH
_MKLML
#include <mkl_cblas.h>
#include <mkl_cblas.h>
#include <mkl_lapacke.h>
#include <mkl_lapacke.h>
#include <mkl_vml_functions.h>
#include <mkl_vml_functions.h>
...
...
paddle/parameter/FirstOrderOptimizer.h
浏览文件 @
38de512d
...
@@ -38,7 +38,7 @@ public:
...
@@ -38,7 +38,7 @@ public:
real
torch_learningRate
=
optConfig_
.
learning_method
()
==
"torch_momentum"
real
torch_learningRate
=
optConfig_
.
learning_method
()
==
"torch_momentum"
?
1.0
-
paraConfig
.
momentum
()
?
1.0
-
paraConfig
.
momentum
()
:
1.0
;
:
1.0
;
#ifdef PADDLE_
USE
_MKLDNN
#ifdef PADDLE_
WITH
_MKLDNN
sgdUpdate
(
learningRate_
*
paraConfig
.
learning_rate
()
*
sgdUpdate
(
learningRate_
*
paraConfig
.
learning_rate
()
*
(
firstTime_
?
1.0
:
torch_learningRate
),
(
firstTime_
?
1.0
:
torch_learningRate
),
paraConfig
.
momentum
(),
paraConfig
.
momentum
(),
...
...
paddle/parameter/ParameterUpdateFunctions.cpp
浏览文件 @
38de512d
...
@@ -30,7 +30,7 @@ void sgdUpdateCpu(real learningRate,
...
@@ -30,7 +30,7 @@ void sgdUpdateCpu(real learningRate,
const
real
*
grad
,
const
real
*
grad
,
real
*
momentumVec
)
{
real
*
momentumVec
)
{
decayRate
*=
learningRate
;
decayRate
*=
learningRate
;
#ifdef PADDLE_
USE
_MKLML
#ifdef PADDLE_
WITH
_MKLML
#pragma omp parallel for
#pragma omp parallel for
#endif
#endif
for
(
size_t
i
=
0
;
i
<
size
;
++
i
)
{
for
(
size_t
i
=
0
;
i
<
size
;
++
i
)
{
...
...
paddle/utils/Flags.cpp
浏览文件 @
38de512d
...
@@ -20,7 +20,7 @@ DEFINE_bool(use_gpu, false, "Only support CPU training");
...
@@ -20,7 +20,7 @@ DEFINE_bool(use_gpu, false, "Only support CPU training");
DEFINE_bool
(
use_gpu
,
true
,
"Whether to use GPU for training"
);
DEFINE_bool
(
use_gpu
,
true
,
"Whether to use GPU for training"
);
#endif
#endif
#ifdef PADDLE_
USE
_MKLDNN
#ifdef PADDLE_
WITH
_MKLDNN
// TODO(TJ): change to true when MKLDNN layers support multi-inputs
// TODO(TJ): change to true when MKLDNN layers support multi-inputs
DEFINE_bool
(
use_mkldnn
,
false
,
"Default still keep use CPU training"
);
DEFINE_bool
(
use_mkldnn
,
false
,
"Default still keep use CPU training"
);
#else
#else
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录