Study Note: Schedule Optimisation and math_intrinsic in CUDA Programming

本文介绍了如何通过调整线程块大小、寄存器使用及共享内存来提高GPU占用率的方法。此外,还讨论了在牺牲一定精度的情况下使用fast_math选项或CUDA内在数学函数来进一步优化代码性能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Let us introduce a new term first[1]. 




It is the ratio of active warps / maximum number(32) of warps. 


It depends on three parameters: 

1) threads/block (set in <<<>>>)

2) registers/thread (can see in the ptx file or use --ptxas-option=-v to see after finish compiling) 

3) shared memory/block(also can see the ptx file and use--ptxas-option=-v to see after finish compiling). However, if our shared memory variable is set extern (use 'extern' to define the shared memory). We get this variable from the runtime. 


We can use these charts to see how can we improve the occupancy.(By keeping other two variables the same, changing one variable.)[1]




Also, at the expense of accuracy, we can -use fast_math or replace some math function with CUDA math intrinsic function in the code. [1]




Reference: 

[1] 18645 CMU How to write fast code Jike Chong and Ian Lane





 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值