cuda-c-patterns

Provide CUDA-C pattern templates for vector operations, reductions, and matrix multiplication in GPU kernels.

6|1|Updated Apr 19, 2026
One-click install
npx skills add https://github.com/xchang1121/AutoResearch-CC-hook --skill cuda-c-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cuda-c-patterns
Source: https://github.com/xchang1121/AutoResearch-CC-hook/tree/main/skills/cuda-c/guides/cuda-c-patterns
Command: npx skills add https://github.com/xchang1121/AutoResearch-CC-hook --skill cuda-c-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

CUDA-C patterns provide structured templates for common GPU programming tasks, enabling faster, correct, and performant kernel implementations.

Core Features & Use Cases

  • Vector operation pattern: simple, vectorized element-wise kernels with proper indexing and boundary handling.
  • Reduction pattern: scalable reduction strategies using shared memory and synchronization.
  • Matrix multiplication pattern: tiled, memory-efficient matmul with optional shared memory usage.

Quick Start

Use CUDA-C pattern templates to implement a vector op kernel and validate it on a small test array.

Frequently Asked Questions about cuda-c-patterns

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

FAQPage Schema
How do I implement a CUDA reduction kernel using shared memory?

A CUDA reduction kernel uses shared memory and synchronization to perform scalable reductions. The reduction pattern template provides structured code for correct synchronization and memory handling.

What is the best way to write a CUDA kernel for element-wise vector operations?

The best way to write a CUDA vector operation kernel is using a vectorized pattern with proper indexing and boundary handling. This ensures correct element-wise computation and prevents out-of-bounds memory access.

How does tiled matrix multiplication work in CUDA-C?

Tiled matrix multiplication in CUDA-C loads sub-matrix blocks into shared memory to reduce global memory accesses. The matmul pattern template provides this memory-efficient implementation structure.

Do I need to handle boundary conditions in GPU kernels for vector operations?

Yes, you need to handle boundary conditions in GPU kernels for vector operations to prevent out-of-bounds memory access. The vector operation pattern template includes proper indexing and boundary handling logic.

What CUDA-C patterns are available for common HPC tasks?

Available CUDA-C patterns for common HPC tasks include vector operations, reductions, and matrix multiplication. These templates cover code structure, correctness, and performance considerations with practical examples.

Why does my CUDA reduction kernel produce incorrect results without synchronization?

A CUDA reduction kernel produces incorrect results without synchronization due to race conditions among threads accessing shared data. The reduction pattern template applies scalable synchronization strategies to ensure correct output.