Windows 上的 Theano + Cuda 8.0 - 编译错误
Posted
技术标签:
【中文标题】Windows 上的 Theano + Cuda 8.0 - 编译错误【英文标题】:Theano + Cuda 8.0 on Windows - Compile Errors 【发布时间】:2016-06-16 22:02:03 【问题描述】:我让 Theano 在 Windows 10 没有 GPU 支持的情况下正常工作。我有一个新的 GTX 1080,想在上面运行 Theano。这需要来自 NVIDIA 的最新 CUDA 8.0 Toolkit。我已经根据http://deeplearning.net/software/theano/install_windows.html 安装了所有东西,允许一些小的软件版本差异。每当我尝试通过 .theanorc.txt 启用 GPU 支持的情况下简单地“导入 theano”时,都会出现编译错误。
Cuda 8.0 可以与 Theano-master 一起正常工作,根据此线程:https://github.com/Theano/Theano/issues/4558
从 6 月 16 日开始运行 WinPython 64bit 2.7.10.3、scipy 0.161、numpy 1.9.3、Microsoft Visual Studio 12.0 和 theano-master。
最近的尝试导致此错误列表:
===============================
C:/Users/CHARLE~1/AppData/Local/Temp/tmpxft_00001148_00000000-10_mod.cpp1.ii(1): error: this declaration has no storage class or type specifier
C:/Users/CHARLE~1/AppData/Local/Temp/tmpxft_00001148_00000000-10_mod.cpp1.ii(1): error: identifier "R" is undefined
C:/Users/CHARLE~1/AppData/Local/Temp/tmpxft_00001148_00000000-10_mod.cpp1.ii(1): error: expected a ";"
At end of source: warning: parsing restarts here after previous syntax error
3 errors detected in the compilation of "C:/Users/CHARLE~1/AppData/Local/Temp/tmpxft_00001148_00000000-10_mod.cpp1.ii".
mod.cu
['nvcc', '-shared', '-O3', '-arch=sm_61', '--compiler-bindir', 'C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\bin\\lc.exe', '-Xlinker', '/DEBUG', '-D HAVE_ROUND', '-m64', '-Xcompiler', '-DCUDA_NDARRAY_CUH=c72d035fdf91890f3b36710688069b2e,-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION,/Zi,/MD', '-IC:\\Users\\Charles Gillespie\\AppData\\Local\\Theano\\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_63_Stepping_2_GenuineIntel-2.7.10-64\\cuda_ndarray', '-IC:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v8.0\\include', '-IC:\\scisoft\\WinPython-64bit-2.7.10.3\\python-2.7.10.amd64\\lib\\site-packages\\numpy\\core\\include', '-IC:\\scisoft\\WinPython-64bit-2.7.10.3\\python-2.7.10.amd64\\include', '-Ic:\\scisoft\\winpython-64bit-2.7.10.3\\python-2.7.10.amd64\\theano\\theano\\gof', '-Ic:\\scisoft\\winpython-64bit-2.7.10.3\\python-2.7.10.amd64\\theano\\theano\\sandbox\\cuda', '-o', 'C:\\Users\\Charles Gillespie\\AppData\\Local\\Theano\\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_63_Stepping_2_GenuineIntel-2.7.10-64\\tmp6qa5py\\4894639462a290346189bb38dab7bb7e.pyd', 'mod.cu', '-LC:\\Users\\Charles Gillespie\\AppData\\Local\\Theano\\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_63_Stepping_2_GenuineIntel-2.7.10-64\\cuda_ndarray', '-LC:\\scisoft\\WinPython-64bit-2.7.10.3\\python-2.7.10.amd64\\libs', '-LC:\\scisoft\\WinPython-64bit-2.7.10.3\\python-2.7.10.amd64', '-lcudart', '-lcublas', '-lcuda_ndarray', '-lpython27']
Traceback (most recent call last):
File "test-theano.py", line 3, in <module>
import theano
File "c:\scisoft\winpython-64bit-2.7.10.3\python-2.7.10.amd64\theano\theano\__init__.py", line 118, in <module>
theano.sandbox.cuda.tests.test_driver.test_nvidia_driver1()
File "c:\scisoft\winpython-64bit-2.7.10.3\python-2.7.10.amd64\theano\theano\sandbox\cuda\tests\test_driver.py", line 32, in test_nvidia_driver1
profile=False)
File "c:\scisoft\winpython-64bit-2.7.10.3\python-2.7.10.amd64\theano\theano\compile\function.py", line 322, in function
output_keys=output_keys)
File "c:\scisoft\winpython-64bit-2.7.10.3\python-2.7.10.amd64\theano\theano\compile\pfunc.py", line 480, in pfunc
output_keys=output_keys)
File "c:\scisoft\winpython-64bit-2.7.10.3\python-2.7.10.amd64\theano\theano\compile\function_module.py", line 1784, in orig_function
defaults)
File "c:\scisoft\winpython-64bit-2.7.10.3\python-2.7.10.amd64\theano\theano\compile\function_module.py", line 1648, in create
input_storage=input_storage_lists, storage_map=storage_map)
File "c:\scisoft\winpython-64bit-2.7.10.3\python-2.7.10.amd64\theano\theano\gof\link.py", line 693, in make_thunk
storage_map=storage_map)[:3]
File "c:\scisoft\winpython-64bit-2.7.10.3\python-2.7.10.amd64\theano\theano\gof\vm.py", line 1034, in make_all
no_recycling))
File "c:\scisoft\winpython-64bit-2.7.10.3\python-2.7.10.amd64\theano\theano\sandbox\cuda\__init__.py", line 256, in make_thunk
compute_map, no_recycling)
File "c:\scisoft\winpython-64bit-2.7.10.3\python-2.7.10.amd64\theano\theano\gof\op.py", line 969, in make_thunk
no_recycling)
File "c:\scisoft\winpython-64bit-2.7.10.3\python-2.7.10.amd64\theano\theano\gof\op.py", line 872, in make_c_thunk
output_storage=node_output_storage)
File "c:\scisoft\winpython-64bit-2.7.10.3\python-2.7.10.amd64\theano\theano\gof\cc.py", line 1200, in make_thunk
keep_lock=keep_lock)
File "c:\scisoft\winpython-64bit-2.7.10.3\python-2.7.10.amd64\theano\theano\gof\cc.py", line 1143, in __compile__
keep_lock=keep_lock)
File "c:\scisoft\winpython-64bit-2.7.10.3\python-2.7.10.amd64\theano\theano\gof\cc.py", line 1591, in cthunk_factory
key=key, lnk=self, keep_lock=keep_lock)
File "c:\scisoft\winpython-64bit-2.7.10.3\python-2.7.10.amd64\theano\theano\gof\cmodule.py", line 1145, in module_from_key
module = lnk.compile_cmodule(location)
File "c:\scisoft\winpython-64bit-2.7.10.3\python-2.7.10.amd64\theano\theano\gof\cc.py", line 1502, in compile_cmodule
preargs=preargs)
File "c:\scisoft\winpython-64bit-2.7.10.3\python-2.7.10.amd64\theano\theano\sandbox\cuda\nvcc_compiler.py", line 403, in compile_str
'for cmd', ' '.join(cmd))
Exception: ('The following error happened while compiling the node', GpuCAReduceadd1(<CudaNdarrayType(float32, vector)>), '\n', 'nvcc return status', 2, 'for cmd', 'nvcc -shared -O3 -arch=sm_61 --compiler-bindir C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\bin\\lc.exe -Xlinker /DEBUG -D HAVE_ROUND -m64 -Xcompiler -DCUDA_NDARRAY_CUH=c72d035fdf91890f3b36710688069b2e,-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION,/Zi,/MD -IC:\\Users\\Charles Gillespie\\AppData\\Local\\Theano\\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_63_Stepping_2_GenuineIntel-2.7.10-64\\cuda_ndarray -IC:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v8.0\\include -IC:\\scisoft\\WinPython-64bit-2.7.10.3\\python-2.7.10.amd64\\lib\\site-packages\\numpy\\core\\include -IC:\\scisoft\\WinPython-64bit-2.7.10.3\\python-2.7.10.amd64\\include -Ic:\\scisoft\\winpython-64bit-2.7.10.3\\python-2.7.10.amd64\\theano\\theano\\gof -Ic:\\scisoft\\winpython-64bit-2.7.10.3\\python-2.7.10.amd64\\theano\\theano\\sandbox\\cuda -o C:\\Users\\Charles Gillespie\\AppData\\Local\\Theano\\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_63_Stepping_2_GenuineIntel-2.7.10-64\\tmp6qa5py\\4894639462a290346189bb38dab7bb7e.pyd mod.cu -LC:\\Users\\Charles Gillespie\\AppData\\Local\\Theano\\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_63_Stepping_2_GenuineIntel-2.7.10-64\\cuda_ndarray -LC:\\scisoft\\WinPython-64bit-2.7.10.3\\python-2.7.10.amd64\\libs -LC:\\scisoft\\WinPython-64bit-2.7.10.3\\python-2.7.10.amd64 -lcudart -lcublas -lcuda_ndarray -lpython27', '[GpuCAReduceadd1(<CudaNdarrayType(float32, vector)>)]')
请帮忙!
【问题讨论】:
【参考方案1】:CUDA 8 RC 和 Visual Studio 2015 Update 2 (VC12) 及更高版本不能混合。您必须等到 NVidia 整合并发布更新或卸载 VC12 并安装 VC11。你应该很高兴。
【讨论】:
以上是关于Windows 上的 Theano + Cuda 8.0 - 编译错误的主要内容,如果未能解决你的问题,请参考以下文章
Windows下基于AnacondaCUDAVS2013的Theano环境搭建
基于CUDA的Theano GPU加速环境配置 GPU没有反应.求解答
如何在 Windows 上的 Anaconda Python 中安装 Keras 和 Theano?