I am trying to run chainer with GPU on google colab. This requires cupy installed however I fail to install this properly as it cannot find the cuda environment in my colab vm.
Error message as follows...
Collecting cupy Downloading cupy-2.4.0.tar.gz (1.7MB) 100% |████████████████████████████████| 1.7MB 740kB/s Complete output from command python setup.py egg_info: cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ /tmp/tmpds3ikncy/a.cpp:1:10: fatal error: cublas_v2.h: No such file or directory #include ^~~~~~~~~~~~~ compilation terminated. Options: {'profile': False, 'linetrace': False, 'annotate': False, 'no_cuda': False} ************************************************** * WARNING: nvcc not in path. * WARNING: Please set path to nvcc. ************************************************** Include directories: [] Library directories: [] command 'x86_64-linux-gnu-gcc' failed with exit status 1 ************************************************** * WARNING: Include files not found: ['cublas_v2.h', 'cuda.h', 'cuda_profiler_api.h', 'cuda_runtime.h', 'curand.h', 'cusparse.h', 'nvrtc.h', 'nvToolsExt.h'] * WARNING: Skip installing cuda support *** WARNING: Check your CFLAGS environment variable ************************************************** Traceback (most recent call last): File "", line 1, in File "/tmp/pip-build-qu5red9h/cupy/setup.py", line 32, in ext_modules = cupy_setup_build.get_ext_modules() File "/tmp/pip-build-qu5red9h/cupy/cupy_setup_build.py", line 385, in get_ext_modules extensions = make_extensions(arg_options, compiler, use_cython) File "/tmp/pip-build-qu5red9h/cupy/cupy_setup_build.py", line 275, in make_extensions raise Exception('Your CUDA environment is invalid. ' Exception: Your CUDA environment is invalid. Please check above error log.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-qu5red9h/cupy/
You can also install the development version of CuPy from a cloned Git repository: $ git clone https://github.com/cupy/cupy.git $ cd cupy $ pip install . If you are using source tree downloaded from GitHub, you need to install Cython 0.28. 0 or later ( pip install cython ).
All that's required is a small snippet of your code in C++ format and CuPy will automatically do the GPU conversion, very similar to using Cython.
More technically, Colab is a hosted Jupyter notebook service that requires no setup to use, while providing access free of charge to computing resources including GPUs.
Edit: Google Colaboratory now provides Chainer, CuPy and iDeep by default. Manual installation is no longer necessary.
Original Answer:
You can use a wheel to avoid building CuPy by yourself on Google Colab. Chainer officially provides snippet to install Chainer/CuPy on Google Colab.
!curl https://colab.chainer.org/install | sh -
We do not need to install cupy manually in Google colab. In Notebook Settings under Edit we can choose GPU. If you have chainer already installed you can confirm availability of cupy through this:
chainer.print_runtime_info()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With