Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
ccd3d0a4
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看板
提交
ccd3d0a4
编写于
3月 08, 2017
作者:
L
Liu Yiqun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Modify cmake for cross-compiling on arm architecture.
上级
df371329
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
94 addition
and
52 deletion
+94
-52
CMakeLists.txt
CMakeLists.txt
+1
-2
cmake/configure.cmake
cmake/configure.cmake
+2
-7
cmake/cudnn.cmake
cmake/cudnn.cmake
+4
-0
cmake/external/protobuf.cmake
cmake/external/protobuf.cmake
+61
-42
cmake/simd.cmake
cmake/simd.cmake
+26
-1
未找到文件。
CMakeLists.txt
浏览文件 @
ccd3d0a4
...
@@ -25,7 +25,6 @@ find_package(Git REQUIRED)
...
@@ -25,7 +25,6 @@ find_package(Git REQUIRED)
find_package
(
Threads REQUIRED
)
find_package
(
Threads REQUIRED
)
include
(
system
)
include
(
system
)
include
(
simd
)
################################ Configurations #######################################
################################ Configurations #######################################
option
(
WITH_GPU
"Compile PaddlePaddle with NVIDIA GPU"
${
CUDA_FOUND
}
)
option
(
WITH_GPU
"Compile PaddlePaddle with NVIDIA GPU"
${
CUDA_FOUND
}
)
...
@@ -65,6 +64,7 @@ include(external/openblas) # download, build, install openblas
...
@@ -65,6 +64,7 @@ include(external/openblas) # download, build, install openblas
include
(
external/swig
)
# download, build, install swig
include
(
external/swig
)
# download, build, install swig
include
(
external/warpctc
)
# download, build, install warpctc
include
(
external/warpctc
)
# download, build, install warpctc
include
(
simd
)
# set simd flag
include
(
package
)
# set paddle packages
include
(
package
)
# set paddle packages
include
(
cpplint
)
# set paddle c++ style
include
(
cpplint
)
# set paddle c++ style
include
(
ccache
)
# set ccache for compilation
include
(
ccache
)
# set ccache for compilation
...
@@ -74,7 +74,6 @@ include(flags) # set paddle compile flags
...
@@ -74,7 +74,6 @@ include(flags) # set paddle compile flags
include
(
cudnn
)
# set cudnn libraries
include
(
cudnn
)
# set cudnn libraries
include
(
version
)
# set PADDLE_VERSION
include
(
version
)
# set PADDLE_VERSION
include
(
coveralls
)
# set code coverage
include
(
coveralls
)
# set code coverage
include
(
configure
)
# add paddle env configuration
include
(
configure
)
# add paddle env configuration
include_directories
(
"
${
PROJ_ROOT
}
"
)
include_directories
(
"
${
PROJ_ROOT
}
"
)
...
...
cmake/configure.cmake
浏览文件 @
ccd3d0a4
...
@@ -59,10 +59,5 @@ else()
...
@@ -59,10 +59,5 @@ else()
include_directories
(
${
CUDA_TOOLKIT_INCLUDE
}
)
include_directories
(
${
CUDA_TOOLKIT_INCLUDE
}
)
endif
(
NOT WITH_GPU
)
endif
(
NOT WITH_GPU
)
if
(
WITH_AVX
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
${
SIMD_FLAG
}
"
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
${
AVX_FLAG
}
"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
${
SIMD_FLAG
}
"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
${
AVX_FLAG
}
"
)
else
(
WITH_AVX
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
${
SSE3_FLAG
}
"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
${
SSE3_FLAG
}
"
)
endif
(
WITH_AVX
)
cmake/cudnn.cmake
浏览文件 @
ccd3d0a4
if
(
NOT WITH_GPU
)
return
()
endif
()
set
(
CUDNN_ROOT
""
CACHE PATH
"CUDNN ROOT"
)
set
(
CUDNN_ROOT
""
CACHE PATH
"CUDNN ROOT"
)
find_path
(
CUDNN_INCLUDE_DIR cudnn.h
find_path
(
CUDNN_INCLUDE_DIR cudnn.h
PATHS
${
CUDNN_ROOT
}
${
CUDNN_ROOT
}
/include
PATHS
${
CUDNN_ROOT
}
${
CUDNN_ROOT
}
/include
...
...
cmake/external/protobuf.cmake
浏览文件 @
ccd3d0a4
...
@@ -12,15 +12,31 @@
...
@@ -12,15 +12,31 @@
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
INCLUDE
(
ExternalProject
)
FIND_PACKAGE
(
Protobuf REQUIRED
)
IF
(
Protobuf_FOUND
)
# Check protobuf library version.
execute_process
(
COMMAND
${
PROTOBUF_PROTOC_EXECUTABLE
}
--version
OUTPUT_VARIABLE PROTOBUF_VERSION
)
string
(
REPLACE
"libprotoc "
""
PROTOBUF_VERSION
${
PROTOBUF_VERSION
}
)
#MESSAGE("PROTOBUF_INCLUDE_DIR: " ${PROTOBUF_INCLUDE_DIR})
#MESSAGE("PROTOBUF_LITE_LIBRARY: " ${PROTOBUF_LITE_LIBRARY})
#MESSAGE("PROTOBUF_LIBRARY: " ${PROTOBUF_LIBRARY})
#MESSAGE("PROTOBUF_PROTOC_LIBRARY: " ${PROTOBUF_PROTOC_LIBRARY})
#MESSAGE("PROTOBUF_PROTOC_EXECUTABLE: " ${PROTOBUF_PROTOC_EXECUTABLE})
SET
(
PROTOBUF_SOURCES_DIR
${
THIRD_PARTY_PATH
}
/protobuf
)
set
(
PROTOBUF_3 OFF
)
SET
(
PROTOBUF_INSTALL_DIR
${
THIRD_PARTY_PATH
}
/install/protobuf
)
if
(
${
PROTOBUF_VERSION
}
VERSION_GREATER
"3.0.0"
OR
${
PROTOBUF_VERSION
}
VERSION_EQUAL
"3.0.0"
)
SET
(
PROTOBUF_INCLUDE_DIR
"
${
PROTOBUF_INSTALL_DIR
}
/include"
CACHE PATH
"protobuf include directory."
FORCE
)
set
(
PROTOBUF_3 ON
)
endif
()
ELSE
()
INCLUDE_DIRECTORIES
(
${
PROTOBUF_INCLUDE_DIR
}
)
INCLUDE
(
ExternalProject
)
SET
(
PROTOBUF_SOURCES_DIR
${
THIRD_PARTY_PATH
}
/protobuf
)
SET
(
PROTOBUF_INSTALL_DIR
${
THIRD_PARTY_PATH
}
/install/protobuf
)
SET
(
PROTOBUF_INCLUDE_DIR
"
${
PROTOBUF_INSTALL_DIR
}
/include"
CACHE PATH
"protobuf include directory."
FORCE
)
IF
(
WIN32
)
IF
(
WIN32
)
SET
(
PROTOBUF_LITE_LIBRARY
SET
(
PROTOBUF_LITE_LIBRARY
"
${
PROTOBUF_INSTALL_DIR
}
/lib/libprotobuf-lite.lib"
CACHE FILEPATH
"protobuf lite library."
FORCE
)
"
${
PROTOBUF_INSTALL_DIR
}
/lib/libprotobuf-lite.lib"
CACHE FILEPATH
"protobuf lite library."
FORCE
)
SET
(
PROTOBUF_LIBRARY
SET
(
PROTOBUF_LIBRARY
...
@@ -28,7 +44,7 @@ IF(WIN32)
...
@@ -28,7 +44,7 @@ IF(WIN32)
SET
(
PROTOBUF_PROTOC_LIBRARY
SET
(
PROTOBUF_PROTOC_LIBRARY
"
${
PROTOBUF_INSTALL_DIR
}
/lib/libprotoc.lib"
CACHE FILEPATH
"protoc library."
FORCE
)
"
${
PROTOBUF_INSTALL_DIR
}
/lib/libprotoc.lib"
CACHE FILEPATH
"protoc library."
FORCE
)
SET
(
PROTOBUF_PROTOC_EXECUTABLE
"
${
PROTOBUF_INSTALL_DIR
}
/bin/protoc.exe"
CACHE FILEPATH
"protobuf executable."
FORCE
)
SET
(
PROTOBUF_PROTOC_EXECUTABLE
"
${
PROTOBUF_INSTALL_DIR
}
/bin/protoc.exe"
CACHE FILEPATH
"protobuf executable."
FORCE
)
ELSE
(
WIN32
)
ELSE
(
WIN32
)
SET
(
PROTOBUF_LITE_LIBRARY
SET
(
PROTOBUF_LITE_LIBRARY
"
${
PROTOBUF_INSTALL_DIR
}
/lib/libprotobuf-lite.a"
CACHE FILEPATH
"protobuf lite library."
FORCE
)
"
${
PROTOBUF_INSTALL_DIR
}
/lib/libprotobuf-lite.a"
CACHE FILEPATH
"protobuf lite library."
FORCE
)
SET
(
PROTOBUF_LIBRARY
SET
(
PROTOBUF_LIBRARY
...
@@ -36,9 +52,9 @@ ELSE(WIN32)
...
@@ -36,9 +52,9 @@ ELSE(WIN32)
SET
(
PROTOBUF_PROTOC_LIBRARY
SET
(
PROTOBUF_PROTOC_LIBRARY
"
${
PROTOBUF_INSTALL_DIR
}
/lib/libprotoc.a"
CACHE FILEPATH
"protoc library."
FORCE
)
"
${
PROTOBUF_INSTALL_DIR
}
/lib/libprotoc.a"
CACHE FILEPATH
"protoc library."
FORCE
)
SET
(
PROTOBUF_PROTOC_EXECUTABLE
"
${
PROTOBUF_INSTALL_DIR
}
/bin/protoc"
CACHE FILEPATH
"protobuf executable."
FORCE
)
SET
(
PROTOBUF_PROTOC_EXECUTABLE
"
${
PROTOBUF_INSTALL_DIR
}
/bin/protoc"
CACHE FILEPATH
"protobuf executable."
FORCE
)
ENDIF
(
WIN32
)
ENDIF
(
WIN32
)
ExternalProject_Add
(
ExternalProject_Add
(
protobuf
protobuf
${
EXTERNAL_PROJECT_LOG_ARGS
}
${
EXTERNAL_PROJECT_LOG_ARGS
}
PREFIX
${
PROTOBUF_SOURCES_DIR
}
PREFIX
${
PROTOBUF_SOURCES_DIR
}
...
@@ -54,6 +70,9 @@ ExternalProject_Add(
...
@@ -54,6 +70,9 @@ ExternalProject_Add(
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=
${
PROTOBUF_INSTALL_DIR
}
-DCMAKE_INSTALL_PREFIX=
${
PROTOBUF_INSTALL_DIR
}
-DCMAKE_INSTALL_LIBDIR=lib
-DCMAKE_INSTALL_LIBDIR=lib
)
)
LIST
(
APPEND external_project_dependencies protobuf
)
LIST
(
APPEND external_project_dependencies protobuf
)
ENDIF
()
INCLUDE_DIRECTORIES
(
${
PROTOBUF_INCLUDE_DIR
}
)
cmake/simd.cmake
浏览文件 @
ccd3d0a4
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
# so that PaddlePaddle can unleash the vectorization power of muticore.
# so that PaddlePaddle can unleash the vectorization power of muticore.
INCLUDE
(
CheckCXXSourceRuns
)
INCLUDE
(
CheckCXXSourceRuns
)
INCLUDE
(
CheckCXXSourceCompiles
)
IF
(
CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES
"Clang"
)
IF
(
CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES
"Clang"
)
set
(
MMX_FLAG
"-mmmx"
)
set
(
MMX_FLAG
"-mmmx"
)
...
@@ -9,12 +10,14 @@ IF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID
...
@@ -9,12 +10,14 @@ IF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID
set
(
SSE3_FLAG
"-msse3"
)
set
(
SSE3_FLAG
"-msse3"
)
SET
(
AVX_FLAG
"-mavx"
)
SET
(
AVX_FLAG
"-mavx"
)
SET
(
AVX2_FLAG
"-mavx2"
)
SET
(
AVX2_FLAG
"-mavx2"
)
SET
(
NEON_FLAG
"-mfloat-abi=softfp -mfpu=neon"
)
ELSEIF
(
MSVC
)
ELSEIF
(
MSVC
)
set
(
MMX_FLAG
"/arch:MMX"
)
set
(
MMX_FLAG
"/arch:MMX"
)
set
(
SSE2_FLAG
"/arch:SSE2"
)
set
(
SSE2_FLAG
"/arch:SSE2"
)
set
(
SSE3_FLAG
"/arch:SSE3"
)
set
(
SSE3_FLAG
"/arch:SSE3"
)
SET
(
AVX_FLAG
"/arch:AVX"
)
SET
(
AVX_FLAG
"/arch:AVX"
)
SET
(
AVX2_FLAG
"/arch:AVX2"
)
SET
(
AVX2_FLAG
"/arch:AVX2"
)
#SET(NEON_FLAG "")
ENDIF
()
ENDIF
()
# Check MMX
# Check MMX
...
@@ -73,4 +76,26 @@ int main()
...
@@ -73,4 +76,26 @@ int main()
return 0;
return 0;
}"
AVX2_FOUND
)
}"
AVX2_FOUND
)
mark_as_advanced
(
MMX_FOUND SSE2_FOUND SSE3_FOUND AVX_FOUND AVX2_FOUND
)
# Check NEON
set
(
CMAKE_REQUIRED_FLAGS
${
NEON_FLAG
}
)
CHECK_CXX_SOURCE_COMPILES
(
"
#include <arm_neon.h>
int main()
{
float32x4_t a = {-1.0f, 2.0f, -3.0f, 4.0f};
float32x4_t b = {1.0f, 2.0f, 3.0f, 4.0f};
float32x4_t c = vaddq_f32(a, b);
return 0;
}"
NEON_FOUND
)
if
(
NEON_FOUND
)
set
(
SIMD_FLAG
${
NEON_FLAG
}
)
else
(
NEON_FOUND
)
if
(
WITH_AVX
)
set
(
SIMD_FLAG
${
AVX_FLAG
}
)
else
(
WITH_AVX
)
set
(
SIMD_FLAG
${
SSE3_FLAG
}
)
endif
(
WITH_AVX
)
endif
(
NEON_FOUND
)
mark_as_advanced
(
MMX_FOUND SSE2_FOUND SSE3_FOUND AVX_FOUND AVX2_FOUND NEON_FOUND
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录