Skip to content

CuPy

A NumPy/SciPy-compatible array library that runs Python array code on NVIDIA GPUs.

Stars
12.4k
Forks
1.2k
Licence
MIT
Language
Python
Last update
5 days ago
Type
Library

What it is

CuPy is a Python library that mirrors the NumPy and SciPy interfaces but runs the array calculations on a GPU. The README describes it as a drop-in replacement, so existing NumPy or SciPy code can often be moved to the GPU with few changes. It also exposes lower-level CUDA features for people who need them.

  • Run an existing NumPy array calculation on the GPU by changing the import to cupy
  • Pass CuPy arrays to existing CUDA C/C++ programs through RawKernels
  • Use CUDA streams or call CUDA Runtime APIs directly from Python

Great for

  • Python users with NVIDIA GPUs who want to speed up NumPy-style array code
  • Researchers or engineers moving existing NumPy/SciPy scripts onto a GPU
  • Developers who want to call their own CUDA C/C++ kernels from Python using arrays

Not ideal for

  • People without an NVIDIA (or supported AMD) GPU, since the library is built around GPU hardware
  • Small workloads where data transfer to the GPU would cost more than the computation saves (general reasoning, not stated in the README)
Step-by-step guide: how to use CuPyInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Python · NVIDIA GPU with a CUDA driver

    Install for CUDA 12.x (pip)

    pip install cupy-cuda12x

    Install for CUDA 13.x (pip)

    pip install cupy-cuda13x

    Install from conda-forge

    conda install -c conda-forge cupy
  2. 2

    Run it

    • Install a CuPy package matching your CUDA version using one of the install commands
    • Start Python and run import cupy as cp
    • Create an array with cp.arange(6).reshape(2, 3) and call .sum(axis=1) to see a result on the GPU
  3. 3

    Get the most out of it

    • Read the comparison page in the docs to see which NumPy/SciPy code will run unchanged
    • Use RawKernels to run your own CUDA C/C++ code on CuPy arrays
    • Try the Docker image (docker run --gpus all -it cupy/cupy) to avoid local setup
    • Explore the examples folder and the tutorial linked in the README

Downloads

Strengths

  • Familiar NumPy and SciPy API lowers the cost of switching to GPU computing
  • Supports both CUDA (NVIDIA) and ROCm (AMD, experimental) platforms per the README
  • MIT licensed with official wheels and conda packages

Trade-offs

  • AMD ROCm support is marked experimental in the README
  • Requires a compatible NVIDIA CUDA setup; the README lists CUDA 12.x and 13.x packages
  • Not every NumPy/SciPy function is covered, so the comparison page should be checked for your code

How it compares

ProjectStarsTypeLevelUpdatedBest for
cupy (this)12.4kLibraryintermediate5 days agoPython users with NVIDIA GPUs who want to speed up NumPy-style array code
gpu.js15.5kLibraryintermediate6 days agoDevelopers who need to speed up large numeric computations in the browser
PythonDataScienceHandbook50.3kLearning resourcebeginner2.4 years agoStudents learning NumPy, Pandas, Matplotlib, or Scikit-Learn through hands-on examples
stats43kAppbeginner5 days agoMac users who want a glanceable view of CPU, memory, network or battery in the menu bar
WebGL-Fluid-Simulation16.8kAppbeginner2.0 years agoPeople curious about how fluids behave in a visual, hands-on way
cheatsheets-ai15.4kLearning resourcebeginner7.1 years agoStudents who want a one-page summary of a library's main functions

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.