Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
6f22951a
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
6f22951a
编写于
3月 21, 2017
作者:
L
liaogang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add simd check and set SSE3 as default compilation
上级
eda350b1
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
37 addition
and
1 deletion
+37
-1
CMakeLists.txt
CMakeLists.txt
+1
-1
paddle/utils/Common.h
paddle/utils/Common.h
+1
-0
paddle/utils/CpuId.h
paddle/utils/CpuId.h
+33
-0
paddle/utils/Util.cpp
paddle/utils/Util.cpp
+2
-0
未找到文件。
CMakeLists.txt
浏览文件 @
6f22951a
...
...
@@ -29,7 +29,7 @@ include(simd)
################################ Configurations #######################################
option
(
WITH_GPU
"Compile PaddlePaddle with NVIDIA GPU"
${
CUDA_FOUND
}
)
option
(
WITH_AVX
"Compile PaddlePaddle with AVX intrinsics"
${
AVX_FOUND
}
)
option
(
WITH_AVX
"Compile PaddlePaddle with AVX intrinsics"
OFF
)
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
)
...
...
paddle/utils/Common.h
浏览文件 @
6f22951a
...
...
@@ -14,6 +14,7 @@ limitations under the License. */
#pragma once
#include "Error.h"
#include "Excepts.h"
/**
...
...
paddle/utils/CpuId.h
浏览文件 @
6f22951a
...
...
@@ -97,4 +97,37 @@ private:
#define HAS_AVX512 HAS_SIMD(SIMD_AVX512)
// clang-format on
/**
* Invoke checkCPUFeature() before Paddle initialization to
* check target machine whether support compiled instructions.
* If not, simply throw out an error.
*/
inline
Error
__must_check
checkCPUFeature
()
{
Error
err
;
#ifndef __AVX__
if
(
HAS_AVX
)
{
LOG
(
WARNING
)
<<
"PaddlePaddle wasn't compiled to use avx instructions, "
<<
"but these are available on your machine and could "
<<
"speed up CPU computations via CMAKE .. -DWITH_AVX=ON"
;
}
#else
if
(
!
HAS_AVX
)
{
err
=
Errors
(
"PaddlePaddle was compiled to use avx instructions, "
"but these aren't available on your machine, please "
"disable it via CMAKE .. -DWITH_AVX=OFF"
);
}
#endif // __AVX__
#ifdef __SSE3__
if
(
!
HAS_SSE3
)
{
err
=
Error
(
"PaddlePaddle was compiled to use sse3 instructions, "
"which is the minimum requirement of PaddlePaddle. "
"But these aren't available on your current machine."
);
}
#endif // __SSE3__
return
err
;
}
}
// namespace paddle
paddle/utils/Util.cpp
浏览文件 @
6f22951a
...
...
@@ -26,6 +26,7 @@ limitations under the License. */
#include <gflags/gflags.h>
#include "CpuId.h"
#include "CustomStackTrace.h"
#include "Logging.h"
#include "StringUtil.h"
...
...
@@ -185,6 +186,7 @@ void initMain(int argc, char** argv) {
}
version
::
printVersion
();
checkCPUFeature
().
check
();
runInitFunctions
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录