Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
b3d2a632
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,发现更多精彩内容 >>
提交
b3d2a632
编写于
7月 30, 2021
作者:
M
Megvii Engine Team
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(sublinear): fix lb_memory in sublinear
GitOrigin-RevId: fd51023c01c179cf88bb599e92fa58565781580d
上级
9b4b910d
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
8 addition
and
8 deletion
+8
-8
imperative/python/megengine/jit/sublinear_memory_config.py
imperative/python/megengine/jit/sublinear_memory_config.py
+3
-3
imperative/python/megengine/jit/tracing.py
imperative/python/megengine/jit/tracing.py
+1
-1
imperative/python/src/graph_rt.cpp
imperative/python/src/graph_rt.cpp
+1
-1
src/core/impl/graph/seq_sublinear_memory.cpp
src/core/impl/graph/seq_sublinear_memory.cpp
+2
-2
src/core/include/megbrain/graph/cg.h
src/core/include/megbrain/graph/cg.h
+1
-1
未找到文件。
imperative/python/megengine/jit/sublinear_memory_config.py
浏览文件 @
b3d2a632
...
@@ -22,7 +22,7 @@ class SublinearMemoryConfig:
...
@@ -22,7 +22,7 @@ class SublinearMemoryConfig:
:param genetic_pool_size: number of samples for the crossover random selection
:param genetic_pool_size: number of samples for the crossover random selection
during genetic optimization. Default: 20.
during genetic optimization. Default: 20.
It can also be set through the environmental variable 'MGB_SUBLINEAR_MEMORY_GENETIC_POOL_SIZE'.
It can also be set through the environmental variable 'MGB_SUBLINEAR_MEMORY_GENETIC_POOL_SIZE'.
:param lb_memory: memory lower bound of bottleneck size in MB for sublinear memory optimization.
:param lb_memory
_mb
: memory lower bound of bottleneck size in MB for sublinear memory optimization.
It can be used to perform manual tradeoff between memory and speed. Default: 0.
It can be used to perform manual tradeoff between memory and speed. Default: 0.
It can also be set through the environmental variable 'MGB_SUBLINEAR_MEMORY_LOWER_BOUND_MB'.
It can also be set through the environmental variable 'MGB_SUBLINEAR_MEMORY_LOWER_BOUND_MB'.
:param num_worker: number of thread workers to search the optimum checkpoints
:param num_worker: number of thread workers to search the optimum checkpoints
...
@@ -39,7 +39,7 @@ class SublinearMemoryConfig:
...
@@ -39,7 +39,7 @@ class SublinearMemoryConfig:
thresh_nr_try
:
int
=
10
,
thresh_nr_try
:
int
=
10
,
genetic_nr_iter
:
int
=
0
,
genetic_nr_iter
:
int
=
0
,
genetic_pool_size
:
int
=
20
,
genetic_pool_size
:
int
=
20
,
lb_memory
:
int
=
0
,
lb_memory
_mb
:
int
=
0
,
num_worker
:
int
=
max
(
1
,
get_device_count
(
"cpu"
)
//
2
),
num_worker
:
int
=
max
(
1
,
get_device_count
(
"cpu"
)
//
2
),
):
):
assert
thresh_nr_try
>=
0
,
"thresh_nr_try must be greater or equal to zero"
assert
thresh_nr_try
>=
0
,
"thresh_nr_try must be greater or equal to zero"
...
@@ -50,6 +50,6 @@ class SublinearMemoryConfig:
...
@@ -50,6 +50,6 @@ class SublinearMemoryConfig:
genetic_pool_size
>=
0
genetic_pool_size
>=
0
),
"genetic_pool_size must be greater or equal to zero"
),
"genetic_pool_size must be greater or equal to zero"
self
.
genetic_pool_size
=
genetic_pool_size
self
.
genetic_pool_size
=
genetic_pool_size
self
.
lb_memory
=
lb_memory
self
.
lb_memory
_mb
=
lb_memory_mb
assert
num_worker
>
0
,
"num_worker must be greater or equal to one"
assert
num_worker
>
0
,
"num_worker must be greater or equal to one"
self
.
num_worker
=
num_worker
self
.
num_worker
=
num_worker
imperative/python/megengine/jit/tracing.py
浏览文件 @
b3d2a632
...
@@ -532,7 +532,7 @@ class trace:
...
@@ -532,7 +532,7 @@ class trace:
if
self
.
_sublinear_memory_config
is
not
None
:
if
self
.
_sublinear_memory_config
is
not
None
:
graph
.
options
.
enable_sublinear_memory_opt
=
True
graph
.
options
.
enable_sublinear_memory_opt
=
True
sublinear_config
=
graph
.
options
.
sublinear_mem_config
sublinear_config
=
graph
.
options
.
sublinear_mem_config
sublinear_config
.
lb_memory
=
self
.
_sublinear_memory_config
.
lb_memory
sublinear_config
.
lb_memory
_mb
=
self
.
_sublinear_memory_config
.
lb_memory_mb
sublinear_config
.
genetic_nr_iter
=
(
sublinear_config
.
genetic_nr_iter
=
(
self
.
_sublinear_memory_config
.
genetic_nr_iter
self
.
_sublinear_memory_config
.
genetic_nr_iter
)
)
...
...
imperative/python/src/graph_rt.cpp
浏览文件 @
b3d2a632
...
@@ -476,7 +476,7 @@ void init_graph_rt(py::module m) {
...
@@ -476,7 +476,7 @@ void init_graph_rt(py::module m) {
DEF_READWRITE
(
thresh_nr_try
)
DEF_READWRITE
(
thresh_nr_try
)
DEF_READWRITE
(
genetic_nr_iter
)
DEF_READWRITE
(
genetic_nr_iter
)
DEF_READWRITE
(
genetic_pool_size
)
DEF_READWRITE
(
genetic_pool_size
)
DEF_READWRITE
(
lb_memory
)
DEF_READWRITE
(
lb_memory
_mb
)
DEF_READWRITE
(
num_worker
);
DEF_READWRITE
(
num_worker
);
#undef CURRENT_CLASS
#undef CURRENT_CLASS
...
...
src/core/impl/graph/seq_sublinear_memory.cpp
浏览文件 @
b3d2a632
...
@@ -562,7 +562,7 @@ public:
...
@@ -562,7 +562,7 @@ public:
m_config
->
genetic_pool_size
=
psize
;
m_config
->
genetic_pool_size
=
psize
;
}
}
if
(
auto
env
=
MGB_GETENV
(
"MGB_SUBLINEAR_MEMORY_LOWER_BOUND_MB"
))
{
if
(
auto
env
=
MGB_GETENV
(
"MGB_SUBLINEAR_MEMORY_LOWER_BOUND_MB"
))
{
m_config
->
lb_memory
=
std
::
stoi
(
env
)
*
1024
*
1024
;
m_config
->
lb_memory
_mb
=
std
::
stoi
(
env
)
;
}
}
}
}
...
@@ -781,7 +781,7 @@ void SeqModifierForSublinearMemory::ActionSearcherSingleCN::search_genetic() {
...
@@ -781,7 +781,7 @@ void SeqModifierForSublinearMemory::ActionSearcherSingleCN::search_genetic() {
}
}
void
SeqModifierForSublinearMemory
::
ActionSearcherSingleCN
::
search_refine
()
{
void
SeqModifierForSublinearMemory
::
ActionSearcherSingleCN
::
search_refine
()
{
size_t
lower_bound
=
m_par_modifier
->
m_config
->
lb_memory
;
size_t
lower_bound
=
static_cast
<
size_t
>
(
m_par_modifier
->
m_config
->
lb_memory_mb
)
<<
20
;
if
(
m_min_bottleneck
>=
lower_bound
)
if
(
m_min_bottleneck
>=
lower_bound
)
return
;
return
;
OprFootprint
footprint
;
OprFootprint
footprint
;
...
...
src/core/include/megbrain/graph/cg.h
浏览文件 @
b3d2a632
...
@@ -443,7 +443,7 @@ class ComputingGraph : public std::enable_shared_from_this<ComputingGraph>,
...
@@ -443,7 +443,7 @@ class ComputingGraph : public std::enable_shared_from_this<ComputingGraph>,
int
thresh_nr_try
=
10
;
int
thresh_nr_try
=
10
;
int
genetic_nr_iter
=
0
;
int
genetic_nr_iter
=
0
;
int
genetic_pool_size
=
20
;
int
genetic_pool_size
=
20
;
int
lb_memory
=
0
;
int
lb_memory
_mb
=
0
;
int
num_worker
=
sys
::
get_cpu_count
()
/
2
;
int
num_worker
=
sys
::
get_cpu_count
()
/
2
;
}
sublinear_mem_config
;
}
sublinear_mem_config
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录