当前位置:   article > 正文

「日志」测试显卡 TFLOPS_测试tflops

测试tflops

对于深度学习而言,显卡的计算能力还是非常重要的,以下代码参考 沐神的分享,用于查看显卡的 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))
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/不正经/article/detail/245418
推荐阅读
相关标签
  

闽ICP备14008679号