import numpy as np
import cupy as cpSetup on your computer
This is for your future information only. During the course, we will use a temporary training cluster.
Assuming that you have at least one dedicated GPU, you can run CuPy on your computer.
I suggest installing it with uv:
- If you already have CUDA 13, you can install CuPy with uv with:
uv init --bare # Initiate project
uv add cupy-cuda13x # Install CuPyReplace 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]"Setup on Alliance clusters
Load module
Check available Python versions:
module spider pythonCheck requirements to load Python 3.14:
module spider python/3.14.2Double-check that you already have StdEnv/2023:
module listLoad Python 3.14:
module load python/3.14.2Virtual environment
For this course, we have already installed cupy in a virtual environment everybody has access to. All you need to do is to activate it:
source /project/def-sponsor00/cupy_env/bin/activateCreate a virtual env:
python -m venv ~/cupy_envActivate it:
source ~/cupy_env/bin/activateUpdate pip from our wheel:
python -m pip install --upgrade --no-index pipInstall cupy from our wheel:
python -m pip install --no-index cupyLaunch interactive job
salloc --time=10Concepts
CUDA kernel
Devices
| Host | CPU |
| Current device |
