Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
bba62235
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看板
未验证
提交
bba62235
编写于
11月 06, 2017
作者:
Y
Yiqun Liu
提交者:
GitHub
11月 06, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Enable the build for iOS simulator. (#5211)
上级
f8d4e756
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
76 addition
and
35 deletion
+76
-35
CMakeLists.txt
CMakeLists.txt
+1
-1
cmake/cross_compiling/ios.cmake
cmake/cross_compiling/ios.cmake
+2
-3
cmake/external/nccl.cmake
cmake/external/nccl.cmake
+18
-0
cmake/external/openblas.cmake
cmake/external/openblas.cmake
+3
-3
cmake/external/pybind11.cmake
cmake/external/pybind11.cmake
+23
-7
cmake/external/swig.cmake
cmake/external/swig.cmake
+3
-3
cmake/external/zlib.cmake
cmake/external/zlib.cmake
+3
-3
cmake/simd.cmake
cmake/simd.cmake
+12
-7
paddle/utils/Excepts.h
paddle/utils/Excepts.h
+1
-2
paddle/utils/arch/osx/Excepts.cpp
paddle/utils/arch/osx/Excepts.cpp
+8
-4
paddle/utils/tests/test_StringUtils.cpp
paddle/utils/tests/test_StringUtils.cpp
+2
-2
未找到文件。
CMakeLists.txt
浏览文件 @
bba62235
...
@@ -126,7 +126,7 @@ include(external/swig) # download, build, install swig
...
@@ -126,7 +126,7 @@ include(external/swig) # download, build, install swig
include
(
external/warpctc
)
# download, build, install warpctc
include
(
external/warpctc
)
# download, build, install warpctc
include
(
external/any
)
# download libn::any
include
(
external/any
)
# download libn::any
include
(
external/eigen
)
# download eigen3
include
(
external/eigen
)
# download eigen3
include
(
external/pybind11
)
# download pybind11
include
(
external/pybind11
)
# download pybind11
include
(
external/nccl
)
include
(
external/nccl
)
include
(
cudnn
)
# set cudnn libraries, must before configure
include
(
cudnn
)
# set cudnn libraries, must before configure
...
...
cmake/cross_compiling/ios.cmake
浏览文件 @
bba62235
...
@@ -79,9 +79,8 @@ if(NOT DEFINED IOS_ARCH)
...
@@ -79,9 +79,8 @@ if(NOT DEFINED IOS_ARCH)
# FIXME(liuyiqun): support "armv7;armv7s;arm64" future
# FIXME(liuyiqun): support "armv7;armv7s;arm64" future
set
(
IOS_ARCH
"arm64"
)
set
(
IOS_ARCH
"arm64"
)
elseif
(
IOS_PLATFORM STREQUAL
"SIMULATOR"
)
elseif
(
IOS_PLATFORM STREQUAL
"SIMULATOR"
)
set
(
IOS_ARCH
"i386;x86_64"
)
# FIXME(liuyiqun): support "i386;x86_64" future
elseif
(
IOS_PLATFORM STREQUAL
"WATCHOS"
)
set
(
IOS_ARCH
"x86_64"
)
set
(
IOS_ARCH armv7k
)
endif
()
endif
()
endif
()
endif
()
set
(
CMAKE_OSX_ARCHITECTURES
${
IOS_ARCH
}
CACHE string
"Build architecture for iOS"
)
set
(
CMAKE_OSX_ARCHITECTURES
${
IOS_ARCH
}
CACHE string
"Build architecture for iOS"
)
...
...
cmake/external/nccl.cmake
浏览文件 @
bba62235
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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.
if
(
NOT WITH_GPU
)
return
()
endif
()
include
(
ExternalProject
)
include
(
ExternalProject
)
set
(
NCCL_SOURCE_DIR
${
THIRD_PARTY_PATH
}
/nccl
)
set
(
NCCL_SOURCE_DIR
${
THIRD_PARTY_PATH
}
/nccl
)
...
...
cmake/external/openblas.cmake
浏览文件 @
bba62235
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
...
...
cmake/external/pybind11.cmake
浏览文件 @
bba62235
INCLUDE
(
ExternalProject
)
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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.
SET
(
PYBIND_SOURCE_DIR
${
THIRD_PARTY_PATH
}
/pybind
)
if
(
NOT WITH_PYTHON
)
return
()
endif
()
include
(
ExternalProject
)
INCLUDE_DIRECTORIES
(
${
PYBIND_SOURCE_DIR
}
/src/extern_pybind/include
)
set
(
PYBIND_SOURCE_DIR
${
THIRD_PARTY_PATH
}
/pybind
)
include_directories
(
${
PYBIND_SOURCE_DIR
}
/src/extern_pybind/include
)
ExternalProject_Add
(
ExternalProject_Add
(
extern_pybind
extern_pybind
...
@@ -17,14 +35,12 @@ ExternalProject_Add(
...
@@ -17,14 +35,12 @@ ExternalProject_Add(
TEST_COMMAND
""
TEST_COMMAND
""
)
)
if
(
${
CMAKE_VERSION
}
VERSION_LESS
"3.3.0"
)
if
(
${
CMAKE_VERSION
}
VERSION_LESS
"3.3.0"
)
set
(
dummyfile
${
CMAKE_CURRENT_BINARY_DIR
}
/pybind_dummy.c
)
set
(
dummyfile
${
CMAKE_CURRENT_BINARY_DIR
}
/pybind_dummy.c
)
file
(
WRITE
${
dummyfile
}
"const char * dummy_
any
=
\"
${
dummyfile
}
\"
;"
)
file
(
WRITE
${
dummyfile
}
"const char * dummy_
pybind
=
\"
${
dummyfile
}
\"
;"
)
add_library
(
pybind STATIC
${
dummyfile
}
)
add_library
(
pybind STATIC
${
dummyfile
}
)
else
()
else
()
add_library
(
pybind INTERFACE
)
add_library
(
pybind INTERFACE
)
endif
()
endif
()
add_dependencies
(
pybind extern_pybind
)
add_dependencies
(
pybind extern_pybind
)
LIST
(
APPEND external_project_dependencies pybind
)
cmake/external/swig.cmake
浏览文件 @
bba62235
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
...
...
cmake/external/zlib.cmake
浏览文件 @
bba62235
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
...
...
cmake/simd.cmake
浏览文件 @
bba62235
# This file is use to check all support level of AVX on your machine
# This file is use to check all support level of AVX on your machine
# 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
)
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"
)
set
(
SSE2_FLAG
"-msse2"
)
set
(
SSE2_FLAG
"-msse2"
)
set
(
SSE3_FLAG
"-msse3"
)
set
(
SSE3_FLAG
"-msse3"
)
SET
(
AVX_FLAG
"-mavx"
)
set
(
AVX_FLAG
"-mavx"
)
SET
(
AVX2_FLAG
"-mavx2"
)
set
(
AVX2_FLAG
"-mavx2"
)
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"
)
ENDIF
()
endif
()
set
(
CMAKE_REQUIRED_FLAGS_RETAINED
${
CMAKE_REQUIRED_FLAGS
}
)
set
(
CMAKE_REQUIRED_FLAGS_RETAINED
${
CMAKE_REQUIRED_FLAGS
}
)
# Check MMX
# Check MMX
set
(
CMAKE_REQUIRED_FLAGS
${
MMX_FLAG
}
)
set
(
CMAKE_REQUIRED_FLAGS
${
MMX_FLAG
}
)
set
(
MMX_FOUND_EXITCODE 1 CACHE STRING
"Result from TRY_RUN"
FORCE
)
CHECK_CXX_SOURCE_RUNS
(
"
CHECK_CXX_SOURCE_RUNS
(
"
#include <mmintrin.h>
#include <mmintrin.h>
int main()
int main()
...
@@ -32,6 +33,7 @@ int main()
...
@@ -32,6 +33,7 @@ int main()
# Check SSE2
# Check SSE2
set
(
CMAKE_REQUIRED_FLAGS
${
SSE2_FLAG
}
)
set
(
CMAKE_REQUIRED_FLAGS
${
SSE2_FLAG
}
)
set
(
SSE2_FOUND_EXITCODE 1 CACHE STRING
"Result from TRY_RUN"
FORCE
)
CHECK_CXX_SOURCE_RUNS
(
"
CHECK_CXX_SOURCE_RUNS
(
"
#include <emmintrin.h>
#include <emmintrin.h>
int main()
int main()
...
@@ -42,6 +44,7 @@ int main()
...
@@ -42,6 +44,7 @@ int main()
# Check SSE3
# Check SSE3
set
(
CMAKE_REQUIRED_FLAGS
${
SSE3_FLAG
}
)
set
(
CMAKE_REQUIRED_FLAGS
${
SSE3_FLAG
}
)
set
(
SSE3_FOUND_EXITCODE 1 CACHE STRING
"Result from TRY_RUN"
FORCE
)
CHECK_CXX_SOURCE_RUNS
(
"
CHECK_CXX_SOURCE_RUNS
(
"
#include <pmmintrin.h>
#include <pmmintrin.h>
int main()
int main()
...
@@ -55,6 +58,7 @@ int main()
...
@@ -55,6 +58,7 @@ int main()
# Check AVX
# Check AVX
set
(
CMAKE_REQUIRED_FLAGS
${
AVX_FLAG
}
)
set
(
CMAKE_REQUIRED_FLAGS
${
AVX_FLAG
}
)
set
(
AVX_FOUND_EXITCODE 1 CACHE STRING
"Result from TRY_RUN"
FORCE
)
CHECK_CXX_SOURCE_RUNS
(
"
CHECK_CXX_SOURCE_RUNS
(
"
#include <immintrin.h>
#include <immintrin.h>
int main()
int main()
...
@@ -67,6 +71,7 @@ int main()
...
@@ -67,6 +71,7 @@ int main()
# Check AVX 2
# Check AVX 2
set
(
CMAKE_REQUIRED_FLAGS
${
AVX2_FLAG
}
)
set
(
CMAKE_REQUIRED_FLAGS
${
AVX2_FLAG
}
)
set
(
AVX2_FOUND_EXITCODE 1 CACHE STRING
"Result from TRY_RUN"
FORCE
)
CHECK_CXX_SOURCE_RUNS
(
"
CHECK_CXX_SOURCE_RUNS
(
"
#include <immintrin.h>
#include <immintrin.h>
int main()
int main()
...
...
paddle/utils/Excepts.h
浏览文件 @
bba62235
...
@@ -17,8 +17,7 @@ limitations under the License. */
...
@@ -17,8 +17,7 @@ limitations under the License. */
#include <fenv.h>
#include <fenv.h>
#if (defined(__APPLE__) || defined(__OSX__)) && !defined(__arm__) && \
#if defined(__APPLE__) || defined(__OSX__)
!defined(__aarch64__)
int
fegetexcept
(
void
);
int
fegetexcept
(
void
);
int
feenableexcept
(
unsigned
int
excepts
);
int
feenableexcept
(
unsigned
int
excepts
);
...
...
paddle/utils/arch/osx/Excepts.cpp
浏览文件 @
bba62235
...
@@ -14,9 +14,13 @@ limitations under the License. */
...
@@ -14,9 +14,13 @@ limitations under the License. */
#include "paddle/utils/Excepts.h"
#include "paddle/utils/Excepts.h"
#if (defined(__APPLE__) || defined(__OSX__)) && !defined(__arm__) && \
#if defined(__APPLE__) || defined(__OSX__)
!defined(__aarch64__)
#if defined(__arm__) || defined(__arm64__)
// TODO(liuyiqun): implement the arm version
int
fegetexcept
(
void
)
{
return
-
1
;
}
int
feenableexcept
(
unsigned
int
excepts
)
{
return
-
1
;
}
int
fedisableexcept
(
unsigned
int
excepts
)
{
return
-
1
;
}
#else
int
fegetexcept
(
void
)
{
int
fegetexcept
(
void
)
{
static
fenv_t
fenv
;
static
fenv_t
fenv
;
return
fegetenv
(
&
fenv
)
?
-
1
:
(
fenv
.
__control
&
FE_ALL_EXCEPT
);
return
fegetenv
(
&
fenv
)
?
-
1
:
(
fenv
.
__control
&
FE_ALL_EXCEPT
);
...
@@ -49,5 +53,5 @@ int fedisableexcept(unsigned int excepts) {
...
@@ -49,5 +53,5 @@ int fedisableexcept(unsigned int excepts) {
return
(
fesetenv
(
&
fenv
)
?
-
1
:
old_excepts
);
return
(
fesetenv
(
&
fenv
)
?
-
1
:
old_excepts
);
}
}
#endif
#endif
#endif
paddle/utils/tests/test_StringUtils.cpp
浏览文件 @
bba62235
...
@@ -18,6 +18,6 @@ limitations under the License. */
...
@@ -18,6 +18,6 @@ limitations under the License. */
TEST
(
StringUtil
,
to
)
{
TEST
(
StringUtil
,
to
)
{
ASSERT_NEAR
(
paddle
::
str
::
to
<
double
>
(
"12.45"
),
12.45
,
1e-5
);
ASSERT_NEAR
(
paddle
::
str
::
to
<
double
>
(
"12.45"
),
12.45
,
1e-5
);
ASSERT_DEATH
(
paddle
::
str
::
to
<
double
>
(
"12.45x23"
),
".*"
);
ASSERT_DEATH
_IF_SUPPORTED
(
paddle
::
str
::
to
<
double
>
(
"12.45x23"
),
".*"
);
ASSERT_DEATH
(
paddle
::
str
::
to
<
int
>
(
""
),
".*"
);
ASSERT_DEATH
_IF_SUPPORTED
(
paddle
::
str
::
to
<
int
>
(
""
),
".*"
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录