nvcc致命:在PATH中找不到编译器'cl.exe'

时间:2017-07-13 15:44:47

标签: python windows-10 keras conda theano-cuda

当我import keras使用theano作为后端时,我收到以下错误:

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).
nvcc fatal   : Cannot find compiler 'cl.exe' in PATH

这是完整的错误堆栈:

>> import keras
C:\SPB_Data\.keras\keras.json
Using Theano backend.
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>
9
10 #include "cuda_ndarray.cuh"
11
12 #ifndef CNMEM_DLLEXPORT
13 #define CNMEM_DLLEXPORT
14 #endif
15
16 #include "cnmem.h"
17 #include "cnmem.cpp"
18
19 //If true, when there is a gpu malloc or free error, we print the size of allocated memory on the device.
20 #define COMPUTE_GPU_MEM_USED 0
21
22 //If true, we fill with NAN allocated device memory.
23 #define ALLOC_MEMSET 0
24
25 //If true, we print out when we free a device pointer, uninitialize a
26 //CudaNdarray, or allocate a device pointer
27 #define PRINT_FREE_MALLOC 0
28
29 //If true, we do error checking at the start of functions, to make sure there
30 //is not a pre-existing error when the function is called.
31 //You probably need to set the environment variable
32 //CUDA_LAUNCH_BLOCKING=1, and/or modify the CNDA_THREAD_SYNC
33 //preprocessor macro in cuda_ndarray.cuh
34 //if you want this to work.
35 #define PRECHECK_ERROR 0
36
37 cublasHandle_t handle = NULL;
38 int* err_var = NULL;
39
40 /////////////////////////
41 // Alloc and Free
42 /////////////////////////
43
44 static int g_gpu_context_active = 0;
45
46
47 PyObject *
48 CudaNdarray_Dimshuffle(PyObject* _unused, PyObject* args);
49 static PyObject *CudaNdarray_get_shape(CudaNdarray *self, void *closure);
..
... The rest of the file
.
...
5370     if (CudaNdarray_alloc_contiguous(*arr, nd, dims, fortran))
5371     {
5372         if (allocated)
5373         {
5374             Py_DECREF(*arr);
5375             *arr = NULL;
5376         }
5377         return -1;
5378     }
5379     return 0;
5380 }
5381
5382
5383 /*
5384   Local Variables:
5385   mode:c++
5386   c-basic-offset:4
5387   c-file-style:"stroustrup"
5388   indent-tabs-mode:nil
5389   fill-column:79
5390   End:
5391 */
5392 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=79 :
5393
===============================
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).
nvcc fatal   : Cannot find compiler 'cl.exe' in PATH

['nvcc', '-shared', '-O3', '-Xlinker', '/DEBUG', '-D HAVE_ROUND', '-m64', '-Xcompiler', '-DCUDA_NDARRAY_CUH=mc72d035fdf91890f3b36710688069b2e,-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION,/Zi,/MD', '-I"C:\\Anaconda3\\envs\\tensorflow\\lib\\site-packages\\theano\\sandbox\\cuda"', '-I"C:\\Anaconda3\\envs\\tensorflow\\lib\\site-packages\\numpy\\core\\include"', '-I"C:\\Anaconda3\\envs\\tensorflow\\include"', '-I"C:\\Anaconda3\\envs\\tensorflow\\lib\\site-packages\\theano\\gof"', '-L"C:\\Anaconda3\\envs\\tensorflow\\libs"', '-L"C:\\Anaconda3\\envs\\tensorflow"', '-o', 'C:\\AppData\\Local\\Theano\\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-3.5.3-64\\cuda_ndarray\\cuda_ndarray.pyd', 'mod.cu', '-lcublas', '-lpython35', '-lcudart']
ERROR (theano.sandbox.cuda): Failed to compile cuda_ndarray.cu: ('nvcc return status', 1, 'for cmd', 'nvcc -shared -O3 -Xlinker /DEBUG -D HAVE_ROUND -m64 -Xcompiler -DCUDA_NDARRAY_CUH=mc72d035fdf91890f3b36710688069b2e,-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION,/Zi,/MD -I"C:\\Anaconda3\\envs\\tensorflow\\lib\\site-packages\\theano\\sandbox\\cuda" -I"C:\\Anaconda3\\envs\\tensorflow\\lib\\site-packages\\numpy\\core\\include" -I"C:\\Anaconda3\\envs\\tensorflow\\include" -I"C:\\Anaconda3\\envs\\tensorflow\\lib\\site-packages\\theano\\gof" -L"C:\\Anaconda3\\envs\\tensorflow\\libs" -L"C:\\Anaconda3\\envs\\tensorflow" -o C:\\AppData\\Local\\Theano\\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-3.5.3-64\\cuda_ndarray\\cuda_ndarray.pyd mod.cu -lcublas -lpython35 -lcudart')

如何解决这个问题? **我在conda计算机上安装的windows-10环境中运行,确保添加了c1.exe的路径,并在nvcc中输入cmd它被认可:

>nvcc
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).
nvcc fatal   : No input files specified; use option --help for more information

0 个答案:

没有答案