Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
8b60bdfa
MegEngine
项目概览
MegEngine 天元
/
MegEngine
1 年多 前同步成功
通知
404
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看板
提交
8b60bdfa
编写于
1月 14, 2022
作者:
M
Megvii Engine Team
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(mge): replace _full_sync by sync
GitOrigin-RevId: e36ef45464bf8292d51aae4f92d49dd0915364af
上级
20b42a8c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
9 addition
and
9 deletion
+9
-9
imperative/python/megengine/__init__.py
imperative/python/megengine/__init__.py
+1
-1
imperative/python/megengine/device.py
imperative/python/megengine/device.py
+6
-6
imperative/python/megengine/tools/benchmark_op.py
imperative/python/megengine/tools/benchmark_op.py
+2
-2
未找到文件。
imperative/python/megengine/__init__.py
浏览文件 @
8b60bdfa
...
@@ -76,7 +76,7 @@ if sys.platform == "win32":
...
@@ -76,7 +76,7 @@ if sys.platform == "win32":
kernel32
.
SetErrorMode
(
old_error_mode
)
kernel32
.
SetErrorMode
(
old_error_mode
)
from
.core._imperative_rt.core2
import
close
as
_close
from
.core._imperative_rt.core2
import
close
as
_close
from
.core._imperative_rt.core2
import
full_sync
as
_full_
sync
from
.core._imperative_rt.core2
import
full_sync
as
sync
from
.core._imperative_rt.core2
import
sync
as
_sync
from
.core._imperative_rt.core2
import
sync
as
_sync
from
.core._imperative_rt.utils
import
_set_fork_exec_path_for_timed_func
from
.core._imperative_rt.utils
import
_set_fork_exec_path_for_timed_func
from
.device
import
*
from
.device
import
*
...
...
imperative/python/megengine/device.py
浏览文件 @
8b60bdfa
...
@@ -165,7 +165,7 @@ def get_cuda_compute_capability(device: int, device_type=DeviceType.CUDA) -> int
...
@@ -165,7 +165,7 @@ def get_cuda_compute_capability(device: int, device_type=DeviceType.CUDA) -> int
def
get_allocated_memory
(
device
:
Optional
[
str
]
=
None
):
def
get_allocated_memory
(
device
:
Optional
[
str
]
=
None
):
r
"""Returns the current memory occupied by tensors on the computing device in bytes.
r
"""Returns the current memory occupied by tensors on the computing device in bytes.
Due to the asynchronous execution of MegEngine, please call megengine.
_full_
sync
Due to the asynchronous execution of MegEngine, please call megengine.sync
before calling this function in order to get accurate value.
before calling this function in order to get accurate value.
"""
"""
if
device
is
None
:
if
device
is
None
:
...
@@ -176,7 +176,7 @@ def get_allocated_memory(device: Optional[str] = None):
...
@@ -176,7 +176,7 @@ def get_allocated_memory(device: Optional[str] = None):
def
get_reserved_memory
(
device
:
Optional
[
str
]
=
None
):
def
get_reserved_memory
(
device
:
Optional
[
str
]
=
None
):
r
"""Returns the current memory managed by the caching allocator on the computing device in bytes.
r
"""Returns the current memory managed by the caching allocator on the computing device in bytes.
Due to the asynchronous execution of MegEngine, please call megengine.
_full_
sync
Due to the asynchronous execution of MegEngine, please call megengine.sync
before calling this function in order to get accurate value.
before calling this function in order to get accurate value.
"""
"""
if
device
is
None
:
if
device
is
None
:
...
@@ -187,7 +187,7 @@ def get_reserved_memory(device: Optional[str] = None):
...
@@ -187,7 +187,7 @@ def get_reserved_memory(device: Optional[str] = None):
def
get_max_reserved_memory
(
device
:
Optional
[
str
]
=
None
):
def
get_max_reserved_memory
(
device
:
Optional
[
str
]
=
None
):
r
"""Returns the maximum memory managed by the caching allocator on the computing device in bytes.
r
"""Returns the maximum memory managed by the caching allocator on the computing device in bytes.
Due to the asynchronous execution of MegEngine, please call megengine.
_full_
sync
Due to the asynchronous execution of MegEngine, please call megengine.sync
before calling this function in order to get accurate value.
before calling this function in order to get accurate value.
"""
"""
if
device
is
None
:
if
device
is
None
:
...
@@ -198,7 +198,7 @@ def get_max_reserved_memory(device: Optional[str] = None):
...
@@ -198,7 +198,7 @@ def get_max_reserved_memory(device: Optional[str] = None):
def
get_max_allocated_memory
(
device
:
Optional
[
str
]
=
None
):
def
get_max_allocated_memory
(
device
:
Optional
[
str
]
=
None
):
r
"""Returns the maximum memory occupied by tensors on the computing device in bytes.
r
"""Returns the maximum memory occupied by tensors on the computing device in bytes.
Due to the asynchronous execution of MegEngine, please call megengine.
_full_
sync
Due to the asynchronous execution of MegEngine, please call megengine.sync
before calling this function in order to get accurate value.
before calling this function in order to get accurate value.
"""
"""
if
device
is
None
:
if
device
is
None
:
...
@@ -209,7 +209,7 @@ def get_max_allocated_memory(device: Optional[str] = None):
...
@@ -209,7 +209,7 @@ def get_max_allocated_memory(device: Optional[str] = None):
def
reset_max_memory_stats
(
device
:
Optional
[
str
]
=
None
):
def
reset_max_memory_stats
(
device
:
Optional
[
str
]
=
None
):
r
"""Resets the maximum stats on the computing device.
r
"""Resets the maximum stats on the computing device.
Due to the asynchronous execution of MegEngine, please call megengine.
_full_
sync
Due to the asynchronous execution of MegEngine, please call megengine.sync
before calling this function in order to properly reset memory stats.
before calling this function in order to properly reset memory stats.
"""
"""
if
device
is
None
:
if
device
is
None
:
...
@@ -255,7 +255,7 @@ def coalesce_free_memory():
...
@@ -255,7 +255,7 @@ def coalesce_free_memory():
small pieces may not be returned.
small pieces may not be returned.
because of the async processing of megengine, the effect of this func may not be reflected
because of the async processing of megengine, the effect of this func may not be reflected
immediately. if you want to see the effect immediately, you can call megengine.
_full_
sync after
immediately. if you want to see the effect immediately, you can call megengine.sync after
this func was called
this func was called
.. note::
.. note::
...
...
imperative/python/megengine/tools/benchmark_op.py
浏览文件 @
8b60bdfa
...
@@ -400,14 +400,14 @@ test_cases = [
...
@@ -400,14 +400,14 @@ test_cases = [
def
perf_func
(
func
,
inps
,
reps
,
unpack_inps
,
is_mge
):
def
perf_func
(
func
,
inps
,
reps
,
unpack_inps
,
is_mge
):
if
is_mge
:
if
is_mge
:
mge
.
_full_
sync
()
mge
.
sync
()
tik
=
time
.
time
()
tik
=
time
.
time
()
for
_
in
range
(
reps
):
for
_
in
range
(
reps
):
if
unpack_inps
:
if
unpack_inps
:
out
=
func
(
*
inps
)
out
=
func
(
*
inps
)
else
:
else
:
out
=
func
(
inps
)
out
=
func
(
inps
)
mge
.
_full_
sync
()
mge
.
sync
()
else
:
else
:
torch
.
cuda
.
synchronize
()
torch
.
cuda
.
synchronize
()
with
torch
.
no_grad
():
with
torch
.
no_grad
():
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录