Link Windows 10 中的 CUDA 7.5 错误(来自 Theano 项目):MSVCRT.lib 错误 LNK2019:未解析的外部符号
Link error with CUDA 7.5 in Windows 10 (from Theano project): MSVCRT.lib error LNK2019: unresolved external symbol
我正在尝试正确设置 CUDA 以利用 Theano 中的 GPU。
通过调整我的 .theanorc
和 nvcc.profile
文件修复了许多编译问题后,我正在努力修复此链接错误:
mod.cu(735): warning: conversion from pointer to smaller integer
mod.cu(1019): warning: statement is unreachable
mod.cu(735): warning: conversion from pointer to smaller integer
mod.cu(1019): warning: statement is unreachable
mod.cu
Creating library C:/Users/niluje/AppData/Local/Theano/compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-2.7.10-64/cuda_ndarray/cuda_ndarray.lib and object C:/Users/niluje/AppData/Local/Theano/compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-2.7.10-64/cuda_ndarray/cuda_ndarray.exp
MSVCRT.lib(atonexit.obj) : error LNK2019: unresolved external symbol __imp_EncodePointer referenced in function __atonexitinit
MSVCRT.lib(crtdll.obj) : error LNK2001: unresolved external symbol __imp_EncodePointer
MSVCRT.lib(atonexit.obj) : error LNK2019: unresolved external symbol __imp_DecodePointer referenced in function _onexit
MSVCRT.lib(crtdll.obj) : error LNK2001: unresolved external symbol __imp_DecodePointer
MSVCRT.lib(gs_report.obj) : error LNK2019: unresolved external symbol __imp_IsDebuggerPresent referenced in function __raise_securityfailure
MSVCRT.lib(gs_report.obj) : error LNK2019: unresolved external symbol IsProcessorFeaturePresent referenced in function __report_gsfailure
MSVCRT.lib(gs_support.obj) : error LNK2019: unresolved external symbol __imp_QueryPerformanceCounter referenced in function __security_init_cookie
MSVCRT.lib(gs_support.obj) : error LNK2019: unresolved external symbol __imp_GetCurrentProcessId referenced in function __security_init_cookie
MSVCRT.lib(gs_support.obj) : error LNK2019: unresolved external symbol __imp_GetCurrentThreadId referenced in function __security_init_cookie
MSVCRT.lib(gs_support.obj) : error LNK2019: unresolved external symbol __imp_GetSystemTimeAsFileTime referenced in function __security_init_cookie
MSVCRT.lib(dllmain.obj) : error LNK2019: unresolved external symbol __imp_DisableThreadLibraryCalls referenced in function DllMain
C:/Users/niluje/AppData/Local/Theano/compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-2.7.10-64/cuda_ndarray/cuda_ndarray.pyd : fatal error LNK1120: 9 unresolved externals
这是我的 .theanorc
文件:
[global]
device = gpu
floatX = float32
[cuda]
root = C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5
[nvcc]
flags = --use-local-env --cl-version=2013 -LC:\Users\niluje\Anaconda\Lib;
compiler_bindir=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64
这是我的 nvcc.profile
文件:
TOP = $(_HERE_)/..
NVVMIR_LIBRARY_DIR = $(TOP)/nvvm/libdevice
PATH += $(TOP)/open64/bin;$(TOP)/nvvm/bin;$(_HERE_);$(TOP)/lib;
INCLUDES += "-I$(TOP)/include" "-IC:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include" "-IC:\Program Files\Microsoft SDKs\Windows\v6.0A\Include" $(_SPACE_)
LIBRARIES =+ $(_SPACE_) "/LIBPATH:$(TOP)/lib/$(_WIN_PLATFORM_)" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib\amd64" "/LIBPATH:C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib"
CUDAFE_FLAGS +=
PTXAS_FLAGS +=
这似乎不是一个罕见的错误,但一般修复涉及 changing some setting in the Visual Studio project。但是,这里我没有 Visual Studio 项目。代码由Theano动态生成,运行时编译。
相关系统设置:
- Windows 10(是...)
- Python 2.7.10 64 位(Anaconda 发行版)
- CUDA 7.5 / NVIDIA 驱动程序 353.54 / GeForce GTX 760
- Visual Studio 社区 2013
妈的!我在发布问题后就想通了。解决方案:包含和库文件夹略有不同:
TOP = $(_HERE_)/..
NVVMIR_LIBRARY_DIR = $(TOP)/nvvm/libdevice
PATH += $(TOP)/open64/bin;$(TOP)/nvvm/bin;$(_HERE_);$(TOP)/lib;
INCLUDES += "-I$(TOP)/include" "-IC:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include" "-IC:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include" $(_SPACE_)
LIBRARIES =+ $(_SPACE_) "/LIBPATH:$(TOP)/lib/$(_WIN_PLATFORM_)" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib\amd64" "/LIBPATH:C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\x64"
CUDAFE_FLAGS +=
PTXAS_FLAGS +=
特别是我切换自:
C:\Program Files\Microsoft SDKs\Windows\v6.0A\
至:
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A
(我以为因为我的 64 位项目我必须使用 Program Files
,但实际上 Program Files (x86)
中也包含 64 位文件)
我还要谢谢你。几个小时以来,我一直在努力让它工作,而正是 post 让我无法自拔。我的配置略有不同,所以我的实际链接也不同。我正在 post 联系他们,以防对其他人有帮助
.theanorc
[global]
device = gpu
floatX = float32
[nvcc]
flags = --use-local-env --cl-version=2008
nvcc.profile
TOP = $(_HERE_)/..
NVVMIR_LIBRARY_DIR = $(TOP)/nvvm/libdevice
PATH += $(TOP)/open64/bin;$(TOP)/nvvm/bin;$(_HERE_);$(TOP)/lib;
INCLUDES += "-I$(TOP)/include" "-I$(TOP)/include/cudart" "-IC:/Program Files (x86)/Common Files/Microsoft/Visual C++ for Python/9.0/VC/include" "-IC:\Program Files\Microsoft SDKs\Windows\v7.1\Include"$(_SPACE_)
LIBRARIES =+ $(_SPACE_) "/LIBPATH:$(TOP)/lib/$(_WIN_PLATFORM_)" "/LIBPATH:C:/Program Files (x86)/Common Files/Microsoft/Visual C++ for Python/9.0/VC/lib/amd64" "/LIBPATH:C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib\x64"
CUDAFE_FLAGS +=
OPENCC_FLAGS +=
PTXAS_FLAGS +=
使用:
windows7、64 位
库达5.5
python 2.7
windows SDK 7.1
适用于 Python 2.7
的 Microsoft Visual C++ 编译器
我正在尝试正确设置 CUDA 以利用 Theano 中的 GPU。
通过调整我的 .theanorc
和 nvcc.profile
文件修复了许多编译问题后,我正在努力修复此链接错误:
mod.cu(735): warning: conversion from pointer to smaller integer
mod.cu(1019): warning: statement is unreachable
mod.cu(735): warning: conversion from pointer to smaller integer
mod.cu(1019): warning: statement is unreachable
mod.cu
Creating library C:/Users/niluje/AppData/Local/Theano/compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-2.7.10-64/cuda_ndarray/cuda_ndarray.lib and object C:/Users/niluje/AppData/Local/Theano/compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-2.7.10-64/cuda_ndarray/cuda_ndarray.exp
MSVCRT.lib(atonexit.obj) : error LNK2019: unresolved external symbol __imp_EncodePointer referenced in function __atonexitinit
MSVCRT.lib(crtdll.obj) : error LNK2001: unresolved external symbol __imp_EncodePointer
MSVCRT.lib(atonexit.obj) : error LNK2019: unresolved external symbol __imp_DecodePointer referenced in function _onexit
MSVCRT.lib(crtdll.obj) : error LNK2001: unresolved external symbol __imp_DecodePointer
MSVCRT.lib(gs_report.obj) : error LNK2019: unresolved external symbol __imp_IsDebuggerPresent referenced in function __raise_securityfailure
MSVCRT.lib(gs_report.obj) : error LNK2019: unresolved external symbol IsProcessorFeaturePresent referenced in function __report_gsfailure
MSVCRT.lib(gs_support.obj) : error LNK2019: unresolved external symbol __imp_QueryPerformanceCounter referenced in function __security_init_cookie
MSVCRT.lib(gs_support.obj) : error LNK2019: unresolved external symbol __imp_GetCurrentProcessId referenced in function __security_init_cookie
MSVCRT.lib(gs_support.obj) : error LNK2019: unresolved external symbol __imp_GetCurrentThreadId referenced in function __security_init_cookie
MSVCRT.lib(gs_support.obj) : error LNK2019: unresolved external symbol __imp_GetSystemTimeAsFileTime referenced in function __security_init_cookie
MSVCRT.lib(dllmain.obj) : error LNK2019: unresolved external symbol __imp_DisableThreadLibraryCalls referenced in function DllMain
C:/Users/niluje/AppData/Local/Theano/compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-2.7.10-64/cuda_ndarray/cuda_ndarray.pyd : fatal error LNK1120: 9 unresolved externals
这是我的 .theanorc
文件:
[global]
device = gpu
floatX = float32
[cuda]
root = C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5
[nvcc]
flags = --use-local-env --cl-version=2013 -LC:\Users\niluje\Anaconda\Lib;
compiler_bindir=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64
这是我的 nvcc.profile
文件:
TOP = $(_HERE_)/..
NVVMIR_LIBRARY_DIR = $(TOP)/nvvm/libdevice
PATH += $(TOP)/open64/bin;$(TOP)/nvvm/bin;$(_HERE_);$(TOP)/lib;
INCLUDES += "-I$(TOP)/include" "-IC:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include" "-IC:\Program Files\Microsoft SDKs\Windows\v6.0A\Include" $(_SPACE_)
LIBRARIES =+ $(_SPACE_) "/LIBPATH:$(TOP)/lib/$(_WIN_PLATFORM_)" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib\amd64" "/LIBPATH:C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib"
CUDAFE_FLAGS +=
PTXAS_FLAGS +=
这似乎不是一个罕见的错误,但一般修复涉及 changing some setting in the Visual Studio project。但是,这里我没有 Visual Studio 项目。代码由Theano动态生成,运行时编译。
相关系统设置:
- Windows 10(是...)
- Python 2.7.10 64 位(Anaconda 发行版)
- CUDA 7.5 / NVIDIA 驱动程序 353.54 / GeForce GTX 760
- Visual Studio 社区 2013
妈的!我在发布问题后就想通了。解决方案:包含和库文件夹略有不同:
TOP = $(_HERE_)/..
NVVMIR_LIBRARY_DIR = $(TOP)/nvvm/libdevice
PATH += $(TOP)/open64/bin;$(TOP)/nvvm/bin;$(_HERE_);$(TOP)/lib;
INCLUDES += "-I$(TOP)/include" "-IC:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include" "-IC:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include" $(_SPACE_)
LIBRARIES =+ $(_SPACE_) "/LIBPATH:$(TOP)/lib/$(_WIN_PLATFORM_)" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib\amd64" "/LIBPATH:C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\x64"
CUDAFE_FLAGS +=
PTXAS_FLAGS +=
特别是我切换自:
C:\Program Files\Microsoft SDKs\Windows\v6.0A\
至:
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A
(我以为因为我的 64 位项目我必须使用 Program Files
,但实际上 Program Files (x86)
中也包含 64 位文件)
我还要谢谢你。几个小时以来,我一直在努力让它工作,而正是 post 让我无法自拔。我的配置略有不同,所以我的实际链接也不同。我正在 post 联系他们,以防对其他人有帮助
.theanorc
[global]
device = gpu
floatX = float32
[nvcc]
flags = --use-local-env --cl-version=2008
nvcc.profile
TOP = $(_HERE_)/..
NVVMIR_LIBRARY_DIR = $(TOP)/nvvm/libdevice
PATH += $(TOP)/open64/bin;$(TOP)/nvvm/bin;$(_HERE_);$(TOP)/lib;
INCLUDES += "-I$(TOP)/include" "-I$(TOP)/include/cudart" "-IC:/Program Files (x86)/Common Files/Microsoft/Visual C++ for Python/9.0/VC/include" "-IC:\Program Files\Microsoft SDKs\Windows\v7.1\Include"$(_SPACE_)
LIBRARIES =+ $(_SPACE_) "/LIBPATH:$(TOP)/lib/$(_WIN_PLATFORM_)" "/LIBPATH:C:/Program Files (x86)/Common Files/Microsoft/Visual C++ for Python/9.0/VC/lib/amd64" "/LIBPATH:C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib\x64"
CUDAFE_FLAGS +=
OPENCC_FLAGS +=
PTXAS_FLAGS +=
使用: windows7、64 位 库达5.5 python 2.7 windows SDK 7.1 适用于 Python 2.7
的 Microsoft Visual C++ 编译器