我正在尝试正确设置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动态生成,并在运行时编译。
相关系统设置:
答案 0 :(得分:3)
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
(我认为我必须使用Program Files
因为我的64位项目,但实际上64位文件也包含在Program Files (x86)
中)
答案 1 :(得分:0)
我还要感谢你。我一直试图让这个工作几个小时,这是让我超越边缘的帖子。我的配置略有不同,所以我的实际链接不同。我发布它们是为了帮助其他人
.theanorc
exref
nvcc.profile
[global]
device = gpu
floatX = float32
[nvcc]
flags = --use-local-env --cl-version=2008
使用: Windows 7,64位 cuda 5.5 python 2.7 Windows SDK 7.1 用于Python 2.7的Microsoft Visual C ++编译器