计数翻牌为code! [英] Counting Flops for a code!

查看:161
本文介绍了计数翻牌为code!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是真正考虑我的时间。我找不到估计FLOPS为以下code(循环),多少FLOPS是循环的单次迭代一个简单的方法:

This is really taking my time. I could not find a simple way to estimate FLOPS for a following code (the loop), How much FLOPS are for a single iteration of the loop:

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;
    }
    ...
}

这看起来简单,但我糊涂了与前面给出一些其他的数字,所以这将是巨大的,如果有人能给出一个确切的数字。

It looks simple but I got confused with some other numbers given earlier, so it would be great if someone can give an exact number.

感谢。

推荐答案

我看到(在日益复杂的顺序):

I see (in order of increasing complexity):


  • 8加法(INC。减法)

  • 3次乘法

  • 1倒数平方根

如何将这些相互关联的CPU家族强烈依赖。

How these relate to each other depends strongly on the CPU family.

这篇关于计数翻牌为code!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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