gpu-memory-cleanup

Clean up CuPy GPU memory pools in Jupyter notebooks.

3|Updated Dec 10, 2025
One-click install
npx skills add https://github.com/smith6jt-cop/Skills_Registry --skill gpu-memory-cleanup
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gpu-memory-cleanup
Source: https://github.com/smith6jt-cop/Skills_Registry/tree/main/plugins/kintsugi/gpu-memory-cleanup/skills/gpu-memory-cleanup
Command: npx skills add https://github.com/smith6jt-cop/Skills_Registry --skill gpu-memory-cleanup

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill eliminates frustrating Jupyter notebook cell hangs that occur after GPU processing completes, ensuring clean cell completion and responsive kernel behavior.

Quick Start

Add GPU memory cleanup to the current processing cell to prevent the execution indicator from remaining active indefinitely.

Quick Start

Add the GPU memory cleanup pattern to the current Jupyter cell to ensure proper execution termination.

Frequently Asked Questions about gpu-memory-cleanup

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does my Jupyter notebook cell hang after GPU processing with CuPy?

Jupyter cells hang after GPU processing because CuPy's memory pool retains allocated GPU memory even after computation completes. Explicitly freeing the memory pool prevents the kernel from blocking indefinitely and allows cells to finish cleanly.

How do I prevent GPU memory from accumulating in Jupyter notebooks during long-running CuPy tasks?

Call CuPy's memory cleanup methods—cp.get_default_memory_pool().free_all_blocks() and cp.get_default_pinned_memory_pool().free_all_blocks()—followed by Python garbage collection to release GPU memory after processing loops, deconvolution, or multi-GPU pipelines in Jupyter cells.

Can I use explicit GPU memory cleanup with CuPy in interactive Jupyter environments?

Yes. This approach applies specifically to CuPy-based GPU workflows in Jupyter notebooks and interactive environments, with graceful handling when CuPy is unavailable, making it safe to add to existing cells without breaking execution.

What's the best way to clean up GPU memory after illumination correction or deconvolution processing?

Add explicit CuPy memory pool cleanup to your processing cell to prevent accumulation across iterative tasks like BaSiC illumination corrections or EDF processing, ensuring responsive kernel behavior and avoiding cell hangs.

Do I need to modify GPU memory cleanup code for single-GPU versus multi-GPU pipelines?

No. The same CuPy memory cleanup pattern—calling free_all_blocks() on both default and pinned memory pools—works uniformly across single-GPU and multi-GPU pipelines, adapting to your processing scale automatically.