這真的很花時間。我找不到估計FLOPS爲下面的代碼(環路),多少FLOPS是循環的單次迭代的簡單方法:計算代碼的觸發器!
float func(float * atominfo, float energygridItem, int xindex, int yindex)
{
...
for (atomid=0; atomid<numatoms*4; atomid+=4)
{
float dy = coory - atominfo[atomid+2];
float dysqpdzsq = (dy * dy) + atominfo[atomid+3];
float dx1 = coorx1 - atominfo[atomid+1];
float s, y, t;
s = atominfo[atomid] * (1.0f/sqrtf(dx1*dx1 + dysqpdzsq));
y = s - energycomp1;
t = energyvalx1 + y;
energycomp1 = (t - energyvalx1) - y;
energyvalx1 = t;
}
...
}
它看起來簡單,但我得到了與給定的一組數字混淆早些時候,如果有人能給出確切的數字,那將會很棒。
謝謝。
這是功課嗎?如果是這樣,請使用「家庭作業」標籤。 – 2011-03-16 19:32:42
你在尋找「FLOPS」還是複雜性(Big-O stuff)?觸發器將根據硬件而改變(每秒浮點運算)「每秒」部分意味着它取決於正在執行的機器的能力。 – Brandon 2011-03-16 19:34:46
FLOPS代表FLoating point OPerations per Second。它是性能的度量,它不能作爲計算量的度量。你的意思是FLOP或FLOP的數量(小s) – Andrey 2011-03-16 19:35:03