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

module 'cupy.cudnn' has no attribute 'cudnn' #9

Open
Carreraa opened this issue Jul 19, 2018 · 4 comments
Open

module 'cupy.cudnn' has no attribute 'cudnn' #9

Carreraa opened this issue Jul 19, 2018 · 4 comments

Comments

@Carreraa
Copy link

Carreraa commented Jul 19, 2018

Hello Brad

when I tried to run alex.py, I run into this 'AttributeError:module 'cupy.cudnn' has no attribute 'cudnn''

The detail is as following:

/usr/bin/python3.5 /home/carrera/WebAR/ebnn/examples/alex.py
/usr/local/lib/python3.5/dist-packages/h5py/init.py:34: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
from ._conv import register_converters as _register_converters
Traceback (most recent call last):
File "/home/carrera/WebAR/ebnn/examples/alex.py", line 4, in
import net
File "/home/carrera/WebAR/ebnn/examples/net.py", line 10, in
import ebnn.links as BL
File "/home/carrera/WebAR/ebnn/ebnn/links/init.py", line 77, in
from .link_binary_convolution import BinaryConvolution2D
File "/home/carrera/WebAR/ebnn/ebnn/links/link_binary_convolution.py", line 12, in
from ..functions.function_binary_convolution_2d import binary_convolution_2d
File "/home/carrera/WebAR/ebnn/ebnn/functions/function_binary_convolution_2d.py", line 11, in
libcudnn = cuda.cudnn.cudnn
AttributeError: module 'cupy.cudnn' has no attribute 'cudnn'

This is my environment : pycharm , chainer4.2.0 , cupy4.2.0 , cuda9.0 , cudnn7.0.5

Do you know how to solve this problem?

Thank you
Carrera

@BradMcDanel
Copy link
Collaborator

Most likely it is a version difference in Chainer. This code was written using Chainer v2. If it fails to run on v2, then please post a followup. Thanks!

@Carreraa
Copy link
Author

Me again

I setup all packages listed in the requirements.txt in my virtualenv, but I run into this problem as following:

/usr/bin/python3.5 /home/carrera/WebAR/ebnn/examples/alex.py
/usr/local/lib/python3.5/dist-packages/h5py/init.py:34: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
from ._conv import register_converters as _register_converters
Traceback (most recent call last):
File "/home/carrera/WebAR/ebnn/examples/alex.py", line 20, in
util.train_model(model, train, test, args)
File "/home/carrera/WebAR/ebnn/examples/util.py", line 32, in train_model
cuda.get_device(args.gpu).use()
File "/usr/local/lib/python3.5/dist-packages/chainer/backends/cuda.py", line 223, in get_device
return _get_device(*args)
File "/usr/local/lib/python3.5/dist-packages/chainer/backends/cuda.py", line 229, in _get_device
check_cuda_available()
File "/usr/local/lib/python3.5/dist-packages/chainer/backends/cuda.py", line 90, in check_cuda_available
raise RuntimeError(msg)
RuntimeError: CUDA environment is not correctly set up
(see https://github.com/chainer/chainer#installation).No module named 'cupy'

Is this because cupy1.0.1 is not compatible with cuda9.0 or other problems ?

Thanks

@BradMcDanel
Copy link
Collaborator

I am not sure -- but it very well could be due to cuda9.0. I realize it can be a pain to get things setup correctly, especially for older versions. If I ever get time I may upgrade this to chainer 4, but it is always a constant maintenance issue of keeping projects up to date.

@MohanadOdema
Copy link

Hello,

Indeed for me the problem was due to the difference in Chainer versions. Under different versions, the hierarchy of the imported modules in Chainer can be a bit different plus some of the methods may have alternate names in the newer versions. I followed it through and got it working on my GPU.

Regarding the file function_binary_convolution_2d.py above, it worked for me by changing the declaration in line 11 from
libcudnn = cuda.cudnn.cudnn to libcudnn = cuda.cupy.cuda.cudnn

I also used the help function on the imported module cuda.cupy.cuda.cudnn to get the new names of the methods need in this file.

I used for my environment chainer==6.3.0 and cupy-cuda101==6.3.0. My cuda toolkit is 10.0.1.

I'am attaching this modified file for references.
function_binary_convolution_2d.txt

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

No branches or pull requests

3 participants