cuda

NVIDIA CUDA parallel computing platform — use when writing .cu kernels, using cuBLAS/cuDNN/cuFFT/cuSPARSE/cuRAND/cuSolver, Thrust, or Cooperative Groups for GPU-accelerated computing

8 stars

Best use case

cuda is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

NVIDIA CUDA parallel computing platform — use when writing .cu kernels, using cuBLAS/cuDNN/cuFFT/cuSPARSE/cuRAND/cuSolver, Thrust, or Cooperative Groups for GPU-accelerated computing

Teams using cuda should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/cuda/SKILL.md --create-dirs "https://raw.githubusercontent.com/datathings/marketplace/main/plugins/cuda/skills/cuda/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/cuda/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How cuda Compares

Feature / AgentcudaStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

NVIDIA CUDA parallel computing platform — use when writing .cu kernels, using cuBLAS/cuDNN/cuFFT/cuSPARSE/cuRAND/cuSolver, Thrust, or Cooperative Groups for GPU-accelerated computing

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# CUDA

## Overview

CUDA is NVIDIA's parallel computing platform and programming model for GPU-accelerated applications. It provides direct access to the GPU's virtual instruction set and parallel compute elements for executing kernels in C, C++, and Fortran.

**cuda-samples version:** v13.2 (CUDA Toolkit 13.2)
**CUDALibrarySamples:** main (April 2026)
**Language:** C/C++ (.cu files)
**Licenses:** BSD-3-Clause (cuda-samples), Apache-2.0 (CUDALibrarySamples)

## Quick Start

```c
// Minimal kernel + launch
__global__ void addVectors(float *a, float *b, float *c, int n) {
    int i = blockIdx.x * blockDim.x + threadIdx.x;
    if (i < n) c[i] = a[i] + b[i];
}

int main() {
    int n = 1 << 20;
    float *d_a, *d_b, *d_c;
    cudaMalloc(&d_a, n * sizeof(float));
    cudaMalloc(&d_b, n * sizeof(float));
    cudaMalloc(&d_c, n * sizeof(float));

    int threads = 256;
    int blocks = (n + threads - 1) / threads;
    addVectors<<<blocks, threads>>>(d_a, d_b, d_c, n);
    cudaDeviceSynchronize();

    cudaFree(d_a); cudaFree(d_b); cudaFree(d_c);
    return 0;
}
```

## Core Concepts

- **Kernel**: `__global__` function executed on GPU by many parallel threads
- **Grid/Block/Thread**: Launch hierarchy — `<<<gridDim, blockDim>>>` configures parallelism
- **Device memory**: Must be explicitly allocated with `cudaMalloc` and freed with `cudaFree`
- **Streams**: Async execution queues; default stream is synchronous with host
- **Unified Memory** (`cudaMallocManaged`): Automatically migrates data between CPU and GPU; check support with `device_prop.managedMemory`

## API Reference

| Domain | File | Description |
|--------|------|-------------|
| CUDA Runtime | [api-runtime.md](references/api-runtime.md) | Device mgmt, memory, streams, events, kernel launch |
| cuBLAS | [api-cublas.md](references/api-cublas.md) | Dense linear algebra: GEMM, GEMV, TRSM, grouped batched ops |
| cuFFT | [api-cufft.md](references/api-cufft.md) | 1D/2D/3D FFT and batched transforms |
| cuSPARSE | [api-cusparse.md](references/api-cusparse.md) | Sparse matrix ops: SpMM, SpMV, format conversions |
| cuRAND | [api-curand.md](references/api-curand.md) | Random number generation on GPU |
| cuSolver | [api-cusolver.md](references/api-cusolver.md) | Dense/sparse solvers: QR, LU, eigenvalue, SVD |
| Thrust | [api-thrust.md](references/api-thrust.md) | STL-like GPU algorithms: sort, reduce, transform, scan |
| Cooperative Groups | [api-cooperative-groups.md](references/api-cooperative-groups.md) | Flexible thread synchronization beyond blocks |
| Workflows | [workflows.md](references/workflows.md) | Complete working examples |

## Common Workflows

See [references/workflows.md](references/workflows.md) for complete examples.

Quick reference:
- **Matrix multiply**: see workflows.md — cuBLAS GEMM section
- **FFT**: see workflows.md — cuFFT 1D section
- **Custom kernel**: see workflows.md — Custom CUDA Kernel section
- **Unified memory**: see workflows.md — Unified Memory section
- **Error-check macros**: see workflows.md — Error-Checked CUDA Boilerplate

## Key Considerations

- **Error checking**: Always check return codes; use `CUDA_CHECK(err)` macro pattern
- **Synchronization**: `cudaDeviceSynchronize()` or stream synchronize before reading results on host
- **Memory alignment**: 128-byte alignment for coalesced global memory access
- **Occupancy**: Use `cudaOccupancyMaxPotentialBlockSize` to tune block dimensions; uses `uint32_t` for array indexing to avoid overflow
- **Tensor Cores**: Available on Volta+ (sm_70+); cuBLAS uses them automatically for GEMM with correct types
- **Column-major**: cuBLAS and cuSolver use Fortran (column-major) layout — transpose row-major C arrays or swap dimensions
- **cuFFT normalization**: cuFFT does NOT normalize inverse transforms; divide by N manually
- **Streams**: Always use `cudaStreamNonBlocking` when creating non-default streams to avoid implicit synchronization with the null stream
- **Unified Memory support**: Check `device_prop.managedMemory` before using `cudaMallocManaged`; use `cudaMemPrefetchAsync` to avoid page faults
- **Driver API cleanup**: Always call `cuModuleUnload` before `cuCtxDestroy` when using the CUDA Driver API
- **Compile flags**: Use `--gpu-architecture=sm_90a` for Hopper (H100), `sm_80` for Ampere (A100), `sm_70` for Volta (V100)
- **Thrust tuples**: Use `cuda::std::tuple`, `cuda::std::make_tuple`, and `cuda::std::get` (the `thrust::tuple` variants are replaced)

Related Skills

rocm

8
from datathings/marketplace

AMD ROCm GPU computing stack for HIP kernel development and GPU-accelerated library usage. Use when: writing HIP kernels (.hip files), using rocBLAS/rocFFT/rocRAND/rocSOLVER/rocSPARSE/hipBLAS/hipBLASLt/hipTensor/hipSPARSELt/rocALUTION compute libraries, profiling with rocProfiler or rocprof, porting CUDA code to HIP, building CMake/Makefile projects targeting AMD GPUs, using HIP Graphs for low-overhead kernel replay, or debugging GPU code with rocGDB.

powergridmodel

8
from datathings/marketplace

Python library for steady-state distribution power system analysis (power flow, state estimation, short-circuit calculations). Use when working with the power-grid-model library to: (1) perform load flow or Newton-Raphson/iterative calculations on electrical grids, (2) run state estimation with sensor data, (3) compute IEC 60909 short-circuit currents, (4) execute batch/time-series or N-1 contingency simulations, or (5) work with grid component types (node, line, transformer, source, sym_load, etc.) and numpy structured arrays.

pandapower

8
from datathings/marketplace

Power systems analysis and optimization library (pandapower v3.4.0). Use when working with electric power networks: building network models (buses, lines, transformers, loads, generators), running AC/DC power flow, optimal power flow (OPF), short circuit calculations (IEC 60909), state estimation, time series simulations, network topology analysis, or visualizing power grids in Python.

opencl

8
from datathings/marketplace

OpenCL SDK (Khronos Group) for cross-platform GPU/CPU parallel computing in C and C++. Use when writing OpenCL kernels, managing devices/contexts/queues, allocating and transferring buffers or images, building and executing programs, or using the C++ wrapper (opencl.hpp / cl::CommandQueue, cl::Buffer, cl::KernelFunctor). Covers OpenCL C API, C++ bindings, and SDK utility libraries (OpenCLUtils, OpenCLSDK).

ollama

8
from datathings/marketplace

Run and manage local LLMs via Ollama REST API — text generation, chat completions, embeddings, tool calling, structured output, and model management. Use when code imports ollama, references localhost:11434, or user asks about local LLM inference.

llamacpp

8
from datathings/marketplace

Complete llama.cpp C/C++ API reference covering model loading, inference, text generation, embeddings, chat, tokenization, sampling, batching, KV cache, LoRA adapters, and state management. Triggers on: llama.cpp questions, LLM inference code, GGUF models, local AI/ML inference, C/C++ LLM integration, "how do I use llama.cpp", API function lookups, implementation questions, troubleshooting llama.cpp issues, and any llama-cpp or ggerganov/llama.cpp mentions.

greycat

8
from datathings/marketplace

Build, run, and edit GreyCat projects. GreyCat is a statically-typed language plus runtime for graph-persistent, time-series-aware applications. Use when reading or writing `.gcl` source, when the user mentions GreyCat / project.gcl / nodeTime / nodeList / nodeIndex / nodeGeo / @expose / @library, or when the task involves running `greycat <command>`, deploying a project, or reasoning about gcdata/, lib/, files/, webroot/.

greycat-c

8
from datathings/marketplace

GreyCat C API and GCL Standard Library reference. Use for: (1) Native C development with gc_machine_t context, tensors, objects, memory management, crypto, I/O; (2) GCL Standard Library modules - std::core (Date/Time/Tuple/geospatial types), std::runtime (Scheduler/Task/Logger/User/Security/System/OpenAPI/MCP), std::io (CSV/JSON/XML/HTTP/Email/FileWalker), std::util (Queue/Stack/SlidingWindow/Gaussian/Histogram/Quantizers/Random/Plot); (3) Plugin development patterns - lifecycle hooks, type configuration, nativegen, module-level and type-level function linking, global state, thread safety, conditional logging. Keywords: GreyCat, GCL, native functions, tensors, task automation, scheduler, plugin development.

ggml

8
from datathings/marketplace

C tensor computation library for ML inference and training. Use when working with ggml graphs, GGUF model files, backend scheduling, quantization, or implementing low-level ML ops in C/C++.

blas_lapack

8
from datathings/marketplace

Complete CBLAS and LAPACKE C API reference (LAPACK v3.12.1) covering 1284 functions for numerical linear algebra: BLAS Level 1/2/3 vector and matrix operations, linear system solvers (LU, Cholesky, LDL), eigenvalue/eigenvector computation, singular value decomposition, least squares, QR/LQ factorizations, and auxiliary routines. Triggers on: BLAS/LAPACK questions, CBLAS/LAPACKE code, linear algebra in C/C++, matrix operations, numerical computing, scientific computing, HPC, linking BLAS/LAPACK.

skill-creator

8
from datathings/marketplace

Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.

cuda-kernels

14
from burtenshaw/kernel-skill

Provides guidance for writing and benchmarking optimized CUDA kernels for NVIDIA GPUs (H100, A100, T4) targeting HuggingFace diffusers and transformers libraries. Supports models like LTX-Video, Stable Diffusion, LLaMA, Mistral, Qwen, and Qwen3. Includes integration with HuggingFace Kernels Hub (get_kernel) for loading pre-compiled kernels. Includes benchmarking scripts to compare kernel performance against baseline implementations.