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.
npx skills add mindspore-ai/akg --skill cuda-c-basicsgit clone --depth 1 https://github.com/mindspore-ai/akgWrote 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.
[](https://agentmods.dev/skills/mindspore-ai/akg/cuda-c-basics)<a href="https://agentmods.dev/skills/mindspore-ai/akg/cuda-c-basics"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/cuda-c-basics/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/mindspore-ai/akg/cuda-c-basics"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/cuda-c-basics.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector pass
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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00021 | $0.01848 |
| Opus 5 | $0.00010 | $0.00924 |
| Sonnet 5 | $0.00004 | $0.00370 |
| Haiku 4.5 | $0.00002 | $0.00185 |
Grade A, and why
cuda-c-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 9d 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.
How it starts
The opening of the file, as written. The whole thing — 223 lines — stays where its author put it; the contents beside it link to each section on GitHub.
CUDA C 编程基础
1. 核心概念
内核 (Kernel)
- 定义: 使用
__global__修饰的 C/C++ 函数,在 GPU 上并行执行 - 特点: 每个内核实例处理数据的一个子集,通过线程索引区分
- 调用: 使用
<<<grid_size, block_size>>>语法从主机代码启动
网格 (Grid) 与块 (Block)
- 网格: 内核启动时的并行维度配置,如
(num_blocks_x, num_blocks_y) - 块: 每个线程块包含的线程数,如
block_size = 256 - 关系:
grid_size = ceil(total_elements / block_size) - 限制: 每块最多 1024 线程(大多数 GPU)
线程层次
- Grid: 所有线程块的集合
- Block: 一组可以协作的线程(共享内存、同步)
- Warp: 32 个线程为一组并行执行(SIMT 执行模型)
- Thread: 最基本的执行单元
内存层次
- 全局内存 (Global Memory): 所有线程可访问,延迟高,容量大
- 共享内存 (Shared Memory): 块内线程共享,延迟低,容量有限(通常 48-164 KB/SM)
- 寄存器 (Registers): 每个线程私有,最快访问
- 常量内存 (Constant Memory): 只读,缓存优化
- 纹理内存 (Texture Memory): 只读,空间局部性优化
2. 标准内核结构(五步模式)
所有 CUDA C 内核都遵循相同的五步结构模式:
__global__ void standard_kernel(
float* output, float* input, int n_elements
) {
// 1. 计算全局线程索引
int idx = blockIdx.x * blockDim.x + threadIdx.x;
// 2. 边界检查
if (idx < n_elements) {
// 3. 加载数据
float data = input[idx];
// 4. 执行计算
float result = compute_function(data);
// 5. 存储结果
output[idx] = result;
}
}
内核启动方式
void launch_kernel(float* input, float* output, int n_elements) {
const int block_size = 256;
const int num_blocks = (n_elements + block_size - 1) / block_size;
kernel<<<num_blocks, block_size>>>(output, input, n_elements);
}
3. 全局索引计算
一维数据处理
int global_index = blockIdx.x * blockDim.x + threadIdx.x;
二维数据处理
int row = blockIdx.y * blockDim.y + threadIdx.y;
int col = blockIdx.x * blockDim.x + threadIdx.x;
三维数据处理
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
int z = blockIdx.z * blockDim.z + threadIdx.z;
网格配置
// 一维网格
int block_size = 256;
int num_blocks = (n_elements + block_size - 1) / block_size;
kernel<<<num_blocks, block_size>>>(...);
// 二维网格(矩阵操作)
dim3 block_size(16, 16);
dim3 grid_size((N + 15) / 16, (M + 15) / 16);
kernel<<<grid_size, block_size>>>(...);
// 三维网格(体积数据)
dim3 block_size(8, 8, 8);
dim3 grid_size((X + 7) / 8, (Y + 7) / 8, (Z + 7) / 8);
kernel<<<grid_size, block_size>>>(...);
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.
- 9d ago First seen · 223 lines · 21 tokens per session scan A 8304718bf8fa
cuda-c-basics is a skill published in the GitHub repository mindspore-ai/akg (259 stars, last pushed 29d ago), licensed Apache-2.0. It adds 21 tokens to every session and 1,848 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.
Other skills, from other repositories
cuopt-numerical-optimization-api
LP, MILP, and QP (beta) with cuOpt — Python, C, and CLI. Use when the user is solving LP, MILP, or QP with any cuOpt interface.
cuopt-developer
Modify, build, test, debug, and contribute to NVIDIA cuOpt (C++/CUDA, Python, server, CI). Use for solver internals, PRs, DCO, and code conventions.
huawei-cloud-ascendc-operator-performance-optim
Develop and optimize custom operators using AscendC programming language. Analyze operator performance bottlenecks and conduct optimization validation. Based on AscendC and CANN toolkit Use this skill when the user wants to: (1) optimize performance-critical operators on Ascend NPU, (2) develop custom operators for…
torchtalk-analyzer
Analyze PyTorch internals across Python, C++, and CUDA layers using the TorchTalk MCP server. Use when asked about how PyTorch operators work internally, where functions are implemented, what would break if code is modified, or finding tests for PyTorch operators.
torchtalk-trace
Trace a PyTorch function's cross-language binding chain (Python -> C++ -> CUDA).
cuda-skill
Query current NVIDIA CUDA, PTX ISA, Runtime API, Driver API, Programming Guide, Best Practices, Nsight Compute, and Nsight Systems references. Use for direct CUDA C++ or PTX work, and for framework tasks only when they need NVIDIA ISA, API, architecture, or tool facts. Triggers include inline PTX, WMMA, WGMMA, TMA…