Using CuPy after this course

Author

Marie-Hélène Burle

This section is for your future reference. It explains how, after this course, you can use CuPy on your computer (provided you have suitable hardware) and on the Alliance supercomputers.

For this course however, we have already set everything up for you on a virtual cluster (see next section). So please do not run any of the following during the course.

On your computer

Requirements

To run CuPy on your computer, you need a supported OS and at least one supported GPU. If you don’t, you can use a cloud service or the Alliance supercomputers.

Installation

I suggest installing CuPy on your computer with uv:

  • If you already have CUDA 13, you can install CuPy with:
uv init --bare                        # Initiate project
uv add cupy-cuda13x                   # Install CuPy

Replace cupy-cuda13x by cupy-cuda12x if you have CUDA 12.

  • If you don’t have CUDA, install CuPy with a CUDA toolkit as a dependency with:
uv add "cupy-cuda13x[ctk]"

On Alliance clusters

Load module

Check available Python versions:

module spider python

Check requirements to load Python 3.14:

module spider python/3.14.2

Double-check that you already have StdEnv/2023:

module list

Load Python 3.14:

module load python/3.14.2

Virtual environment

Create a virtual env:

python -m venv ~/cupy_env

You can name the environment however you like.

Activate it:

source ~/cupy_env/bin/activate

Update pip from our wheel:

python -m pip install --upgrade --no-index pip

Install cupy from our wheel:

python -m pip install --no-index cupy