Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
0ab33224
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0ab33224
编写于
10月 08, 2016
作者:
G
gangliao
提交者:
Yu Yang
10月 08, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Support MAC OS Sierra (#169)
上级
db380434
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
39 addition
and
13 deletion
+39
-13
cmake/flags.cmake
cmake/flags.cmake
+5
-0
paddle/cuda/src/hl_cuda_device.cc
paddle/cuda/src/hl_cuda_device.cc
+5
-1
paddle/pserver/SocketChannel.cpp
paddle/pserver/SocketChannel.cpp
+2
-1
paddle/setup.py.in
paddle/setup.py.in
+2
-0
paddle/utils/ThreadLocal.h
paddle/utils/ThreadLocal.h
+2
-8
paddle/utils/Util.cpp
paddle/utils/Util.cpp
+5
-1
paddle/utils/arch/osx/Locks.cpp
paddle/utils/arch/osx/Locks.cpp
+18
-2
未找到文件。
cmake/flags.cmake
浏览文件 @
0ab33224
...
...
@@ -71,6 +71,11 @@ foreach(flag ${COMMON_FLAGS})
safe_set_cxxflag
(
CMAKE_CXX_FLAGS
${
flag
}
)
endforeach
()
# On Mac OS X build fat binaries with x86_64 architectures by default.
if
(
APPLE
)
set
(
CMAKE_OSX_ARCHITECTURES
"x86_64"
CACHE STRING
"Build architectures for OSX"
FORCE
)
endif
()
# Release/Debug flags set by cmake. Such as -O3 -g -DNDEBUG etc.
# So, don't set these flags here.
...
...
paddle/cuda/src/hl_cuda_device.cc
浏览文件 @
0ab33224
...
...
@@ -211,7 +211,11 @@ bool hl_start_flag = false;
inline
pid_t
gettid
()
{
#if defined(__APPLE__) || defined(__OSX__)
pid_t
tid
=
syscall
(
SYS_thread_selfid
);
// syscall is deprecated: first deprecated in macOS 10.12.
// syscall is unsupported;
// syscall pid_t tid = syscall(SYS_thread_selfid);
uint64_t
tid
;
pthread_threadid_np
(
NULL
,
&
tid
);
#else
#ifndef __NR_gettid
#define __NR_gettid 224
...
...
paddle/pserver/SocketChannel.cpp
浏览文件 @
0ab33224
...
...
@@ -157,7 +157,8 @@ void SocketChannel::writeMessage(const std::vector<struct iovec>& userIovs) {
std
::
vector
<
iovec
>
iovs
;
iovs
.
reserve
(
userIovs
.
size
()
+
2
);
iovs
.
push_back
({
&
header
,
sizeof
(
header
)});
iovs
.
push_back
({
&
iovLengths
[
0
],
sizeof
(
iovLengths
[
0
])
*
header
.
numIovs
});
iovs
.
push_back
({
&
iovLengths
[
0
],
static_cast
<
size_t
>
(
sizeof
(
iovLengths
[
0
])
*
header
.
numIovs
)});
iovs
.
insert
(
iovs
.
end
(),
userIovs
.
begin
(),
userIovs
.
end
());
header
.
totalLength
=
0
;
...
...
paddle/setup.py.in
浏览文件 @
0ab33224
...
...
@@ -18,6 +18,7 @@ from setuptools import setup, Extension
import numpy as np
import api.paddle_ld_flags
import platform
import os
system = platform.system().lower()
...
...
@@ -45,6 +46,7 @@ except:
if is_lin == True:
extra_links = ["-Xlinker", '-start-group'] + extra_links + ["-Xlinker", "-end-group"]
elif is_osx == True:
os.environ["ARCHFLAGS"] = "-arch x86_64"
extra_links = ["-Wl,-all_load"] + extra_links
include_dirs = [np.get_include(), "../"] # include numpy and paddle.
...
...
paddle/utils/ThreadLocal.h
浏览文件 @
0ab33224
...
...
@@ -22,6 +22,7 @@ limitations under the License. */
#include <map>
#include <mutex>
#include <random>
#include "Util.h"
#include "Logging.h"
namespace
paddle
{
...
...
@@ -156,14 +157,7 @@ private:
static
void
dataDestructor
(
void
*
p
)
{
delete
(
T
*
)
p
;
}
void
updateMap
(
T
*
p
)
{
#if defined(__APPLE__) || defined(__OSX__)
pid_t
tid
=
syscall
(
SYS_thread_selfid
);
#else
#ifndef __NR_gettid
#define __NR_gettid 224
#endif
pid_t
tid
=
syscall
(
__NR_gettid
);
#endif
pid_t
tid
=
getTID
();
CHECK_NE
(
tid
,
-
1
);
std
::
lock_guard
<
std
::
mutex
>
guard
(
mutex_
);
auto
ret
=
threadMap_
.
insert
(
std
::
make_pair
(
tid
,
p
));
...
...
paddle/utils/Util.cpp
浏览文件 @
0ab33224
...
...
@@ -95,7 +95,11 @@ namespace paddle {
pid_t
getTID
()
{
#if defined(__APPLE__) || defined(__OSX__)
pid_t
tid
=
syscall
(
SYS_thread_selfid
);
// syscall is deprecated: first deprecated in macOS 10.12.
// syscall is unsupported;
// syscall pid_t tid = syscall(SYS_thread_selfid);
uint64_t
tid
;
pthread_threadid_np
(
NULL
,
&
tid
);
#else
#ifndef __NR_gettid
#define __NR_gettid 224
...
...
paddle/utils/arch/osx/Locks.cpp
浏览文件 @
0ab33224
...
...
@@ -16,6 +16,11 @@ limitations under the License. */
#include "paddle/utils/Logging.h"
#include <dispatch/dispatch.h>
#include <libkern/OSAtomic.h>
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
#include <os/lock.h>
#endif
namespace
paddle
{
class
SemaphorePrivate
{
...
...
@@ -50,21 +55,32 @@ void Semaphore::post() {
class
SpinLockPrivate
{
public:
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
os_unfair_lock
lock_
;
#else
SpinLockPrivate
()
:
lock_
(
OS_SPINLOCK_INIT
)
{}
OSSpinLock
lock_
;
char
padding_
[
64
-
sizeof
(
OSSpinLock
)];
// Padding to cache line size
#endif
char
padding_
[
64
-
sizeof
(
lock_
)];
// Padding to cache line size
};
SpinLock
::
SpinLock
()
:
m
(
new
SpinLockPrivate
())
{}
SpinLock
::~
SpinLock
()
{
delete
m
;
}
void
SpinLock
::
lock
()
{
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
os_unfair_lock_lock
(
&
m
->
lock_
);
#else
OSSpinLockLock
(
&
m
->
lock_
);
#endif
}
void
SpinLock
::
unlock
()
{
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
os_unfair_lock_unlock
(
&
m
->
lock_
);
#else
OSSpinLockUnlock
(
&
m
->
lock_
);
#endif
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录