Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
577bb4e3
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看板
提交
577bb4e3
编写于
7月 20, 2017
作者:
T
tensor-tang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename mkllite to mklml
上级
1601c34a
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
83 addition
and
36 deletion
+83
-36
CMakeLists.txt
CMakeLists.txt
+5
-5
cmake/cblas.cmake
cmake/cblas.cmake
+7
-21
cmake/configure.cmake
cmake/configure.cmake
+1
-1
cmake/external/gtest.cmake
cmake/external/gtest.cmake
+3
-3
cmake/external/mkldnn.cmake
cmake/external/mkldnn.cmake
+4
-4
cmake/external/mklml.cmake
cmake/external/mklml.cmake
+61
-0
paddle/math/MathFunctions.cpp
paddle/math/MathFunctions.cpp
+1
-1
paddle/math/MathFunctions.h
paddle/math/MathFunctions.h
+1
-1
未找到文件。
CMakeLists.txt
浏览文件 @
577bb4e3
...
...
@@ -38,7 +38,7 @@ include(simd)
option
(
WITH_GPU
"Compile PaddlePaddle with NVIDIA GPU"
${
CUDA_FOUND
}
)
option
(
WITH_AVX
"Compile PaddlePaddle with AVX intrinsics"
${
AVX_FOUND
}
)
option
(
WITH_MKLDNN
"Compile PaddlePaddle with mkl-dnn support."
${
AVX_FOUND
}
)
option
(
WITH_MKL
_LITE
"Compile PaddlePaddle with mkl lite package."
${
AVX_FOUND
}
)
option
(
WITH_MKL
ML
"Compile PaddlePaddle with mklml package."
${
AVX_FOUND
}
)
option
(
WITH_DSO
"Compile PaddlePaddle with dynamic linked CUDA"
ON
)
option
(
WITH_TESTING
"Compile PaddlePaddle with unit testing"
ON
)
option
(
WITH_SWIG_PY
"Compile PaddlePaddle with inference api"
ON
)
...
...
@@ -79,8 +79,8 @@ if(ANDROID)
"Disable RDMA when cross-compiling for Android"
FORCE
)
set
(
WITH_MKLDNN OFF CACHE STRING
"Disable MKLDNN when cross-compiling for Android"
FORCE
)
set
(
WITH_MKL
_LITE
OFF CACHE STRING
"Disable MKL
lite
package when cross-compiling for Android"
FORCE
)
set
(
WITH_MKL
ML
OFF CACHE STRING
"Disable MKL
ML
package when cross-compiling for Android"
FORCE
)
endif
(
ANDROID
)
set
(
THIRD_PARTY_PATH
"
${
CMAKE_BINARY_DIR
}
/third_party"
CACHE STRING
...
...
@@ -94,7 +94,7 @@ endif()
########################################################################################
include
(
external/mkl
lite
)
# download mkl minimal lite
package
include
(
external/mkl
ml
)
# download mklml
package
include
(
external/zlib
)
# download, build, install zlib
include
(
external/gflags
)
# download, build, install gflags
include
(
external/glog
)
# download, build, install glog
...
...
@@ -145,7 +145,7 @@ if(WITH_GPU)
endif
(
WITH_GPU
)
if
(
WITH_MKLDNN
)
list
(
APPEND EXTERNAL_LIBS
${
MKLDNN_LIBRARY
}
${
MKL
_LITE
_LIB_IOMP
}
)
list
(
APPEND EXTERNAL_LIBS
${
MKLDNN_LIBRARY
}
${
MKL
ML
_LIB_IOMP
}
)
endif
()
if
(
USE_NNPACK
)
...
...
cmake/cblas.cmake
浏览文件 @
577bb4e3
...
...
@@ -15,17 +15,17 @@
set
(
CBLAS_FOUND OFF
)
## Find MKL
Lite
First.
if
(
WITH_MKL
_LITE AND MKL_LITE_INC_DIR AND MKL_LITE
_LIB
)
## Find MKL
ML
First.
if
(
WITH_MKL
ML AND MKLML_INC_DIR AND MKLML
_LIB
)
set
(
CBLAS_FOUND ON
)
set
(
CBLAS_PROVIDER MKL
_LITE
)
set
(
CBLAS_INC_DIR
${
MKL
_LITE
_INC_DIR
}
)
set
(
CBLAS_LIBRARIES
${
MKL
_LITE
_LIB
}
)
set
(
CBLAS_PROVIDER MKL
ML
)
set
(
CBLAS_INC_DIR
${
MKL
ML
_INC_DIR
}
)
set
(
CBLAS_LIBRARIES
${
MKL
ML
_LIB
}
)
add_definitions
(
-DPADDLE_USE_MKL
_LITE
)
add_definitions
(
-DPADDLE_USE_MKL
ML
)
add_definitions
(
-DLAPACK_FOUND
)
message
(
STATUS
"Found cblas and lapack in MKL
Lite
"
message
(
STATUS
"Found cblas and lapack in MKL
ML
"
"(include:
${
CBLAS_INC_DIR
}
, library:
${
CBLAS_LIBRARIES
}
)"
)
return
()
endif
()
...
...
@@ -43,20 +43,6 @@ set(MKL_LIB_SEARCH_PATHS
${
INTEL_MKL_ROOT
}
/lib
${
INTEL_MKL_ROOT
}
/lib/intel64
)
if
(
MKL_LITE_INC_DIR AND MKL_LITE_LIB
)
set
(
CBLAS_FOUND ON
)
set
(
CBLAS_PROVIDER MKL_LITE
)
set
(
CBLAS_INC_DIR
${
MKL_LITE_INC_DIR
}
)
set
(
CBLAS_LIBRARIES
${
MKL_LITE_LIB
}
)
add_definitions
(
-DPADDLE_USE_MKL_LITE
)
add_definitions
(
-DLAPACK_FOUND
)
message
(
STATUS
"Found cblas and lapack in MKL Lite "
"(include:
${
MKL_LITE_INC_DIR
}
, library:
${
CBLAS_LIBRARIES
}
)"
)
return
()
endif
()
find_path
(
MKL_INC_DIR mkl.h PATHS
${
MKL_INCLUDE_SEARCH_PATHS
}
)
find_path
(
MKL_LAPACK_INC_DIR mkl_lapacke.h PATHS
...
...
cmake/configure.cmake
浏览文件 @
577bb4e3
...
...
@@ -69,7 +69,7 @@ endif(NOT WITH_GPU)
if
(
WITH_MKLDNN
)
add_definitions
(
-DPADDLE_USE_MKLDNN
)
if
(
WITH_MKL
_LITE
AND MKLDNN_IOMP_DIR
)
if
(
WITH_MKL
ML
AND MKLDNN_IOMP_DIR
)
message
(
STATUS
"Enable Intel OpenMP at
${
MKLDNN_IOMP_DIR
}
"
)
set
(
OPENMP_FLAGS
"-fopenmp"
)
set
(
CMAKE_C_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS
${
OPENMP_FLAGS
}
)
...
...
cmake/external/gtest.cmake
浏览文件 @
577bb4e3
...
...
@@ -34,9 +34,9 @@ IF(WITH_TESTING)
"
${
GTEST_INSTALL_DIR
}
/lib/libgtest_main.a"
CACHE FILEPATH
"gtest main libraries."
FORCE
)
ENDIF
(
WIN32
)
IF
(
WITH_MKL
_LITE
)
# wait for mkl downloading completed
SET
(
GTEST_DEPENDS
${
MKL
_LITE
_PROJECT
}
)
IF
(
WITH_MKL
ML
)
# wait for mkl
ml
downloading completed
SET
(
GTEST_DEPENDS
${
MKL
ML
_PROJECT
}
)
ENDIF
()
ExternalProject_Add
(
...
...
cmake/external/mkldnn.cmake
浏览文件 @
577bb4e3
...
...
@@ -38,10 +38,10 @@ ENDIF(WIN32)
INCLUDE_DIRECTORIES
(
${
MKLDNN_INCLUDE_DIR
}
)
IF
(
${
CBLAS_PROVIDER
}
STREQUAL
"MKL
_LITE
"
)
SET
(
MKLDNN_DEPENDS
${
MKL
_LITE
_PROJECT
}
)
SET
(
MKLDNN_MKLROOT
${
MKL
_LITE
_ROOT
}
)
SET
(
MKLDNN_IOMP_DIR
${
MKL
_LITE
_LIB_DIR
}
)
IF
(
${
CBLAS_PROVIDER
}
STREQUAL
"MKL
ML
"
)
SET
(
MKLDNN_DEPENDS
${
MKL
ML
_PROJECT
}
)
SET
(
MKLDNN_MKLROOT
${
MKL
ML
_ROOT
}
)
SET
(
MKLDNN_IOMP_DIR
${
MKL
ML
_LIB_DIR
}
)
ENDIF
()
ExternalProject_Add
(
...
...
cmake/external/mkl
lite
.cmake
→
cmake/external/mkl
ml
.cmake
浏览文件 @
577bb4e3
...
...
@@ -12,33 +12,33 @@
# See the License for the specific language governing permissions and
# limitations under the License.
IF
(
NOT
${
WITH_MKL
_LITE
}
)
IF
(
NOT
${
WITH_MKL
ML
}
)
return
()
ENDIF
(
NOT
${
WITH_MKL
_LITE
}
)
ENDIF
(
NOT
${
WITH_MKL
ML
}
)
INCLUDE
(
ExternalProject
)
SET
(
MKL
_LITE_PROJECT
"extern_mkllite
"
)
SET
(
MKL
_LITE
_VER
"mklml_lnx_2018.0.20170425"
)
SET
(
MKL
_LITE_URL
"https://github.com/01org/mkl-dnn/releases/download/v0.9/
${
MKL_LITE
_VER
}
.tgz"
)
SET
(
MKL
_LITE_DOWNLOAD_DIR
${
THIRD_PARTY_PATH
}
/mkllite
)
SET
(
MKL
ML_PROJECT
"extern_mklml
"
)
SET
(
MKL
ML
_VER
"mklml_lnx_2018.0.20170425"
)
SET
(
MKL
ML_URL
"https://github.com/01org/mkl-dnn/releases/download/v0.9/
${
MKLML
_VER
}
.tgz"
)
SET
(
MKL
ML_DOWNLOAD_DIR
${
THIRD_PARTY_PATH
}
/mklml
)
SET
(
MKL
_LITE_ROOT
${
MKL_LITE_DOWNLOAD_DIR
}
/
${
MKL_LITE
_VER
}
)
SET
(
MKL
_LITE_INC_DIR
${
MKL_LITE
_ROOT
}
/include
)
SET
(
MKL
_LITE_LIB_DIR
${
MKL_LITE
_ROOT
}
/lib
)
SET
(
MKL
_LITE_LIB
${
MKL_LITE
_LIB_DIR
}
/libmklml_intel.so
)
SET
(
MKL
_LITE_IOMP_LIB
${
MKL_LITE
_LIB_DIR
}
/libiomp5.so
)
SET
(
CMAKE_INSTALL_RPATH
"
${
CMAKE_INSTALL_RPATH
}
"
"
${
MKL
_LITE
_ROOT
}
/lib"
)
SET
(
MKL
ML_ROOT
${
MKLML_DOWNLOAD_DIR
}
/
${
MKLML
_VER
}
)
SET
(
MKL
ML_INC_DIR
${
MKLML
_ROOT
}
/include
)
SET
(
MKL
ML_LIB_DIR
${
MKLML
_ROOT
}
/lib
)
SET
(
MKL
ML_LIB
${
MKLML
_LIB_DIR
}
/libmklml_intel.so
)
SET
(
MKL
ML_IOMP_LIB
${
MKLML
_LIB_DIR
}
/libiomp5.so
)
SET
(
CMAKE_INSTALL_RPATH
"
${
CMAKE_INSTALL_RPATH
}
"
"
${
MKL
ML
_ROOT
}
/lib"
)
INCLUDE_DIRECTORIES
(
${
MKL
_LITE
_INC_DIR
}
)
INCLUDE_DIRECTORIES
(
${
MKL
ML
_INC_DIR
}
)
ExternalProject_Add
(
${
MKL
_LITE
_PROJECT
}
${
MKL
ML
_PROJECT
}
${
EXTERNAL_PROJECT_LOG_ARGS
}
PREFIX
${
MKL
_LITE
_DOWNLOAD_DIR
}
DOWNLOAD_DIR
${
MKL
_LITE
_DOWNLOAD_DIR
}
DOWNLOAD_COMMAND wget --no-check-certificate
${
MKL_LITE
_URL
}
&& tar -xzf
${
MKL
_LITE_DOWNLOAD_DIR
}
/
${
MKL_LITE
_VER
}
.tgz
PREFIX
${
MKL
ML
_DOWNLOAD_DIR
}
DOWNLOAD_DIR
${
MKL
ML
_DOWNLOAD_DIR
}
DOWNLOAD_COMMAND wget --no-check-certificate
-O
${
MKLML_DOWNLOAD_DIR
}
/
${
MKLML_VER
}
.tgz
${
MKLML
_URL
}
&& tar -xzf
${
MKL
ML_DOWNLOAD_DIR
}
/
${
MKLML
_VER
}
.tgz
DOWNLOAD_NO_PROGRESS 1
UPDATE_COMMAND
""
PATCH_COMMAND
""
...
...
@@ -49,13 +49,13 @@ ExternalProject_Add(
)
IF
(
${
CMAKE_VERSION
}
VERSION_LESS
"3.3.0"
)
SET
(
dummyfile
${
CMAKE_CURRENT_BINARY_DIR
}
/mkl
lite
_dummy.c
)
FILE
(
WRITE
${
dummyfile
}
"const char * dummy_mkl
lite
=
\"
${
dummyfile
}
\"
;"
)
ADD_LIBRARY
(
mkl
lite
STATIC
${
dummyfile
}
)
SET
(
dummyfile
${
CMAKE_CURRENT_BINARY_DIR
}
/mkl
ml
_dummy.c
)
FILE
(
WRITE
${
dummyfile
}
"const char * dummy_mkl
ml
=
\"
${
dummyfile
}
\"
;"
)
ADD_LIBRARY
(
mkl
ml
STATIC
${
dummyfile
}
)
ELSE
()
ADD_LIBRARY
(
mkl
lite
INTERFACE
)
ADD_LIBRARY
(
mkl
ml
INTERFACE
)
ENDIF
()
ADD_DEPENDENCIES
(
mkl
lite
${
MKL_LITE
_PROJECT
}
)
ADD_DEPENDENCIES
(
mkl
ml
${
MKLML
_PROJECT
}
)
LIST
(
APPEND external_project_dependencies mkl
lite
)
LIST
(
APPEND external_project_dependencies mkl
ml
)
paddle/math/MathFunctions.cpp
浏览文件 @
577bb4e3
...
...
@@ -202,7 +202,7 @@ double dotProduct<double>(const int n, const double* x, const double* y) {
return
cblas_ddot
(
n
,
x
,
1
,
y
,
1
);
}
#if defined(PADDLE_USE_MKL) || defined(PADDLE_USE_MKL
_LITE
)
#if defined(PADDLE_USE_MKL) || defined(PADDLE_USE_MKL
ML
)
template
<
>
void
vExp
<
float
>
(
const
int
n
,
const
float
*
a
,
float
*
r
)
{
...
...
paddle/math/MathFunctions.h
浏览文件 @
577bb4e3
...
...
@@ -15,7 +15,7 @@ limitations under the License. */
#ifndef MATHFUNCTIONS_H_
#define MATHFUNCTIONS_H_
#ifdef PADDLE_USE_MKL
_LITE
#ifdef PADDLE_USE_MKL
ML
#include <mkl_cblas.h>
#include <mkl_lapacke.h>
#include <mkl_vml_functions.h>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录