cuda-c-api

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

A reference manual for CUDA C, the C and C++ interface used to write programs for NVIDIA GPUs. It covers function markers, memory declarations, and kernel launch syntax.

In plain words
What is it for?
Use it to look up host, device, and kernel functions, shared, constant, and dynamic memory, and the syntax for starting GPU kernels.
Why use it?
It gives you the exact forms and rules needed when writing or checking CUDA C code.

Skill for Claude CodeCodex

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

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.

agentmods
npx agentmods add skills/mindspore-ai/akg/cuda-c-api
Any agent
npx skills add mindspore-ai/akg --skill cuda-c-api
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-c-api

README.md
[![agentmods](https://agentmods.dev/badge/skills/mindspore-ai/akg/cuda-c-api.svg)](https://agentmods.dev/skills/mindspore-ai/akg/cuda-c-api)
Your own site
<a href="https://agentmods.dev/skills/mindspore-ai/akg/cuda-c-api"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/cuda-c-api.svg" alt="Measured on agentmods" height="20"></a>
Per session 13 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,711 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00013 $0.02711
Opus 5 $0.00006 $0.01355
Sonnet 5 $0.00003 $0.00542
Haiku 4.5 $0.00001 $0.00271

Measured 6d ago against content hash 1b2501767b29, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

cuda-c-api 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 6d 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/python/akg_agents/op/resources/skills/cuda-c/guides/cuda-c-api/SKILL.md · 311 lines

How it starts

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

CUDA C API 参考手册

本文档提供 CUDA C 核心编程接口的详细参考,包括函数签名、参数说明和使用示例。

1. 函数修饰符

global

__global__ void kernel_function(参数列表);
  • 功能: 标记为可在 GPU 上执行的内核函数
  • 调用: 只能从主机代码调用,使用 <<<>>> 语法启动
  • 返回值: 必须为 void

device

__device__ float device_function(参数列表);
  • 功能: 标记为在 GPU 上执行的设备函数
  • 调用: 只能从其他 __device____global__ 函数调用
  • 用途: 内核内部的辅助函数

host

__host__ void host_function(参数列表);
  • 功能: 标记为在 CPU 上执行的函数(默认)
  • 调用: 只能从主机代码调用

host device

__host__ __device__ float utility_function(float x);
  • 功能: 同时在 CPU 和 GPU 上可用
  • 用途: 通用工具函数

2. 内存类型修饰符

shared

__shared__ float shared_memory[256];
  • 功能: 声明线程块内共享的内存
  • 生命周期: 与线程块相同
  • 访问: 块内所有线程可读写
  • 容量: 通常 48-164 KB/SM

constant

__constant__ float constant_data[64];
  • 功能: 声明只读的常量内存
  • 特点: 缓存优化,适合广播读取
  • 设置: 通过 cudaMemcpyToSymbol 从主机端设置

extern shared

extern __shared__ float dynamic_shared[];
  • 功能: 动态分配的共享内存
  • 大小: 在内核启动时通过第三个参数指定
  • 启动: kernel<<<grid, block, shared_mem_bytes>>>(args)

3. 内核启动语法

基本语法

kernel_name<<<grid_size, block_size>>>(参数列表);
kernel_name<<<grid_size, block_size, shared_mem_bytes>>>(参数列表);
kernel_name<<<grid_size, block_size, shared_mem_bytes, stream>>>(参数列表);
  • grid_size: 网格大小(intdim3
  • block_size: 线程块大小(intdim3
  • shared_mem_bytes: 动态共享内存大小(可选,默认 0)
  • stream: CUDA 流(可选,默认 0)

dim3 类型

dim3 grid_size(blocks_x, blocks_y, blocks_z);
dim3 block_size(threads_x, threads_y, threads_z);
  • 用途: 多维网格和线程块配置
  • 默认: 未指定的维度默认为 1

4. 线程和块索引系统

块索引变量

int bx = blockIdx.x;   // X 方向块索引
int by = blockIdx.y;   // Y 方向块索引
int bz = blockIdx.z;   // Z 方向块索引
  • 类型: uint3
  • 用途: 确定当前线程块在网格中的位置

线程索引变量

int tx = threadIdx.x;  // X 方向线程索引
int ty = threadIdx.y;  // Y 方向线程索引
int tz = threadIdx.z;  // Z 方向线程索引
  • 类型: uint3
  • 用途: 确定当前线程在线程块中的位置

Read the full file on GitHub · 311 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. 6d ago First seen · 311 lines · 13 tokens per session scan A 1b2501767b29

Subscribe to this mod's changes

cuda-c-api is a skill published in the GitHub repository mindspore-ai/akg (259 stars, last pushed 26d ago), licensed Apache-2.0. It adds 13 tokens to every session and 2,711 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.