Create a Python virtual environment:
python -m venv .venvActivate it:
- Windows (PowerShell)
.venv\Scripts\Activate.ps1- Windows (bash)
source .venv/Scripts/activate- macOS/Linux
source .venv/bin/activateGPU acceleration requires a CUDA-compatible NVIDIA GPU with the matching CUDA Toolkit installed.
First, check your CUDA version:
nvcc --versionUpdate requirements.txt file to reflect the version you have installed.
Verify CuPy can see your GPU:
python gpu_check.pyIf you see a DLL load failed error, the installed cupy version does not match your CUDA toolkit — uninstall cupy and reinstall with the correct version above, or use --cpu.
Install dependencies:
pip install -r requirements.txtBy default, the experiment auto-detects GPU availability and falls back to CPU if unavailable.
- Default:
python experiment_1.py- Force CPU (NumPy):
python experiment_1.py --cpu- Force GPU (CuPy) — exits with an error if unavailable:
python experiment_1.py --gpu