什么算作失败? [英] What counts as a flop?

查看:25
本文介绍了什么算作失败?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个伪 C 程序:

Say I have a C program that in pseudoish is:

For i=0 to 10
    x++
    a=2+x*5
next

对于 30 FLOPS,此操作的 FLOP 数是 (1 [x++] + 1 [x*5] + 1 [2+(x+5))] * 10[loop] 吗?我无法理解什么是翻牌.

Is the number of FLOPs for this (1 [x++] + 1 [x*5] + 1 [2+(x+5))] * 10[loop], for 30 FLOPS? I am having trouble understanding what a flop is.

注意 [...] 表示我从哪里获得操作"计数.

Note the [...] are indicating where I am getting my counts for "operations" from.

推荐答案

为了 FLOPS 测量的目的,通常只包括加法和乘法.诸如除法、倒数、平方根和超越函数之类的事情太昂贵而无法作为单个操作包含在内,而诸如加载和存储之类的事情又太琐碎了.

For the purposes of FLOPS measurements, usually only additions and multiplications are included. Things like divisions, reciprocals, square roots, and transcendental functions are too expensive to include as a single operation, while things like loads and stores are too trivial.

换句话说,你的循环体包含 2 个加法和 1 个乘法,所以(假设 x 是浮点数)每个循环迭代是 3 个操作;如果你运行循环 10 次,你就完成了 30 次操作.

In other words, your loop body contains 2 adds and 1 multiply, so (assuming x is floating point) each loop iteration is 3 ops; if you run the loop 10 times you've done 30 ops.

请注意,在测量 MIPS 时,您的循环将超过 3 条指令,因为它还包括 FLOPS 测量不计算在内的加载和存储.

Note that when measuring MIPS, your loop would be more than 3 instructions because it also includes loads and stores that the FLOPS measurement doesn't count.

这篇关于什么算作失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆