Win10 环境下无法调用gpu,报错提示Function cuImportExternalMemory not found

您好,我在win10环境下安装了taichi 0.8.1的版本
运行 ti example mpm99 会提示报错

[E 09/29/21 23:23:27.328 20012] [dynamic_loader.cpp:taichi::DynamicLoader::load_function@32] Function cuImportExternalMemory not found

我的硬件环境为:

  • win10
  • GPU: NVIDIA GeForce GTX 960M
  • 同一台电脑下可以安装运行pytorch的GPU版本

报错信息具体为

Running example mpm99 …
[E 09/29/21 23:23:27.328 20012] [dynamic_loader.cpp:taichi::DynamicLoader::load_function@32] Function cuImportExternalMemory not found


  • Taichi Compiler Stack Traceback *

0x7ffa52059c4a: taichi::print_traceback in taichi_core.pyd

0x7ffa51f2a349: PyInit_taichi_core in taichi_core.pyd
0x7ffa52043b0e: PyInit_taichi_core in taichi_core.pyd
0x7ffa52193068: taichi::print_traceback in taichi_core.pyd
0x7ffa52194f83: taichi::print_traceback in taichi_core.pyd
0x7ffa51fc4db9: PyInit_taichi_core in taichi_core.pyd
0x7ffa51deb5ff: PyInit_taichi_core in taichi_core.pyd
0x7ffa51db8600: pybind11::error_already_set::discard_as_unraisable in taichi_co
re.pyd
0x7ffa612fdee4: PyMethodDef_RawFastCallKeywords in python37.dll
0x7ffa612fe75e: PyMethodDef_RawFastCallKeywords in python37.dll
0x7ffa612fee1b: PyEval_EvalFrameDefault in python37.dll
0x7ffa612fe6fa: PyMethodDef_RawFastCallKeywords in python37.dll
0x7ffa612fee1b: PyEval_EvalFrameDefault in python37.dll
0x7ffa612fe6fa: PyMethodDef_RawFastCallKeywords in python37.dll
0x7ffa612fee1b: PyEval_EvalFrameDefault in python37.dll
0x7ffa612ef188: PyEval_EvalCodeWithName in python37.dll
0x7ffa612fe813: PyMethodDef_RawFastCallKeywords in python37.dll
0x7ffa612ff95b: PyEval_EvalFrameDefault in python37.dll
0x7ffa612ef188: PyEval_EvalCodeWithName in python37.dll
0x7ffa612dbb61: PyErr_Clear in python37.dll
0x7ffa612dba2d: PyErr_Clear in python37.dll
0x7ffa612fdd22: PyMethodDef_RawFastCallKeywords in python37.dll
0x7ffa612fe75e: PyMethodDef_RawFastCallKeywords in python37.dll
0x7ffa612fee1b: PyEval_EvalFrameDefault in python37.dll
0x7ffa612ef188: PyEval_EvalCodeWithName in python37.dll
0x7ffa612fe813: PyMethodDef_RawFastCallKeywords in python37.dll
0x7ffa612fee1b: PyEval_EvalFrameDefault in python37.dll
0x7ffa612ef188: PyEval_EvalCodeWithName in python37.dll
0x7ffa612fe813: PyMethodDef_RawFastCallKeywords in python37.dll
0x7ffa612ff95b: PyEval_EvalFrameDefault in python37.dll
0x7ffa612ef188: PyEval_EvalCodeWithName in python37.dll
0x7ffa612fe813: PyMethodDef_RawFastCallKeywords in python37.dll
0x7ffa612ff95b: PyEval_EvalFrameDefault in python37.dll
0x7ffa612ef188: PyEval_EvalCodeWithName in python37.dll
0x7ffa612fe813: PyMethodDef_RawFastCallKeywords in python37.dll
0x7ffa612fee1b: PyEval_EvalFrameDefault in python37.dll
0x7ffa612eed2d: PyFunction_FastCallDict in python37.dll
0x7ffa612e05cd: PyNumber_Long in python37.dll
0x7ffa612ffab2: PyEval_EvalFrameDefault in python37.dll
0x7ffa612ef188: PyEval_EvalCodeWithName in python37.dll
0x7ffa612eee0a: PyFunction_FastCallDict in python37.dll
0x7ffa6132930c: PyObject_Call_Prepend in python37.dll
0x7ffa61329279: PyType_GetDocFromInternalDoc in python37.dll
0x7ffa612f674a: PyObject_FastCallKeywords in python37.dll
0x7ffa612fe845: PyMethodDef_RawFastCallKeywords in python37.dll
0x7ffa612fee1b: PyEval_EvalFrameDefault in python37.dll
0x7ffa612fe6fa: PyMethodDef_RawFastCallKeywords in python37.dll
0x7ffa612fee1b: PyEval_EvalFrameDefault in python37.dll
0x7ffa612ef188: PyEval_EvalCodeWithName in python37.dll
0x7ffa612dbb61: PyErr_Clear in python37.dll
0x7ffa612dba2d: PyErr_Clear in python37.dll
0x7ffa612fdd22: PyMethodDef_RawFastCallKeywords in python37.dll
0x7ffa612fe75e: PyMethodDef_RawFastCallKeywords in python37.dll
0x7ffa612fee1b: PyEval_EvalFrameDefault in python37.dll
0x7ffa612ef188: PyEval_EvalCodeWithName in python37.dll
0x7ffa612fe813: PyMethodDef_RawFastCallKeywords in python37.dll
0x7ffa612fee1b: PyEval_EvalFrameDefault in python37.dll
0x7ffa612ef188: PyEval_EvalCodeWithName in python37.dll
0x7ffa612eee0a: PyFunction_FastCallDict in python37.dll
0x7ffa61308d77: PyObject_Call in python37.dll
0x7ffa613cd85d: Py_UnixMain in python37.dll
0x7ffa613cd6c2: Py_UnixMain in python37.dll
0x7ffa613cd553: Py_UnixMain in python37.dll
0x7ffa61362776: PyErr_NoMemory in python37.dll
0x7ffa6130166a: PyInterpreterState_New in python37.dll
0x7ffa613012b4: Py_Main in python37.dll
0x7ff78feb1260: Unknown Function in python.exe
0x7ffabb717c24: BaseThreadInitThunk in KERNEL32.DLL
0x7ffabd36d721: RtlUserThreadStart in ntdll.dll

Internal error occurred. Check out this page for possible solutions:
https://docs.taichi.graphics/docs/lang/articles/misc/install
[W 09/29/21 23:23:27.560 20012] RuntimeError: ‘[dynamic_loader.cpp:taichi::DynamicLoader::load_function@32] Function cuImportExternalMemory not
found’ occurred when detecting cuda, consider add export TI_WITH_CUDA=0 to environment variables to depress this warning message.
[Taichi] Starting on arch=opengl

请问老哥知道是啥原因了吗?

不知道欸 :joy:

您好,请问在命令行,首先export TI_WITH_CUDA=0,然后运行程序呢?

您好,因为我在windows环境下,没有 export 命令,因此用以下两种方式设置环境变量,但还是出现和原来一样的问题

  • 在命令行内输入 SET TI_WITH_CUDA=0

  • 在python代码中增加 os.environ['TI_WITH_CUDA']="0"

使用 GTX 960M,CUDA 版本10.1,可以运行 mpm99。

可以使用nvcc --version查看 CUDA 版本,taichi要求

CUDA versions >= 10

函数cuImportExternalMemory最早出现在 CUDA 10.0中。应该是 CUDA 版本低于10.0,可以安装最新版CUDA

另外,TI_WITH_CUDA是一个宏,关于export TI_WITH_CUDA=0的提示好像不太正确。可以通过设置环境变量TI_ENABLE_CUDA来控制目标arch。

# powershell
# READ
$env:TI_ENABLE_CUDA
$env:TI_ENABLE_OPENGL
# UPDATE
$env:TI_ENABLE_CUDA=0
$env:TI_ENABLE_OPENGL=0
# DELETE
del env:TI_ENABLE_CUDA
del env:TI_ENABLE_OPENGL
# cmd
# READ
set TI_ENABLE_CUDA
set TI_ENABLE_OPENGL
# UPDATE
set TI_ENABLE_CUDA=0
set TI_ENABLE_OPENGL=0
# DELETE
set TI_ENABLE_CUDA=
set TI_ENABLE_OPENGL=

TI_ENABLE_CUDA设置为0,使用 openg l运行 mpm99。

1 个赞