添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I am getting desperate with Chainer because I'm not able to use it with GPU for about a week now. The error I am getting: RuntimeError: CUDA environment is not correctly set up (see https://github.com/chainer/chainer#installation).No module named 'cupy.util'

Code to reproduce:

import chainer
chainer.cuda.to_gpu([0, 0])

Output of chainer.backends.cuda.available is False.

Working on Ubuntu 20.04 (I know, it is not the one from the recommended on Chainer's docs) inside WSL2. CUDA drivers 11.0. Output of nvcc -V:

nvcc: NVIDIA (R) Cuda compiler driver
Built on Wed_Jul_22_19:09:09_PDT_2020
Cuda compilation tools, release 11.0, V11.0.221
Build cuda_11.0_bu.TC445_37.28845127_0

CUDA samples compile and work properly inside WSL2.

According to pip freeze, cupy-cuda110 is installed within an (activated) virtual environment (but not detected, it seems). Chainer version 7.7.0 is installed.

Any ideas how to fix it?

Solution from https://github.com/chainer/chainer/issues/8582 did not seem to do the trick for me.

The error message is very clear. Just change L69 of backends/cuda.py:

from cupy.util import PerformanceWarning as _PerformanceWarning
from cupy._util import PerformanceWarning as _PerformanceWarning

along with the solution from #8582, everything will work just fine.

How is this clear from the error message? I'm genuinely curious, cause this solution (changing cupy.util to cupy._utils) also solved a similar issue I had, but my error message just said No module named 'cupy.util'. – roygbiv Feb 21 at 15:18 @roygbiv since it used to work before, something must have changed in cupy v8. A simple search in GitHub leads me to this commit, and everything is now perfectly clear. – H3NT41 Mar 15 at 12:35

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.