mindspore-ai/akg/cuda-c-examples-torch
Claude Code and agent skill by mindspore-ai/akg
Trust tier 2
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
PyTorch + CUDA C 完整集成示例代码
Install
npx vskill@latest install mindspore-ai/akg/cuda-c-examples-torchSKILL.md
The same SKILL.md was published earlier as mindspore-ai/akg/cuda-c-examples-torch.
PyTorch + CUDA C 示例代码
本 Skill 包含完整的可运行示例代码,展示如何在 PyTorch 中使用 CUDA C 编写高性能 kernel,通过 load_inline JIT 编译集成。
集成模式
所有 CUDA C 内核都通过以下模式与 PyTorch 集成:
示例列表
1. 向量加法(Vector Add)
算子类型: Element-wise 关键点:
- 最简单的 CUDA C 内核示例
- 一维索引和边界检查
- 标准五步模式
2. ReLU 激活函数
算子类型: Element-wise 关键点:
- 使用
fmaxf内置函数 - 简洁的逐元素操作
3. 矩阵乘法(MatMul)
算子类型: MatMul 关键点:
- 2D 线程配置
dim3 - 共享内存优化(分块加载)
__syncthreads()同步
4. Softmax(数值稳定版)
算子类型: Reduce + Element-wise 关键点:
- 行级处理(每行一个 block)
- 数值稳定性(先减最大值)
- 共享内存归约
- Grid-stride loop 处理大行
5. LayerNorm(层归一化)
算子类型: Reduce + Element-wise 关键点:
- 多遍扫描(均值 → 方差 → 归一化)
- Warp-level 归约 + 共享内存
rsqrtf快速计算标准差倒数
6. 双内核调用(Fused ReLU + Square)
算子类型: 多 Kernel 组合 关键点:
- 在一个函数中调用多个 kernel
- 中间结果通过 tensor 传递
- 每个 kernel 独立配置网格
通用模式总结
CUDA 源代码结构
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingakg_agents/python/akg_agents/op/resources/skills/cuda-c/guides/cuda-c-examples-torch/SKILL.md
Popularity
- Repository stars
- 259
- Repository forks
- 48
- 7-day trend score
- 28
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/mindspore-ai/akg/cuda-c-examples-torch)