/cupy

NumPy-like API accelerated with CUDA

Primary LanguagePythonOtherNOASSERTION

pypi GitHub license travis coveralls Read the Docs

CuPy : NumPy-like API accelerated with CUDA

Requirements

CuPy is tested on Ubuntu 14.04 and CentOS 7. We recommend them to use CuPy, though it may run on other systems as well.

Minimum requirements:

  • Python 2.7.6+, 3.4.3+, 3.5.1+, 3.6.0+
  • NumPy 1.9, 1.10, 1.11, 1.12
  • Six 1.9

Requirements for some features:

  • CUDA support
    • CUDA 7.0, 7.5, 8.0
    • g++ 4.8.4+
  • cuDNN support
    • cuDNN v4, v5, v5.1, v6
  • Testing utilities
    • Mock
    • Nose

Installation

Minimum installation

If you use old setuptools, upgrade it:

pip install -U setuptools

Then, install CuPy via PyPI:

pip install cupy

You can also install CuPy from the source code:

python setup.py install

Installation with CUDA

If you want to enable CUDA, first you have to install CUDA and set the environment variable PATH and LD_LIBRARY_PATH for CUDA executables and libraries. For example, if you are using Ubuntu and CUDA is installed by the official distribution, then CUDA is installed at /usr/local/cuda. In this case, you have to add the following lines to .bashrc or .zshrc (choose which you are using):

export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH

If you want to enable cuDNN, add a directory containing cudnn.h to CFLAGS, and add a directory containing libcudnn.so to LDFLAGS and LD_LIBRARY_PATH:

export CFLAGS=-I/path/to/cudnn/include
export LDFLAGS=-L/path/to/cudnn/lib
export LD_LIBRARY_PATH=/path/to/cudnn/lib:$LD_LIBRARY_PATH

Do not forget to restart your terminal session (or source it) to enable these changes. And then, reinstall CuPy.

Multi-GPU Support

Multi-GPU training is supported by MultiprocessParallelUpdater. If you want to use MultiprocessParallelUpdater, please install NCCL by following the installation guide.

Run with Docker

We provide the official Docker image. Use nvidia-docker command to run CuPy image with GPU. You can login to the environment with bash, and run the Python interpreter.

$ nvidia-docker run -it cupy/cupy /bin/bash

More information

License

MIT License (see LICENSE file).