Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
aa147b74
MegEngine
项目概览
MegEngine 天元
/
MegEngine
1 年多 前同步成功
通知
403
Star
4705
Fork
582
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
MegEngine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
aa147b74
编写于
7月 09, 2020
作者:
M
Megvii Engine Team
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(osx/python_module): fix build python module on osx
GitOrigin-RevId: 5dde1b4e81a841c588f6e8d82bbdd35fc6cf7fb1
上级
1e576e32
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
31 addition
and
7 deletion
+31
-7
python_module/CMakeLists.txt
python_module/CMakeLists.txt
+10
-2
python_module/src/cpp/megbrain_wrap.cpp
python_module/src/cpp/megbrain_wrap.cpp
+2
-2
python_module/src/cpp/megbrain_wrap.h
python_module/src/cpp/megbrain_wrap.h
+1
-1
python_module/src/cpp/plugin.cpp
python_module/src/cpp/plugin.cpp
+7
-0
python_module/src/swig/comp_node.i
python_module/src/swig/comp_node.i
+1
-1
python_module/src/swig/mgb.i
python_module/src/swig/mgb.i
+10
-1
未找到文件。
python_module/CMakeLists.txt
浏览文件 @
aa147b74
...
...
@@ -11,7 +11,11 @@ find_package(NumPy REQUIRED)
find_package
(
SWIG REQUIRED
)
set
(
SWIG_SRC src/swig/mgb.i
)
set
(
CMAKE_SWIG_FLAGS -Wall -threads -py3 -modern -DSWIGWORDSIZE64
)
if
(
APPLE
)
set
(
CMAKE_SWIG_FLAGS -Wall -threads -py3 -modern
)
else
()
set
(
CMAKE_SWIG_FLAGS -Wall -threads -py3 -modern -DSWIGWORDSIZE64
)
endif
()
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wno-unused-parameter"
)
file
(
GLOB_RECURSE OPR_DECL_SRCS
"
${
PROJECT_SOURCE_DIR
}
/src/**/*.oprdecl"
)
...
...
@@ -66,7 +70,11 @@ set(VERSION_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/src/version.ld)
add_custom_target
(
version_ld SOURCES
${
VERSION_SCRIPT
}
)
set_target_properties
(
mgb PROPERTIES LIBRARY_OUTPUT_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
/megengine/_internal
)
target_link_libraries
(
mgb megbrain megdnn -Wl,--version-script=
${
VERSION_SCRIPT
}
)
if
(
APPLE
)
target_link_libraries
(
mgb megbrain megdnn
)
else
()
target_link_libraries
(
mgb megbrain megdnn -Wl,--version-script=
${
VERSION_SCRIPT
}
)
endif
()
target_include_directories
(
mgb PRIVATE
${
PYTHON_INCLUDE_DIRS
}
src/cpp
${
CMAKE_CURRENT_BINARY_DIR
}
${
NUMPY_INCLUDE_DIR
}
)
target_link_libraries
(
mgb
${
PYTHON_LIBRARIES
}
)
...
...
python_module/src/cpp/megbrain_wrap.cpp
浏览文件 @
aa147b74
...
...
@@ -404,7 +404,7 @@ void CompGraphCallbackValueProxy::do_copy() {
m_copy_event
->
record
();
}
void
CompGraphCallbackValueProxy
::
sync
()
{
void
CompGraphCallbackValueProxy
::
sync
()
const
{
mgb_assert
(
!
m_use_raw_hv
);
RealTimer
t0
;
double
next_warn_time
=
2
,
warn_time_delta
=
1
;
...
...
@@ -516,7 +516,7 @@ class AsyncExec::Core {
class
Worker
final
:
public
AsyncQueueSC
<
CallbackParam
,
Worker
>
{
public:
void
process_one_task
(
CallbackParam
&
task
)
{
void
process_one_task
(
const
CallbackParam
&
task
)
{
for
(
auto
&
tmp_value
:
task
.
value
)
{
tmp_value
.
sync
();
}
...
...
python_module/src/cpp/megbrain_wrap.h
浏览文件 @
aa147b74
...
...
@@ -214,7 +214,7 @@ class CompGraphCallbackValueProxy {
}
void
setup
(
const
mgb
::
DeviceTensorND
&
val
,
bool
eager_copy
);
void
sync
();
void
sync
()
const
;
/*!
* \brief called after python callback returned
...
...
python_module/src/cpp/plugin.cpp
浏览文件 @
aa147b74
...
...
@@ -76,8 +76,15 @@ class _FastSignal::Impl {
std
::
unordered_map
<
int
,
HandlerCallback
>
m_handler_callbacks
;
void
worker
()
{
#ifdef __APPLE__
uint64_t
tid
;
pthread_threadid_np
(
NULL
,
&
tid
);
mgb_log
(
"fast signal worker started in thread 0x%zx"
,
static_cast
<
size_t
>
(
tid
));
#else
mgb_log
(
"fast signal worker started in thread 0x%zx"
,
static_cast
<
size_t
>
(
pthread_self
()));
#endif
mgb
::
sys
::
set_thread_name
(
"fastsgl"
);
int
signum
;
for
(;
;
)
{
...
...
python_module/src/swig/comp_node.i
浏览文件 @
aa147b74
...
...
@@ -28,7 +28,7 @@ class CompNode {
static
CompNode
load
(
const
char
*
id
)
;
%
extend
{
static
std
::
vector
<
int
>
_parse_locator
(
const
std
::
string
&
id)
const
{
static
std
::
vector
<
int
>
_parse_locator
(
const
std
::
string
&
id)
{
auto
logi
=
CompNode
::
Locator
::
parse
(
id
)
;
return
{
static_cast
<
int
>
(
logi
.
type
),
logi
.
device
,
logi
.
stream
,
...
...
python_module/src/swig/mgb.i
浏览文件 @
aa147b74
...
...
@@ -31,7 +31,16 @@ void _init_bfloat16_types(PyObject *m); // implemented in bfloat16.cpp
%
template
(
_VectorString
)
std
::
vector
<
std
::
string
>
;
%
template
(
_PairStringSizeT
)
std
::
pair
<
std
::
string
,
size_t
>
;
%
template
(
_PairSizeTSizeT
)
std
::
pair
<
size_t
,
size_t
>
;
%
template
(
_VectorPairUint64String
)
std
::
vector
<
std
::
pair
<
uint64_t
,
std
::
string
>>
;
/*
*
* real define uint64_t here, BUT, do not define SWIGWORDSIZE64
* at osx env, at this time uint64_t means unsigned long long,
* BUT, unsigned long long do not have type_name() method at c++,
* when define SWIGWORDSIZE64 at linux env, uint64_t means
* unsigned long int, more detail refs stdint.i
*
*/
%
template
(
_VectorPairUint64String
)
std
::
vector
<
std
::
pair
<
unsigned
long
int
,
std
::
string
>>
;
%
pythoncode
%
{
import
numpy
as
np
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录