Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please help! ERROR (theano.sandbox.cuda): Failed to compile cuda_ndarray.cu: 'utf-8' codec can't decode.... #3551

Closed
liyi193328 opened this issue Oct 24, 2015 · 10 comments

Comments

@liyi193328
Copy link

My environment is win10 + python3.4+ theano 0.7+cuda7.5. when I import theano from teriminal , I get the error like:

ERROR (theano.sandbox.cuda): Failed to compile cuda_ndarray.cu: 'utf-8' codec can't decode......

I set log level as debug, get the folloing info :
INFO (theano.gof.cmodule): Call to 'g++ -march=native' failed,not setting -march flag
DEBUG (theano.gof.cmodule): Compiling for 64 bit architecture
DEBUG (theano.gof.cmodule): Writing module C++ code to C:\Users\liyi1\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-3.4.3-64\cutils_ext\mod.cpp
DEBUG (theano.gof.cmodule): Generating shared lib C:\Users\liyi1\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-3.4.3-64\cutils_ext\cutils_ext.pyd
DEBUG (theano.gof.cmodule): Running cmd: C:\Program Files\mingw-w64\x86_64-5.2.0-posix-seh-rt_v4-rev0\mingw64\bin\g++.exe -shared -g -D NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -DMS_WIN64 -ID:\Anaconda3\lib\site-packages\numpy\core\include -ID:\Anaconda3\include -o C:\Users\liyi1\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-3.4.3-64\cutils_ext\cutils_ext.pyd C:\Users\liyi1\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-3.4.3-64\cutils_ext\mod.cpp -LD:\Anaconda3\libs -LD:\Anaconda3 -lpython34
DEBUG (theano.gof.cmodule): WORKDIR C:\Users\liyi1\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-3.4.3-64
DEBUG (theano.gof.cmodule): module_name cutils_ext.cutils_ext
DEBUG (theano.tensor.opt): enabling optimization fusion elemwise in fast_run
DEBUG (theano.sandbox.cuda.nvcc_compiler): Writing module C++ code to C:\Users\liyi1\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-3.4.3-64\cuda_ndarray\mod.cu
DEBUG (theano.sandbox.cuda.nvcc_compiler): Generating shared lib C:\Users\liyi1\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-3.4.3-64\cuda_ndarray\cuda_ndarray.pyd

DEBUG (theano.sandbox.cuda.nvcc_compiler): Running cmd nvcc -shared -O3 -use_fast_math -Xlinker /DEBUG -D HAVE_ROUND -m64 -Xcompiler -DCUDA_NDARRAY_CUH=m11b90075e2397c684f9dc0f7276eab8f,-D NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION,/Zi,/MD -ID:\Anaconda3\lib\site-packages\theano\sandbox\cuda -ID:\Anaconda3\lib\site-packages\numpy\core\include -ID:\Anaconda3\include -o C:\Users\liyi1\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-3.4.3-64\cuda_ndarray\cuda_ndarray.pyd mod.cu -LD:\Anaconda3\libs -LD:\Anaconda3 -lpython34 -lcublas -lcudart --ptxas-options=-v

ERROR (theano.sandbox.cuda): Failed to compile cuda_ndarray.cu: 'utf-8' codec can't decode byte 0xd5 in position 5319: invalid continuation byte

WARNING (theano.sandbox.cuda): CUDA is installed, but device gpu is not available (error: cuda unavilable)

my theanorc config is :

!sh

[global]
device = gpu
[nvcc]
compiler_bindir=D:\vs2010\VC\bin
flags = -LD:\Anaconda3\libs
fastmath = True

I debug the nvcc_compile.py and theano.sandbox.cuda.init.py a long time, but don't know what's wrong, please help me. Thanks very much!

@luopuya
Copy link

luopuya commented Nov 11, 2015

I have same problem while using python 3 in winpython.
But python 2 in winpython is OK, so I suggest you should try it in python 2

@liyi193328
Copy link
Author

Debugging long long time, I have solved this problem, somewhere like decode(because long time I have forget the concret place), must add decode('gbk').

@nouiz
Copy link
Member

nouiz commented Nov 15, 2015

Did you do a change in Theano? If so, where? Can you make a PR with the
diff?

thanks

On Sun, Nov 15, 2015 at 9:33 AM, liyi notifications@github.com wrote:

Debugging long long time, I have solved this problem, somewhere like
decode(because long time I have forget the concret place), must add
decode('gbk').


Reply to this email directly or view it on GitHub
#3551 (comment).

@liyi193328
Copy link
Author

@nouiz I've changed decode_iter function: yield x.decode('gbk') in compat.init.py, which works in my win python3.4
image

liyi193328 added a commit to liyi193328/Theano that referenced this issue Nov 16, 2015
@cai-lw
Copy link
Contributor

cai-lw commented Mar 15, 2016

I encountered the same problem and found solutions by myself which was the same as those mentioned above.
It is because cl (VS compiler) will generate non-utf8 output if VS is installed in some non-English languages. Decoding by any specific encoding cannot solve the problem. We must find a way to get to know which encoding is cl using.
For Chinese guys: 设成gbk可以解决中文版VS的问题,但是用其他语言的怎么办……必须想办法知道VS用的是哪种编码

@cai-lw
Copy link
Contributor

cai-lw commented Mar 15, 2016

@nouiz Sorry for disturbing. I found this issue because I encountered the same problem, although the issue have been inactive for long, and I come up with a solution that should work for all encodings and compatible with both Python 2 and 3. See #4235 for detail.

@Drekin
Copy link

Drekin commented Jul 18, 2016

We have hit a similar issue in ipython/ipython#9768. At multiple places in nvcc_compiler you are printing nvcc_stdout, which should be a Unicode string by https://github.com/Theano/Theano/blob/master/theano/sandbox/cuda/nvcc_compiler.py#L365, but it seems that it is actually a byte string and our custom sys.stdout fails to decode it sometimes since it assumes UTF-8.

It seems to me that the definitions of decode, decode_iter, and decode_with for Python 2 / 3 are switched in theano.compat. In Python 2 the argument is a byte string and so should be decoded while in Python 3 it is already a Unicode string so no operation is needed, right?

@nouiz
Copy link
Member

nouiz commented Nov 30, 2016

There was many updates in Theano related to path. So I think it is fixed, so closing.

@nouiz nouiz closed this as completed Nov 30, 2016
@kwonmha
Copy link

kwonmha commented Feb 23, 2017

still have same problem in python 3.5(by anaconda), windows 10 64bit, visual studio 2015 community, theano 0.8.2.
If I add 'gbk' like above, I get
Failed to compile cuda_ndarray.cu: 'cp949' codec can't encode character '\u80f6' in position 258: illegal multibyte sequence.

@zzx528
Copy link

zzx528 commented Nov 29, 2020

ERROR (theano.sandbox.cuda): Failed to compile cuda_ndarray.cu: 'utf-8' codec can't decode byte 0xb8 in position 106: invalid start byte,add 'gbk' is fail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants