赞
踩
对于深度学习而言,显卡的计算能力还是非常重要的,以下代码参考 沐神的分享,用于查看显卡的 TFLOPS性能,经作者测试,结果仅供参考,最开始测的是 30+,过了一会再测就成22+了,玄学,这绝对是玄学!
import torch from torch.utils import benchmark typ = torch.float16 n = 1024 * 16 a = torch.randn(n,n).type(typ).cuda() b = torch.randn(n,n).type(typ).cuda() t = benchmark.Timer(stmt='a @ b', globals={'a':a, 'b':b}) x = t.timeit(50) tflops = 2*n**3 / x.median / 1e12 print("TFlops : {:.02f}".format(tflops))
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。