导入Theano时加载编译器库时出错:致命错误C1083

ahstat

我想在Python环境中将Theano与我的GPU一起使用几天。导入theano时,出现以下错误:

d:\anaconda2\include\pyconfig.h(239) : fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory

我试图在PYTHONPATH,PATH和.theanorc.txt中包括“ D:\ Anaconda2 \ MinGW \ x86_64-w64-mingw32 \ include”(此文件夹包含“ pyconfig.h”),并带有相同的错误消息。

您是否有想法将Anaconda / cuda / nvcc连接到Theano中的编译器?

这是我的配置:

  • 作业系统:Windows 7
  • GPU:GeForce GTX 950
  • cl.exe:D:\ Program Files(x86)\ Microsoft Visual Studio 11.0 \ VC \ bin
  • nvcc.exe:C:\ Program Files \ NVIDIA GPU计算工具包\ CUDA \ v8.0 \ bin
  • Python IDE:Anaconda 2中的Spyder,使用Python 2。
  • Theano 0.8.2

我可以通过CPU“导入theano”,但是我想使用GPU进行计算。

输入“ import theano”(与device = gpu一起)后,在显示错误之前,我可以看到一个控制台窗口正在启动“ nvcc.exe”。

我用Visual Studio 2012测试了CUDA,它正在工作,例如,“ bilateralFilter”可以在Visual Studio中正常工作,而不会出现错误:

Found 1 CUDA Capable device(s) supporting CUDA
Device 0: "GeForce GTX 950"
CUDA Runtime Version: 8.0
CUDA Compute Capability: 5.2
...
Running Standard Demonstration with GLUT loop...
  • 这是我的theanorc.txt文件(有或没有[nvcc]和[cuda]都会发生相同的错误)

    [global]
    device = gpu
    floatX = float32
    
    [cuda]
    root = -LC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0
    
    [nvcc]
    flags = -LD:\Anaconda\libs
    fastmath = True
    compiler-bindir = -LD:\Anaconda2\MinGW\x86_64-w64-mingw32\include
    
  • 这是我的路径

    D:\Anaconda2\MinGW\x86_64-w64-mingw32\include
    C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin
    C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\libnvvp
    C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin
    D:\Anaconda2
    D:\Anaconda2\Scripts
    D:\Anaconda2\Library\bin
    C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\
    C:\Program Files\Microsoft SQL Server\110\Tools\Binn\
    
  • 这是我的PYTHONPATH

    D:\Anaconda2\MinGW\x86_64-w64-mingw32\include
    C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC
    C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\amd64
    C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin
    C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0
    C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin
    
  • 这是在Spyder中键入“ import theano”(theanorc.txt中的device = gpu)后的完整错误消息:

    1 #define _CUDA_NDARRAY_C
    2 
    3 #include <Python.h>
    4 #include <structmember.h>
    5 #include "theano_mod_helper.h"
    6 
    7 #include <numpy/arrayobject.h>
    8 #include <iostream>
    ...
    5358 /*
    5359   Local Variables:
    5360   mode:c++
    5361   c-basic-offset:4
    5362   c-file-style:"stroustrup"
    5363   indent-tabs-mode:nil
    5364   fill-column:79
    5365   End:
    5366 */
    5367 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=79 :
    5368 
    ===============================
    c:\program files\nvidia gpu computing toolkit\cuda\v8.0\include\math_functions.h : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
    c:\program files\nvidia gpu computing toolkit\cuda\v8.0\include\math_functions.h(849) : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
    c:\program files\nvidia gpu computing toolkit\cuda\v8.0\include\math_functions.h(1787) : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
    c:\program files\nvidia gpu computing toolkit\cuda\v8.0\include\math_functions.h(2637) : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
    c:\program files\nvidia gpu computing toolkit\cuda\v8.0\include\math_functions.h(3492) : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
    c:\program files\nvidia gpu computing toolkit\cuda\v8.0\include\math_functions.h(4431) : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
    c:\program files\nvidia gpu computing toolkit\cuda\v8.0\include\math_functions.h(5345) : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
    c:\program files\nvidia gpu computing toolkit\cuda\v8.0\include\math_functions.h(6252) : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
    c:\program files\nvidia gpu computing toolkit\cuda\v8.0\include\math_functions.h(7142) : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
    c:\program files\nvidia gpu computing toolkit\cuda\v8.0\include\math_functions.h(7956) : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
    c:\program files\nvidia gpu computing toolkit\cuda\v8.0\include\device_functions.h : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
    c:\program files\nvidia gpu computing toolkit\cuda\v8.0\include\device_functions.h(774) : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
    c:\program files\nvidia gpu computing toolkit\cuda\v8.0\include\device_functions.h(1618) : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
    c:\program files\nvidia gpu computing toolkit\cuda\v8.0\include\device_double_functions.h : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
    c:\program files\nvidia gpu computing toolkit\cuda\v8.0\include\sm_20_intrinsics.h : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
    c:\program files\nvidia gpu computing toolkit\cuda\v8.0\include\sm_20_intrinsics.h(943) : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
    d:\anaconda2\include\pyconfig.h(239) : fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory
    ERROR (theano.sandbox.cuda): Failed to compile cuda_ndarray.cu: ('nvcc return status', 2, 'for cmd', 'nvcc -shared -O3 -LD:\\Anaconda\\libs -use_fast_math -Xlinker /DEBUG -D HAVE_ROUND -m64 -Xcompiler -DCUDA_NDARRAY_CUH=c72d035fdf91890f3b36710688069b2e,-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION,/Zi,/MD -ID:\\Anaconda2\\lib\\site-packages\\theano\\sandbox\\cuda -ID:\\Anaconda2\\lib\\site-packages\\numpy\\core\\include -ID:\\Anaconda2\\include -ID:\\Anaconda2\\lib\\site-packages\\theano\\gof -o C:\\Users\\Administrator\\AppData\\Local\\Theano\\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-2.7.13-64\\cuda_ndarray\\cuda_ndarray.pyd mod.cu -LD:\\Anaconda2\\libs -LD:\\Anaconda2 -lcublas -lpython27 -lcudart')
    WARNING (theano.sandbox.cuda): CUDA is installed, but device gpu is not available  (error: cuda unavailable)
    nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
    mod.cu
    
    ['nvcc', '-shared', '-O3', '-LD:\\Anaconda\\libs', '-use_fast_math', '-Xlinker', '/DEBUG', '-D HAVE_ROUND', '-m64', '-Xcompiler', '-DCUDA_NDARRAY_CUH=c72d035fdf91890f3b36710688069b2e,-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION,/Zi,/MD', '-ID:\\Anaconda2\\lib\\site-packages\\theano\\sandbox\\cuda', '-ID:\\Anaconda2\\lib\\site-packages\\numpy\\core\\include', '-ID:\\Anaconda2\\include', '-ID:\\Anaconda2\\lib\\site-packages\\theano\\gof', '-o', 'C:\\Users\\Administrator\\AppData\\Local\\Theano\\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-2.7.13-64\\cuda_ndarray\\cuda_ndarray.pyd', 'mod.cu', '-LD:\\Anaconda2\\libs', '-LD:\\Anaconda2', '-lcublas', '-lpython27', '-lcudart']
    
ahstat

我找到了解决问题的方法。

简短答案

  1. 将C:\ Windows \ System32添加到PATH
  2. 启动C:\ Program Files(x86)\ Microsoft Visual Studio 11.0 \ VC \ bin \ amd64 \ vcvars64.bat

结尾。

有关信息,这是我新的当前PATH:

C:\Windows\System32
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\amd64
D:\Anaconda2
D:\Anaconda2\Scripts
D:\Anaconda2\Library\bin

这是我的PYTHONPATH:

没有什么

这是我的.theanorc.txt:

[global]
device=gpu
floatx = float32

一些细节

除了PATH之外,还需要配置Windows注册表,如本文所述:Visual Studio中与python26链接的编译错误通过启动vcvars64.bat完成此操作

我以前做过,但是我忘了出现一条消息:

ERROR: Cannot determine the location of the VS Common Tools folder.

根据https://social.msdn.microsoft.com/Forums/zh-CN/78703f6b-f610-456c-b770-76a12be3e1ae/error-cannot-determine-the-location-of-the-vs-common-tools- folder?forum = vssetup,解决方案是将C:\ Windows \ System32添加到PATH。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

安装Matplotlib时出错:致命错误C1083

Microsoft C++ 编译器,致命错误 C1083:无法打开包含文件“stdio.h”

构建CImg时出现致命错误(编译器限制)

导入json文件时出现Typescript编译器错误

使用openmp时,英特尔C编译器给出错误的输出

在Visual C ++ 2010编译器的code :: block中使用小部件库时,发生错误

C1xx:由于文件路径中存在空格,导致致命错误C1083(在为MS VS构建Qt 4.8时)

Scala 编译器在编译 Scala 程序中导入的 Java 库时是否调用 javac?

使用模块时编译器错误 c2237

引发异常时的编译器错误

重载时编译器错误-Java

导出类时编译器错误

从 ConcurrentDictionary 继承时的编译器错误

当 Visual Studio 2017 从 github 源构建时,c1083 错误

使用Edgetpu编译器进行Tensorflow编译时出错

为什么VC ++编译器在复合运算符重载时给出错误?

TypeScript的tsc编译器在调用jQuery和Flot代码时发出错误

在UI元素上右键单击NOT时,为什么编译器会给出错误

尝试使用继承定义类时,编译器给出错误

导入gradle插件生成的cocoapods时,Xcode显示快速的编译器错误

为什么IDEA会报告“加载对象时出错:scalac:错误,缺少依赖项'编译器镜像中的对象scala'”,从而使scala轻而易举?

尝试点动numba JIT编译器时出错

从源代码构建go编译器时出错

使用交叉编译器运行 Makefile 时出错

编译 C 文件时出错。致命错误:找不到“conio.h”文件

Xcode在编译器开始编译时显示错误

编译Qt时出现编译器错误

C2679编译器从std :: istream构造const int成员变量时出错

为什么当a [5] == 5 [a]时C编译器会出错