cuda-basics

cuda-basics is a skill for Claude Code, Codex from mindspore-ai/akg. It costs 22 tokens per session (2,357 once invoked), scanned A, original, Apache-2.0.

A beginner’s guide to CUDA, NVIDIA’s system for running parallel work on GPUs. It explains how GPU threads are grouped and how different kinds of memory are used.

In plain words
What is it for?
Use it to learn thread grids, blocks, and indexes, compare registers, shared memory, caches, and global memory, and apply common optimization techniques.
Why use it?
It helps you understand the basic CUDA concepts needed to write GPU code and avoid inefficient memory access.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to learn thread grids, blocks, and indexes, compare registers, shared memory, caches, and global memory, and apply common optimization techniques.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mindspore-ai/akg/cuda-basics
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add mindspore-ai/akg --skill cuda-basics
Clone the repo
git clone --depth 1 https://github.com/mindspore-ai/akg

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cuda-basics

README.md
[![agentmods](https://agentmods.dev/badge/skills/mindspore-ai/akg/cuda-basics.svg)](https://agentmods.dev/skills/mindspore-ai/akg/cuda-basics)
Your own site
<a href="https://agentmods.dev/skills/mindspore-ai/akg/cuda-basics"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/cuda-basics.svg" alt="Measured on agentmods" height="20"></a>
Per session 22 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,357 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00022 $0.02357
Opus 5 $0.00011 $0.01179
Sonnet 5 $0.00004 $0.00471
Haiku 4.5 $0.00002 $0.00236

Measured 8d ago against content hash c9e38d4a7fa5, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

cuda-basics scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

akg_agents/examples/run_skill/skills/cuda-basics/SKILL.md · 361 lines

How it starts

The opening of the file, as written. The whole thing — 361 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CUDA编程基础

概述

CUDA (Compute Unified Device Architecture) 是NVIDIA推出的并行计算平台和编程模型。

线程层次结构

三层结构

Grid (网格)
  └─ Block (块) 
      └─ Thread (线程)

维度表示

// 1D
dim3 block(256);
dim3 grid((N + 255) / 256);

// 2D
dim3 block(16, 16);
dim3 grid((M + 15) / 16, (N + 15) / 16);

// 3D
dim3 block(8, 8, 8);
dim3 grid((M + 7) / 8, (N + 7) / 8, (K + 7) / 8);

线程索引计算

// 1D索引
int idx = blockIdx.x * blockDim.x + threadIdx.x;

// 2D索引
int row = blockIdx.y * blockDim.y + threadIdx.y;
int col = blockIdx.x * blockDim.x + threadIdx.x;

// 全局1D索引(从2D)
int idx = row * width + col;

内存层次

内存类型对比

内存类型 位置 访问速度 大小 作用域 生命周期
Register 片上 最快 ~64KB/SM Thread Thread
Shared Memory 片上 48KB-164KB Block Block
L1 Cache 片上 128KB - -
L2 Cache 片上 MB级 - -
Global Memory DRAM GB级 Grid Application
Constant Memory DRAM 中(有cache) 64KB Grid Application
Texture Memory DRAM 中(有cache) - Grid Application

声明方式

// Register (自动)
int local_var;

// Shared Memory
__shared__ float shared_data[256];

// Global Memory
__global__ void kernel(float* global_data) { }

// Constant Memory
__constant__ float const_data[1024];

内存访问优化

1. 合并内存访问 (Coalesced Access)

// ✅ 好:连续访问
__global__ void coalesced_read(float* data) {
    int idx = blockIdx.x * blockDim.x + threadIdx.x;
    float val = data[idx];  // 线程连续访问
}

// ❌ 差:跨步访问
__global__ void strided_read(float* data, int stride) {
    int idx = (blockIdx.x * blockDim.x + threadIdx.x) * stride;
    float val = data[idx];  // 线程跨步访问
}

2. 使用Shared Memory

__global__ void use_shared_memory(float* input, float* output) {
    __shared__ float tile[TILE_SIZE];
    
    int tid = threadIdx.x;
    int gid = blockIdx.x * blockDim.x + threadIdx.x;
    
    // 从全局内存加载到共享内存
    tile[tid] = input[gid];
    __syncthreads();  // 同步
    
    // 从共享内存读取(快速)
    float val = tile[tid];
    
    // 处理...
    output[gid] = val;
}

Read the full file on GitHub · 361 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 361 lines · 22 tokens per session scan A c9e38d4a7fa5

Subscribe to this mod's changes

cuda-basics is a skill published in the GitHub repository mindspore-ai/akg (259 stars, last pushed 28d ago), licensed Apache-2.0. It adds 22 tokens to every session and 2,357 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

ruview-quickstart

Onboarding and first-run for RuView (WiFi-DensePose) — Docker demo with simulated data, repo build, and the fastest path to a live sensing dashboard. Use when someone is new to RuView or wants the shortest path to "it works on my machine".

ruvnet/RuView · 62 tokens

onboard

Zero-to-sensing path picker for RuView (WiFi-DensePose) — pick docker-demo, repo-build, or live-esp32 and run the next concrete step.

ruvnet/RuView · 39 tokens

doca-programming-guide

Use this skill when the user is writing their first DOCA app or asking a library-agnostic programming question — picking a shipped sample to copy and modify, wiring the canonical pkg-config doca-{library} + meson build (or FFI from Rust / Go / Python against the public C ABI), walking the cfg-create → init → start →…

NVIDIA/skills · 246 tokens

devin-akin-perspective

A vendor-neutral perspective for making enterprise Wi-Fi decisions, with emphasis on radio physics, training, technical standards, and checking vendor claims against real deployments.

swaylq/master-skill · 220 tokens

design-logic-circuit

Design combinational logic circuits from a functional specification through gate-level implementation. Covers AND, OR, NOT, XOR, NAND, NOR gates; NAND/NOR universality conversions; and standard building blocks including multiplexers, decoders, half/full adders, and ripple-carry adders. Use when translating a Boolean…

pjt222/agent-almanac · 87 tokens

pdf-press

Teaches agents how to generate Markdown, HTML (with embedded SVG), and Mermaid content that renders beautifully to multi-page PDF via writepdf, with proper page breaks, compact professional layouts, brand and domain-adaptive color schemes, multi-column support for scientific papers, magazine-style editorial documents…

kdcube/kdcube · 74 tokens