我想正确设置CUDA以便利用Theano中的GPU。Windows 10中的CUDA 7.5(来自Theano项目)链接错误:MSVCRT.lib错误LNK2019:无法解析的外部符号
通过调整我的.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位(蟒蛇DISTRIB)
- CUDA 7.5/NVIDIA驱动程序353.54 /的GeForce GTX 760
- Visual Studio Community 2013
感谢postin为您的问题提供解决方案 – talonmies