上一页 1 2 3 4 5 6 7 ··· 12 下一页
摘要: priority queue最大的特点是找出最大值只需要常数时间。 相比vector,push/pop则需要logn的时间;而vector是常数时间。 因此维护topk的问题最适合priority queue。 维护k大小的priority queue。超过时,取出top进行比较,然后根据情况是否p 阅读全文
posted @ 2022-06-28 21:31 xuyv 阅读(15) 评论(0) 推荐(0) 编辑
摘要: TENSOR CORE PERFORMANCE: THE ULTIMATE GUIDE 1. 一个有意思的点,batch size / 108 整除的性能(TFLOPS)更好,因为A100的tensor core sm数为108. 见参考 参考: https://developer.download 阅读全文
posted @ 2022-06-01 15:55 xuyv 阅读(85) 评论(0) 推荐(0) 编辑
摘要: A.scatter_(dim, index, B) # 基本用法, tensor A 被就地scatter到 tensor B 如果dim = 0,意思就是在保持行索引不变的情况下,针对每一行,把每个原色的列索引转换为index里面的数值。 可以用于生成one - hot embedding 参考: 阅读全文
posted @ 2022-05-20 11:04 xuyv 阅读(503) 评论(0) 推荐(0) 编辑
摘要: autocast op reference Op Eligibility Ops that run in float64 or non-floating-point dtypes are not eligible, and will run in these types whether or not 阅读全文
posted @ 2022-05-18 17:21 xuyv 阅读(76) 评论(0) 推荐(0) 编辑
摘要: CTA: Cooperative Thread Array 即 CUDA BLOCK https://github.com/NVIDIA/cuda-samples/blob/2e41896e1b2c7e2699b7b7f6689c107900c233bb/Samples/3_CUDA_Feature 阅读全文
posted @ 2022-05-18 16:18 xuyv 阅读(164) 评论(0) 推荐(0) 编辑
摘要: 有时候发布的python包,希望是命令行形式,并且可以省略掉python。 即原来: $ python do_something.py 现在 $ do_something 可以用python 的entry_points来发布。会自动打包python文件(也可以是.sh)到package,执行的时候自 阅读全文
posted @ 2022-04-26 16:56 xuyv 阅读(28) 评论(0) 推荐(0) 编辑
摘要: gcc和glibc的关系:https://www.cnblogs.com/jiqiubo/archive/2011/08/03/2126117.html 总的来说glibc就是一个最基础的库,但是它比较特别和核心,有些情况不能用库的方式来处理。 centos更新glibc有可能会有问题。 因此,如果 阅读全文
posted @ 2022-04-19 16:37 xuyv 阅读(92) 评论(0) 推荐(0) 编辑
摘要: 运行 sudo umount /dev/shm/ && sudo mount -t tmpfs -o rw,nosuid,nodev,noexec,relatime,size=1G shm /dev/shm 或者 umount /dev/shm/ && mount -t tmpfs -o rw,no 阅读全文
posted @ 2022-03-16 17:34 xuyv 阅读(210) 评论(0) 推荐(0) 编辑
摘要: 面向对象和软件工程中,visitor patter是一种用来分离对象和算法的方法。 (可以用来编写algorithm/compute/op和schedule分离的代码) 来源: https://en.wikipedia.org/wiki/Visitor_pattern#C++_example 阅读全文
posted @ 2022-01-11 22:59 xuyv 阅读(82) 评论(0) 推荐(0) 编辑
摘要: 有时候我们会需要克隆对象。 如果每个子对象都实现Clone方法,显得冗余。 可以用CRTP实现,省去每个继承对象实现Clone方法的步骤。 // Base class has a pure virtual function for cloning class AbstractShape { publ 阅读全文
posted @ 2022-01-11 17:06 xuyv 阅读(44) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 12 下一页