<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Cuda/Triton on moyutianzun 的博客</title><link>https://moyutianzun.com/tags/cuda/triton/</link><description>Recent content in Cuda/Triton on moyutianzun 的博客</description><generator>Hugo</generator><language>zh-cn</language><copyright>moyutianzun</copyright><lastBuildDate>Sun, 07 Sep 2025 08:10:38 +0800</lastBuildDate><atom:link href="https://moyutianzun.com/tags/cuda/triton/index.xml" rel="self" type="application/rss+xml"/><item><title>triton is all you need 之 GEMM</title><link>https://moyutianzun.com/blog/triton-is-all-you-need/</link><pubDate>Sun, 07 Sep 2025 08:10:38 +0800</pubDate><guid>https://moyutianzun.com/blog/triton-is-all-you-need/</guid><description>&lt;blockquote&gt;&lt;p style=""&gt;代码参考了傅哥，请b站关注我是傅傅猪喵，谢谢喵！&lt;/p&gt;&lt;/blockquote&gt;&lt;p style="text-indent: 2em"&gt;Triton DSL是以BLOCK tile为中心的Python DSL。与CUDA相比，Triton的使用者无法控制所有细节，因为某些优化是自动完成的，但是在Triton编译器的逐层编译优化之下也可以获得与Cuda相近甚至超过的性能。另外，Triton的编写和调试更加简单，而且学习成本更低。&lt;/p&gt;</description></item><item><title>【CUDA从入门到入土】四、矩阵乘法</title><link>https://moyutianzun.com/blog/cudacong-ru-men-dao-ru-tu-si-ju-zhen-cheng-fa/</link><pubDate>Wed, 03 Sep 2025 14:50:37 +0800</pubDate><guid>https://moyutianzun.com/blog/cudacong-ru-men-dao-ru-tu-si-ju-zhen-cheng-fa/</guid><description>&lt;p style="text-indent: 2em"&gt;矩阵乘法跟之前不同，之前一维可以直接写一个kernel，或者多个kernel线性的排布来并行计算，那么矩阵乘法就是由一维向二维转变的关键。这时候一维的kernel排布也变成了二维排布。&lt;/p&gt;</description></item><item><title>【CUDA从入门到入土】三、reduce算子及其优化</title><link>https://moyutianzun.com/blog/cudacong-ru-men-dao-ru-tu-san-reducesuan-zi-ji-qi-you-hua/</link><pubDate>Sat, 23 Aug 2025 08:46:59 +0800</pubDate><guid>https://moyutianzun.com/blog/cudacong-ru-men-dao-ru-tu-san-reducesuan-zi-ji-qi-you-hua/</guid><description>&lt;p style="text-indent: 2em"&gt;该项目代码参考&lt;a href="https://space.bilibili.com/1822828582" target="_self" rel=""&gt;傅哥的课程&lt;/a&gt;，很有用的课程，请多多支持他。&lt;/p&gt;&lt;hr&gt;&lt;p style="text-indent: 2em"&gt;&lt;/p&gt;&lt;p style="text-indent: 2em"&gt;&lt;/p&gt;&lt;p style="text-indent: 2em"&gt;reduce 规约求和是cuda中一个经典的问题，其本质是将输入的序列进行求和。&lt;/p&gt;&lt;p style=""&gt;&lt;/p&gt;&lt;p style="text-indent: 2em"&gt;在CUDA的多线程中，我们清楚数据被分为一个一个的block中进行运行，每个block通过warp来并发32个线程进行运算。&lt;/p&gt;</description></item><item><title>【CUDA从入门到入土】二、CUDA调试和必知必会 &amp; Nsight Computer 入门</title><link>https://moyutianzun.com/blog/cudacong-ru-men-dao-ru-tu-er-cudabi-zhi-bi-hui/</link><pubDate>Sun, 17 Aug 2025 17:09:02 +0800</pubDate><guid>https://moyutianzun.com/blog/cudacong-ru-men-dao-ru-tu-er-cudabi-zhi-bi-hui/</guid><description>&lt;p style="text-indent: 2em"&gt;上文中，我们运行了一个简单的cuda函数，并且一次过的将其运行了起来，这次，我们需要补充一些基础的概念，通过概念和框架的建立，我们才能走的更远，高屋建瓴的认识更多。&lt;/p&gt;</description></item><item><title>【CUDA从入门到入土】五、cuda_kernel_和_cuda_attention详解</title><link>https://moyutianzun.com/blog/cudacong-ru-men-dao-ru-tu-er-cuda_kernel_he_cuda_attentionxiang-jie/</link><pubDate>Sun, 17 Aug 2025 15:14:21 +0800</pubDate><guid>https://moyutianzun.com/blog/cudacong-ru-men-dao-ru-tu-er-cuda_kernel_he_cuda_attentionxiang-jie/</guid><description>&lt;p style=""&gt;从cuda kernel出发，看懂人生第一个cuda attention&lt;/p&gt;</description></item><item><title>【CUDA从入门到入土】一、丝滑的CUDA入门</title><link>https://moyutianzun.com/blog/cudacong-ru-men-dao-ru-tu-yi-si-hua-de-cudaru-men/</link><pubDate>Thu, 14 Aug 2025 16:27:54 +0800</pubDate><guid>https://moyutianzun.com/blog/cudacong-ru-men-dao-ru-tu-yi-si-hua-de-cudaru-men/</guid><description>&lt;p style=""&gt;&lt;strong&gt;CUDA是什么&lt;/strong&gt;&lt;/p&gt;&lt;p style=""&gt;cuda是一种gpu编程组件，是一种原生支持GPU软硬件的架构，使得开发者可以直接在 GPU 上编写和执行通用计算程序。&lt;/p&gt;&lt;h2 style="" id="gpu%E6%9E%B6%E6%9E%84"&gt;&lt;strong&gt;GPU架构&lt;/strong&gt;&lt;/h2&gt;&lt;p style=""&gt;&lt;img src="https://moyublog-picture.oss-cn-guangzhou.aliyuncs.com/images/20250807194901764.png" alt="" width="100%" height="100%" style="display: inline-block"&gt;&lt;/p&gt;&lt;p style=""&gt;上图是H100白皮书中，H100 GPU带满了144个SM的架构图&lt;/p&gt;&lt;p style=""&gt;&lt;img src="https://moyublog-picture.oss-cn-guangzhou.aliyuncs.com/images/20250807195051758.png" alt="" width="991px" height="1379px" style="display: inline-block"&gt;&lt;/p&gt;&lt;p style=""&gt;上图是H100中，1个SM的架构图&lt;/p&gt;&lt;h3 style="" id="sm%E6%9E%B6%E6%9E%84%E8%AF%A6%E8%A7%A3"&gt;&lt;strong&gt;SM架构详解&lt;/strong&gt;&lt;/h3&gt;&lt;p style=""&gt;由此，我们可以高屋建瓴的看懂GPU，这里不雕琢细节，只直白的说明白GPU怎么工作的：&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p style=""&gt;PCIE 就是负责数据从显卡和主板之间进出的数据传输协议，理解为传递数据的就对了&lt;/p&gt;</description></item><item><title>WSL2搭建cuda-triton开发环境</title><link>https://moyutianzun.com/blog/wsl2%E6%90%AD%E5%BB%BAcuda-triton%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83/</link><pubDate>Thu, 14 Aug 2025 16:21:13 +0800</pubDate><guid>https://moyutianzun.com/blog/wsl2%E6%90%AD%E5%BB%BAcuda-triton%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83/</guid><description>&lt;p style=""&gt;先用了vmware + ubuntu的方法，结果发现现在gpu无法透传到vmware的虚拟机里&lt;/p&gt;&lt;p style=""&gt;&lt;/p&gt;&lt;p style=""&gt;故此使用wsl2的开发环境，后续会更新许多更舒服丝滑的操作&lt;/p&gt;&lt;p style=""&gt;&lt;/p&gt;&lt;h1 style="" id="wsl2"&gt;&lt;strong&gt;WSL2&lt;/strong&gt;&lt;/h1&gt;&lt;p style=""&gt;查看所有发行版本&lt;/p&gt;&lt;pre&gt;&lt;code&gt;wsl --list --online
&lt;/code&gt;&lt;/pre&gt;&lt;p style=""&gt;安装指定版本&lt;/p&gt;&lt;pre&gt;&lt;code&gt;wsl --install Ubuntu-22.04
&lt;/code&gt;&lt;/pre&gt;&lt;p style=""&gt;安装成功之后设置一下账户密码就行&lt;/p&gt;&lt;h2 style="" id="%E5%AE%89%E8%A3%85miniconda"&gt;&lt;strong&gt;安装miniconda&lt;/strong&gt;&lt;/h2&gt;&lt;p style=""&gt;用脚本安装&lt;/p&gt;&lt;pre&gt;&lt;code&gt;wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
&lt;p&gt;chmod +x Miniconda3-latest-Linux-x86_64.sh&lt;/p&gt;
&lt;p&gt;./Miniconda3-latest-Linux-x86_64.sh&lt;/p&gt;
&lt;p&gt;source ~/.bashrc&lt;/p&gt;
&lt;p&gt;conda list
&lt;/code&gt;&lt;/pre&gt;&lt;p style=""&gt;用脚本安装就一直yes就行&lt;/p&gt;&lt;h2 style="" id="%E5%AE%89%E8%A3%85cuda-toolkit-%E5%92%8C-cudnn"&gt;&lt;strong&gt;安装CUDA Toolkit 和 cudnn&lt;/strong&gt;&lt;/h2&gt;&lt;p style=""&gt;使用 nvidia-smi查看cuda版本，在下面链接选择相应的版本&lt;/p&gt;</description></item></channel></rss>