Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
36a4fb56
MegEngine
项目概览
MegEngine 天元
/
MegEngine
大约 1 年 前同步成功
通知
399
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
36a4fb56
编写于
9月 28, 2020
作者:
M
Megvii Engine Team
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ci(image): update docker image install python package
GitOrigin-RevId: 171e95b3d975edabb3ce5deace7b60b6751bbcc4
上级
2070aaae
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
35 addition
and
15 deletion
+35
-15
imperative/python/megengine/core/tensor/megbrain_graph.py
imperative/python/megengine/core/tensor/megbrain_graph.py
+1
-1
imperative/python/megengine/core/tensor/multipledispatch/conflict.py
...python/megengine/core/tensor/multipledispatch/conflict.py
+3
-1
imperative/python/megengine/distributed/helper.py
imperative/python/megengine/distributed/helper.py
+6
-6
imperative/python/src/dispatcher.cpp
imperative/python/src/dispatcher.cpp
+22
-5
imperative/python/test/run.sh
imperative/python/test/run.sh
+3
-2
未找到文件。
imperative/python/megengine/core/tensor/megbrain_graph.py
浏览文件 @
36a4fb56
...
...
@@ -274,7 +274,7 @@ def dump_graph(
keep_var_name
:
int
=
1
,
keep_param_name
:
bool
=
False
,
keep_opr_priority
:
bool
=
False
,
strip_info_file
=
None
,
strip_info_file
=
None
):
"""serialize the computing graph of `output_vars` and get byte result.
...
...
imperative/python/megengine/core/tensor/multipledispatch/conflict.py
浏览文件 @
36a4fb56
...
...
@@ -40,6 +40,8 @@
# All Megvii Modifications are Copyright (C) 2014-2020 Megvii Inc. All rights reserved.
# --------------------------------------------------------------------------------------
from
collections
import
OrderedDict
from
.utils
import
_toposort
,
groupby
from
.variadic
import
isvariadic
...
...
@@ -159,5 +161,5 @@ def ordering(signatures):
for
s
in
signatures
:
if
s
not
in
edges
:
edges
[
s
]
=
[]
edges
=
d
ict
((
k
,
[
b
for
a
,
b
in
v
])
for
k
,
v
in
edges
.
items
())
edges
=
OrderedD
ict
((
k
,
[
b
for
a
,
b
in
v
])
for
k
,
v
in
edges
.
items
())
return
_toposort
(
edges
)
imperative/python/megengine/distributed/helper.py
浏览文件 @
36a4fb56
...
...
@@ -54,14 +54,14 @@ def synchronized(func: Callable):
return
wrapper
def
get_device_count_by_fork
(
device_type
:
str
):
q
=
mp
.
Queue
()
def
worker
(
queue
,
device_type
):
num
=
get_device_count
(
device_type
)
queue
.
put
(
num
)
def
worker
(
queue
):
num
=
get_device_count
(
device_type
)
queue
.
put
(
num
)
p
=
mp
.
Process
(
target
=
worker
,
args
=
(
q
,))
def
get_device_count_by_fork
(
device_type
:
str
):
q
=
mp
.
Queue
()
p
=
mp
.
Process
(
target
=
worker
,
args
=
(
q
,
device_type
))
p
.
start
()
p
.
join
()
return
q
.
get
()
...
...
imperative/python/src/dispatcher.cpp
浏览文件 @
36a4fb56
...
...
@@ -151,16 +151,19 @@ struct Dispatcher {
public:
static
constexpr
auto
tp_name
=
"Dispatcher"
;
PyObject
*
tp_vectorcall
(
PyObject
*
const
*
args
,
Py_ssize_t
nargs
)
{
if
(
!
prepare_call
(
args
,
nargs
))
return
nullptr
;
return
do_call
([
=
](
PyObject
*
func
){
return
_PyObject_FastCall
(
func
,
const_cast
<
PyObject
**>
(
args
),
nargs
);});
}
PyObject
*
tp_call
(
PyObject
*
args
,
PyObject
*
kwargs
)
{
if
(
!
prepare_call
(
&
PyTuple_GET_ITEM
(
args
,
0
),
PyTuple_GET_SIZE
(
args
)))
return
nullptr
;
return
do_call
([
=
](
PyObject
*
func
){
return
PyObject_Call
(
func
,
args
,
kwargs
);});
}
#if PY_MINOR_VERSION >= 6
PyObject
*
tp_vectorcall
(
PyObject
*
const
*
args
,
Py_ssize_t
nargs
)
{
if
(
!
prepare_call
(
args
,
nargs
))
return
nullptr
;
return
do_call
([
=
](
PyObject
*
func
){
return
_PyObject_FastCall
(
func
,
const_cast
<
PyObject
**>
(
args
),
nargs
);});
}
#endif
#if PY_MINOR_VERSION >= 6
PyObject
*
super
(
PyObject
*
const
*
args
,
Py_ssize_t
nargs
)
{
if
(
stack
.
empty
())
{
PyErr_SetString
(
PyExc_RuntimeError
,
"super called at top level"
);
...
...
@@ -169,6 +172,16 @@ public:
stack
.
emplace_back_safely
(
stack
.
back
()).
mro_offset
++
;
return
do_call
([
=
](
PyObject
*
func
){
return
_PyObject_FastCall
(
func
,
const_cast
<
PyObject
**>
(
args
),
nargs
);});
}
#else
PyObject
*
super
(
PyObject
*
args
,
PyObject
*
kwargs
)
{
if
(
stack
.
empty
())
{
PyErr_SetString
(
PyExc_RuntimeError
,
"super called at top level"
);
return
nullptr
;
}
stack
.
emplace_back_safely
(
stack
.
back
()).
mro_offset
++
;
return
do_call
([
=
](
PyObject
*
func
){
return
PyObject_Call
(
func
,
args
,
kwargs
);});
}
#endif
void
enable
(
PyObject
*
func
)
{
auto
obj
=
py
::
reinterpret_borrow
<
py
::
object
>
(
func
);
...
...
@@ -204,7 +217,11 @@ void init_dispatcher(py::module m) {
.
def
<&
Dispatcher
::
enable
>
(
"enable"
)
.
def
<&
Dispatcher
::
disable
>
(
"disable"
)
.
def
<&
Dispatcher
::
clear_cache
>
(
"clear_cache"
)
#if PY_MINOR_VERSION >= 6
.
def
<&
Dispatcher
::
tp_vectorcall
>
(
"call"
)
#else
.
def
<&
Dispatcher
::
tp_call
>
(
"call"
)
#endif
.
def
<&
Dispatcher
::
super
>
(
"super"
)
.
finalize
();
if
(
!
dispatcher_type
)
throw
py
::
error_already_set
();
...
...
imperative/python/test/run.sh
浏览文件 @
36a4fb56
#!/bin/bash -e
test_dirs
=
"test megengine"
TEST_PLAT
=
$1
if
[[
"
$TEST_PLAT
"
==
cpu
]]
;
then
...
...
@@ -13,9 +14,9 @@ else
fi
pushd
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
/..
>
/dev/null
PYTHONPATH
=
"."
python3
-m
pytest
$test_dirs
-m
'not isolated_distributed'
PYTHONPATH
=
"."
PY_IGNORE_IMPORTMISMATCH
=
1
python3
-m
pytest
$test_dirs
-m
'not isolated_distributed'
if
[[
"
$TEST_PLAT
"
==
cuda
]]
;
then
echo
"test GPU pytest now"
PYTHONPATH
=
"."
python3
-m
pytest
$test_dirs
-m
'isolated_distributed'
PYTHONPATH
=
"."
PY_IGNORE_IMPORTMISMATCH
=
1
python3
-m
pytest
$test_dirs
-m
'isolated_distributed'
fi
popd
>
/dev/null
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录