提交 2809316e 编写于 作者: M Megvii Engine Team

feat(cuda): make CUDA_MODULE_LOADING default to LAZY

more detail: please check
https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#env-vars

GitOrigin-RevId: 6261c8250094a572d03888bd7eb2bd6fff74e875
上级 37968dec
...@@ -5,6 +5,17 @@ import platform ...@@ -5,6 +5,17 @@ import platform
import sys import sys
def config_env():
"""
more detail: please check https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#env-vars
default config to LAZY, which means cuda module will be loaded when needed to save cu memory by load fatbin elf section
please do not call any cuda api before this function
"""
if not os.getenv("ALREADY_CONFIG_CUDA_LOADING_MODE", False):
may_user_config = os.getenv("CUDA_MODULE_LOADING", "LAZY")
os.environ["CUDA_MODULE_LOADING"] = may_user_config
def check_pip_env(): def check_pip_env():
filter_package_name = 'megbrain' filter_package_name = 'megbrain'
need_package_name = 'megengine' need_package_name = 'megengine'
...@@ -103,6 +114,7 @@ def check_windows(): ...@@ -103,6 +114,7 @@ def check_windows():
def check_misc(): def check_misc():
config_env()
check_pip_env() check_pip_env()
check_termux() check_termux()
check_windows() check_windows()
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import os
from .base import * from .base import *
from .base import version as __version__ from .base import version as __version__
...@@ -7,3 +8,17 @@ from .network import * ...@@ -7,3 +8,17 @@ from .network import *
from .struct import * from .struct import *
from .tensor import * from .tensor import *
from .utils import * from .utils import *
def config_env():
"""
more detail: please check https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#env-vars
default config to LAZY, which means cuda module will be loaded when needed to save cu memory by load fatbin elf section
please do not call any cuda api before this function
"""
if not os.getenv("ALREADY_CONFIG_CUDA_LOADING_MODE", False):
may_user_config = os.getenv("CUDA_MODULE_LOADING", "LAZY")
os.environ["CUDA_MODULE_LOADING"] = may_user_config
config_env()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册