Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
d60d028a
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看板
提交
d60d028a
编写于
2年前
作者:
M
Megvii Engine Team
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(mge/device): enable to get cuda/cudnn/tensorrt version
GitOrigin-RevId: 5864c61d10972aa30923cf87e457e9819e8ea52d
上级
8fed114a
master
HuaHua404-patch-4
dev-support-lite-fork-debug-mode
release-1.11
release-1.11.1
release-1.12.0
release-1.12.1
release-1.12.2
release-1.12.3
release-1.12.4
release-1.12.5
release-1.13.0
release-1.13.1
test-try-import
tmp-test
try-import
v1.13.1
v1.13.0
v1.12.4
v1.12.3
v1.12.2
v1.12.1
v1.12.0
v1.11.1
v1.11.0
无相关合并请求
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
66 addition
and
0 deletion
+66
-0
imperative/python/megengine/device.py
imperative/python/megengine/device.py
+33
-0
imperative/python/src/common.cpp
imperative/python/src/common.cpp
+5
-0
src/core/impl/version.cpp
src/core/impl/version.cpp
+25
-0
src/core/include/megbrain/version.h
src/core/include/megbrain/version.h
+3
-0
未找到文件。
imperative/python/megengine/device.py
浏览文件 @
d60d028a
...
...
@@ -4,7 +4,10 @@ import re
from
typing
import
Optional
from
.core._imperative_rt.common
import
CompNode
,
DeviceType
from
.core._imperative_rt.common
import
get_cuda_version
as
_get_cuda_version
from
.core._imperative_rt.common
import
get_cudnn_version
as
_get_cudnn_version
from
.core._imperative_rt.common
import
get_device_prop
as
_get_device_prop
from
.core._imperative_rt.common
import
get_tensorrt_version
as
_get_tensorrt_version
from
.core._imperative_rt.common
import
set_prealloc_config
as
_set_prealloc_config
from
.core._imperative_rt.common
import
what_is_xpu
as
_what_is_xpu
from
.core._imperative_rt.utils
import
_try_coalesce_all_free_memory
...
...
@@ -17,6 +20,9 @@ __all__ = [
"get_mem_status_bytes"
,
"get_cuda_compute_capability"
,
"get_cuda_device_property"
,
"get_cuda_version"
,
"get_cudnn_version"
,
"get_tensorrt_version"
,
"get_allocated_memory"
,
"get_reserved_memory"
,
"get_max_reserved_memory"
,
...
...
@@ -263,3 +269,30 @@ def coalesce_free_memory():
* This function may do nothing if there are no chunks that can be freed.
"""
return
_try_coalesce_all_free_memory
()
def
get_cuda_version
():
r
"""Gets the CUDA version used when compiling MegEngine.
Returns:
a version number, indicating `CUDA_VERSION_MAJOR * 1000 + CUDA_VERSION_MINOR * 10`.
"""
return
_get_cuda_version
()
def
get_cudnn_version
():
r
"""Get the Cudnn version used when compiling MegEngine.
Returns:
a version number, indicating `CUDNN_MAJOR * 1000 + CUDNN_MINOR * 100 + CUDNN_PATCHLEVEL`.
"""
return
_get_cudnn_version
()
def
get_tensorrt_version
():
r
"""Get the TensorRT version used when compiling MegEngine.
Returns:
a version number, indicating `NV_TENSORRT_MAJOR * 1000 + NV_TENSORRT_MINOR * 100 + NV_TENSORRT_PATCH`.
"""
return
_get_tensorrt_version
()
This diff is collapsed.
Click to expand it.
imperative/python/src/common.cpp
浏览文件 @
d60d028a
...
...
@@ -8,6 +8,7 @@
#include "megbrain/comp_node.h"
#include "megbrain/graph.h"
#include "megbrain/imperative/physical_tensor.h"
#include "megbrain/version.h"
#if MGB_ENABLE_OPR_MM
#include "megbrain/opr/mm_handler.h"
#endif
...
...
@@ -264,6 +265,10 @@ void init_common(py::module m) {
return
mge_gen_code
;
});
m
.
def
(
"get_cuda_version"
,
[]()
{
return
mgb
::
get_cuda_version
();
});
m
.
def
(
"get_cudnn_version"
,
[]()
{
return
mgb
::
get_cudnn_version
();
});
m
.
def
(
"get_tensorrt_version"
,
[]()
{
return
mgb
::
get_tensorrt_version
();
});
m
.
def
(
"what_is_xpu"
,
[]
{
return
CompNode
::
Locator
::
parse
(
"xpux"
).
to_physical
().
type
;
});
...
...
This diff is collapsed.
Click to expand it.
src/core/impl/version.cpp
浏览文件 @
d60d028a
...
...
@@ -26,4 +26,29 @@ Version mgb::get_version() {
#endif
}
#if MGB_CUDA
#include "NvInfer.h"
#include "cuda.h"
#include "cudnn.h"
int
mgb
::
get_cuda_version
()
{
return
CUDA_VERSION
;
}
int
mgb
::
get_cudnn_version
()
{
return
CUDNN_VERSION
;
}
int
mgb
::
get_tensorrt_version
()
{
return
NV_TENSORRT_VERSION
;
}
#else
int
mgb
::
get_cuda_version
()
{
return
-
1
;
}
int
mgb
::
get_cudnn_version
()
{
return
-
1
;
}
int
mgb
::
get_tensorrt_version
()
{
return
-
1
;
}
#endif
// vim: syntax=cpp.doxygen foldmethod=marker foldmarker=f{{{,f}}}
This diff is collapsed.
Click to expand it.
src/core/include/megbrain/version.h
浏览文件 @
d60d028a
...
...
@@ -20,6 +20,9 @@ struct Version {
};
MGE_WIN_DECLSPEC_FUC
Version
get_version
();
MGE_WIN_DECLSPEC_FUC
int
get_cuda_version
();
MGE_WIN_DECLSPEC_FUC
int
get_cudnn_version
();
MGE_WIN_DECLSPEC_FUC
int
get_tensorrt_version
();
}
// namespace mgb
// vim: syntax=cpp.doxygen foldmethod=marker foldmarker=f{{{,f}}}
This diff is collapsed.
Click to expand it.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录
新手
引导
客服
返回
顶部