Claude Skill MartBrowse skillsWhat is a Skill?
Back to list

GPU Optimization for Python (NVIDIA)

Ports CPU-bound scientific Python to NVIDIA GPUs and proves the result is both correct and actually faster.

Dev & CodingAdvanced33,0303,248AI score 9/10Last updated: Aug 9, 2026

What it does

Treats GPU acceleration as an evidence-driven optimization rather than an automatic rewrite.

  • Library selection matrix: maps your existing stack to the right tool — CuPy (NumPy/SciPy), cuDF (pandas), cuML (scikit-learn), nx-cugraph/cuGraph (NetworkX), cuCIM (scikit-image, whole-slide imaging), cuVS (vector search / RAG), KvikIO (GPUDirect Storage, S3→GPU), Warp & Newton (simulation, robotics, autodiff), Numba-CUDA (custom kernels), RAFT (low-level primitives).
  • Least-disruptive-first workflow: try accelerator modes (cudf.pandas, cuml.accel, nx-cugraph) before native APIs, and custom kernels only when profiling proves it.
  • Correctness gates: compare CPU vs GPU with explicit tolerances, cover NaNs, dtypes and ordering, and report recall@k for approximate nearest-neighbor swaps.
  • Honest benchmarking: CUDA events / cupyx.profiler.benchmark with warm-up, nsys timelines, ncu kernel analysis, and end-to-end latency including transfers.
  • Willingness to reject the port: if GPU isn't better, it names the limiting factor (problem size, transfers, silent CPU fallback, memory pressure, launch granularity).

It also flags legacy projects — cuxfilter (final release 26.06) and cuSpatial (archived at 25.04) — so new work doesn't build on dead ends.

Who it's for

  • Researchers and data scientists with large array/dataframe pipelines that run for hours
  • Newcomers to RAPIDS who don't know which library fits their workload
  • Teams doing graph analytics, physics simulation, vector search for RAG, or medical/pathology imaging
  • Anyone who "moved to GPU" and saw no speedup and needs a real diagnosis

Examples

  1. Accelerate a pandas pipeline: hand it a 50M-row aggregation script — it enables cudf.pandas, checks logs for CPU fallback, rewrites only the hot path in native cuDF, and reports before/after timings including transfer cost.
  2. Swap in GPU vector search: replace sklearn NearestNeighbors in a RAG retriever with cuVS, reporting recall@k against exact search so quality loss is visible.
  3. Simulation kernels: JIT-compile a Python particle-simulation loop into Warp kernels, then use an nsys timeline to remove redundant host↔device round trips.

· · · Install guide · · ·

Install in the Claude app (no terminal)
  1. Download the ZIP with the button below.
  2. In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
  3. Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
Download ZIP
Install in Claude Code

Let Claude do it — paste this into Claude Code

Install the skill I found on Claude Skill Mart.
Copy the skills/optimize-for-gpu folder from the GitHub repo K-Dense-AI/scientific-agent-skills into my ~/.claude/skills/optimize-for-gpu/.
When it's done, tell me in one line what this skill can do.

Install with a command instead

git clone https://github.com/K-Dense-AI/scientific-agent-skills.git && mkdir -p ~/.claude/skills && cp -r scientific-agent-skills/skills/optimize-for-gpu ~/.claude/skills/

This is a third-party skill. Check the source repository before installing.

  1. Confirm you have an NVIDIA CUDA-capable GPU on Linux or WSL2 — run nvidia-smi to check the driver and CUDA version.
  2. Make sure Claude Code is installed and the skills folder exists: mkdir -p ~/.claude/skills
  3. Clone the repository: git clone https://github.com/K-Dense-AI/scientific-agent-skills.git
  4. Copy the whole skill directory: cp -r scientific-agent-skills/skills/optimize-for-gpu ~/.claude/skills/
    • Copy the entire folder, including references/ — the skill reads those files before writing any GPU code.
  5. Restart Claude Code and ask something like "optimize this NumPy function for GPU" to trigger the skill.
  6. For actual execution, set up Python 3.11+ and install RAPIDS/CuPy wheels matching your CUDA 12 or 13 install (see references/installation.md; network access required).