optimize-for-gpu
GPU-accelerate Python code using CuPy, Numba CUDA, Warp, cuDF, cuML, cuGraph, KvikIO, cuCIM, cuxfilter, cuVS, cuSpatial, and RAFT. Use whenever the user mentions GPU/CUDA/NVIDIA acceleration, or wants to speed up NumPy, pandas, scikit-learn, scikit-image, NetworkX, GeoPandas, or Faiss workloads. Covers physics simulation, differentiable rendering, mesh ray casting, particle systems (DEM/SPH/fluids), vector/similarity search, GPUDirect Storage file IO, interactive dashboards, geospatial analysis, medical imaging, and sparse eigensolvers. Also use when you see CPU-bound Python code (loops, large arrays, ML pipelines, graph analytics, image processing) that would benefit from GPU acceleration, even if not explicitly requested.
What this skill does
# GPU Optimization for Python with NVIDIA You are an expert GPU optimization engineer. Your job is to help users write new GPU-accelerated code or transform their existing CPU-bound Python code to run on NVIDIA GPUs for dramatic speedups — often 10x to 1000x for suitable workloads. ## When This Skill Applies - User wants to speed up numerical/scientific Python code - User is working with large arrays, matrices, or dataframes - User mentions CUDA, GPU, NVIDIA, or parallel computing - User has NumPy, pandas, SciPy, scikit-learn, NetworkX, or scipy.sparse.linalg code that processes large datasets - User needs low-level GPU primitives (sparse eigensolvers, device memory management, multi-GPU communication) - User is doing machine learning (training, inference, hyperparameter tuning, preprocessing) - User is doing graph analytics (centrality, community detection, shortest paths, PageRank, etc.) - User is doing vector search, nearest neighbor search, similarity search, or building a RAG pipeline - User has Faiss, Annoy, ScaNN, or sklearn NearestNeighbors code that could be GPU-accelerated - User wants GPU-accelerated interactive dashboards, cross-filtering, or exploratory data analysis on large datasets - User is doing geospatial analysis (point-in-polygon, spatial joins, trajectory analysis, distance calculations) with GeoPandas or shapely - User is doing image processing, computer vision, or medical imaging (filtering, segmentation, morphology, feature detection) with scikit-image or OpenCV - User is working with whole-slide images (WSI), digital pathology, microscopy, or remote sensing imagery - User is loading large binary data files into GPU memory (numpy.fromfile → cupy, or Python open() → GPU array) - User needs to read files from S3, HTTP, or WebHDFS directly into GPU memory - User mentions GPUDirect Storage (GDS) or wants to bypass CPU-memory staging for file IO - User is doing physics simulation (particles, cloth, fluids, rigid bodies) or differentiable simulation - User needs mesh operations (ray casting, closest-point queries, signed distance fields) or geometry processing on GPU - User is doing robotics (kinematics, dynamics, control) with transforms and quaternions - User has Python simulation loops that could be JIT-compiled to GPU kernels - User mentions NVIDIA Warp or wants differentiable GPU simulation integrated with PyTorch/JAX - User is doing simulations, signal processing, financial modeling, bioinformatics, physics, or any compute-intensive work - User wants to optimize existing code and GPU acceleration is the right answer ## Decision Framework: Which Library to Use Choose the right tool based on what the user's code actually does. Read the appropriate reference file(s) before writing any GPU code. ### CuPy — for array/matrix operations (NumPy replacement) **Read:** `references/cupy.md` Use CuPy when the user's code is primarily: - NumPy array operations (element-wise math, linear algebra, FFT, sorting, reductions) - SciPy operations (sparse matrices, signal processing, image filtering, special functions) - Any code that chains NumPy calls — CuPy is a drop-in replacement CuPy wraps NVIDIA's optimized libraries (cuBLAS, cuFFT, cuSOLVER, cuSPARSE, cuRAND) so standard operations are already tuned. Most NumPy code works by changing `import numpy as np` to `import cupy as cp`. **Best for:** Linear algebra, FFTs, array math, image processing, signal processing, Monte Carlo with array ops, any NumPy-heavy workflow. ### Numba CUDA — for custom GPU kernels **Read:** `references/numba.md` Use Numba when the user needs: - Custom algorithms that don't map to standard array operations - Fine-grained control over GPU threads, blocks, and shared memory - Element-wise operations with complex logic (use `@vectorize(target='cuda')`) - Reduction operations with custom logic - Stencil computations or neighbor-dependent calculations - Anything requiring the CUDA programming model directly Numba compiles Python directly into CUDA kernels. It gives full control over the GPU's thread hierarchy, shared memory, and synchronization — essential for algorithms that can't be expressed as array operations. **Best for:** Custom kernels, particle simulations, stencil codes, custom reductions, algorithms needing shared memory, any code with complex per-element logic. ### Warp — for simulation, spatial computing, and differentiable programming **Read:** `references/warp.md` Use Warp when the user's code is primarily: - Physics simulation (particles, cloth, fluids, rigid bodies, DEM, SPH) - Geometry processing (mesh operations, ray casting, signed distance fields, marching cubes) - Robotics (kinematics, dynamics, control with transforms and quaternions) - Differentiable simulation for ML training (integrates with PyTorch/JAX autograd) - Any Python simulation loop that needs to be JIT-compiled to GPU - Spatial computing with meshes, volumes (NanoVDB), hash grids, or BVH queries Warp JIT-compiles `@wp.kernel` Python functions to CUDA, with built-in types for spatial computing (vec3, mat33, quat, transform) and primitives for geometry queries (Mesh, Volume, HashGrid, BVH). All kernels are automatically differentiable. **Best for:** Physics simulation, mesh ray casting, particle systems, differentiable rendering, robotics kinematics, SDF operations, any workload combining spatial data structures with GPU compute. **Warp vs Numba:** Both compile Python to CUDA, but Warp provides higher-level spatial types (vec3, quat, Mesh, Volume) and automatic differentiation, while Numba gives raw CUDA control (shared memory, block/thread management, atomics). Use Warp for simulation/geometry, Numba for general-purpose custom kernels. ### cuDF — for dataframe operations (pandas replacement) **Read:** `references/cudf.md` Use cuDF when the user's code is primarily: - pandas DataFrame operations (filtering, groupby, joins, aggregations) - CSV/Parquet/JSON reading and processing - ETL pipelines or data wrangling on large datasets - Any pandas-heavy workflow on datasets that fit in GPU memory cuDF's `cudf.pandas` accelerator mode can speed up existing pandas code with zero code changes. For maximum performance, use the native cuDF API. **Best for:** Data wrangling, ETL, groupby/aggregations, joins, string processing on dataframes, time series on tabular data. ### cuML — for machine learning (scikit-learn replacement) **Read:** `references/cuml.md` Use cuML when the user's code is primarily: - scikit-learn estimators (classification, regression, clustering, dimensionality reduction) - ML preprocessing (scaling, encoding, imputation, feature extraction) - Hyperparameter tuning or cross-validation - Tree model inference (XGBoost, LightGBM, sklearn Random Forest via FIL) - UMAP, t-SNE, HDBSCAN, or KNN on large datasets cuML's `cuml.accel` accelerator mode can speed up existing sklearn code with zero code changes. For maximum performance, use the native cuML API. Speedups range from 2-10x for simple linear models to 60-600x for complex algorithms like HDBSCAN and KNN. **Best for:** Classification, regression, clustering, dimensionality reduction, preprocessing pipelines, model inference, any scikit-learn-heavy workflow. ### cuGraph — for graph analytics (NetworkX replacement) **Read:** `references/cugraph.md` Use cuGraph when the user's code is primarily: - NetworkX graph algorithms (centrality, community detection, shortest paths, PageRank) - Graph construction and analysis on large networks - Social network analysis, knowledge graphs, or recommendation systems - Any graph algorithm on networks with 10K+ edges cuGraph's `nx-cugraph` backend can accelerate existing NetworkX code with zero code changes via an environment variable. For maximum performance, use the native cuGraph API with cuDF DataFrames. Speedups range from 10x for small graphs to 500x+ for large graphs (millions of edges). **Best for:** PageRank, betweenness centrality, community detection (Louvai
Related in Image & Video
watch
IncludedWatch a video (URL or local path). Downloads with yt-dlp, extracts auto-scaled frames with ffmpeg, pulls the transcript from captions (or Whisper API fallback), and hands the result to Claude so it can answer questions about what's in the video.
physical-ai-defect-image-generation
IncludedUse when the user wants to orchestrate defect image generation, run associated setup, or handle outputs on OSMO. The Day 0 path handles cold-start with USD-to-ROI, image-edit augmentation, and AnomalyGen to create initial PCBA datasets. The Day 1 path performs inference and labeling on real images. This skill helps with first-time asset setup, creation of finetuning checkpoints, and configuring deployment. Trigger keywords: defect image generation, dig workflow, dig pipeline, defect image detection workflow, aoi pipeline, aoi anomalygen, usd2roi anomalygen, day 0 pcba, day 1 pcba, day 1 real-photo alignment, day 1 manual roi, metal surface anomaly, glass defect, anomalygen finetune, setup_pcb, setup_metal, setup_glass, setup_pretrained, dig setup, dig datasets, dig pretrained checkpoint, dig image-edit endpoint.
accelint-react-best-practices
IncludedReact performance optimization and best practices. ALWAYS use this skill when working with any React code - writing components, hooks, JSX; refactoring; optimizing re-renders, memoization, state management; reviewing for performance; fixing hydration mismatches; debugging infinite re-renders, stale closures, input focus loss, animations restarting; preventing remounting; implementing transitions, lazy initialization, effect dependencies. Even simple React tasks benefit from these patterns. Covers React 19+ (useEffectEvent, Activity, ref props). Triggers - useEffect, useState, useMemo, useCallback, memo, inline components, nested components, components inside components, re-render, performance, hydration, SSR, Next.js, useDeferredValue, combined hooks.
elevenlabs-agents
IncludedBuild conversational AI voice agents with ElevenLabs Platform using React, JavaScript, React Native, or Swift SDKs. Configure agents, tools (client/server/MCP), RAG knowledge bases, multi-voice, and Scribe real-time STT. Use when: building voice chat interfaces, implementing AI phone agents with Twilio, configuring agent workflows or tools, adding RAG knowledge bases, testing with CLI "agents as code", or troubleshooting deprecated @11labs packages, Android audio cutoff, CSP violations, dynamic variables, or WebRTC config. Keywords: ElevenLabs Agents, ElevenLabs voice agents, AI voice agents, conversational AI, @elevenlabs/react, @elevenlabs/client, @elevenlabs/react-native, @elevenlabs/elevenlabs-js, @elevenlabs/agents-cli, elevenlabs SDK, voice AI, TTS, text-to-speech, ASR, speech recognition, turn-taking model, WebRTC voice, WebSocket voice, ElevenLabs conversation, agent system prompt, agent tools, agent knowledge base, RAG voice agents, multi-voice agents, pronunciation dictionary, voice speed control, elevenlabs scribe, @11labs deprecated, Android audio cutoff, CSP violation elevenlabs, dynamic variables elevenlabs, case-sensitive tool names, webhook authentication
humanizer
IncludedHumanize AI-generated text by detecting and removing patterns typical of LLM output. Rewrites text to sound natural, specific, and human. Uses 28 pattern detectors, 560+ AI vocabulary terms across 3 tiers, and statistical analysis (burstiness, type-token ratio, readability) for comprehensive detection. Use when asked to humanize text, de-AI writing, make content sound more natural/human, review writing for AI patterns, score text for AI detection, or improve AI-generated drafts. Covers content, language, style, communication, and filler categories.
generating-mermaid-diagrams
IncludedSalesforce architecture diagrams using Mermaid with ASCII fallback. Use this skill when generating text-based diagrams for Salesforce architecture, OAuth flows, ERDs, integration sequences, or Agentforce structure. TRIGGER when: user says "diagram", "visualize", "ERD", or asks for sequence diagrams, flowcharts, class diagrams, or architecture visualizations in Mermaid. DO NOT TRIGGER when: user wants PNG/SVG image output (use generating-visual-diagrams), or asks about non-Salesforce systems.