简体   繁体   English

如何测量C#应用程序使用的FLOPS?

[英]How do I measure the FLOPS my C# app uses?

Microsoft's Parallel Programming whitepaper describes situations that are optimal under various FLOPS thresholds, and that the FLOPS rate is a decision point as to when a certain implementation should be used. Microsoft的《并行编程》白皮书描述了在各种FLOPS阈值下最佳的情况,并且FLOPS速率是何时应使用某种实现的决定点。

How do I measure FLOPS in my application? 如何在应用程序中测量FLOPS?

FLOPS means FLoating-point Operations Per Second and measuring them is as simple as counting the number of floating-point operations performed and dividing by the time it takes to perform them. FLOPS表示每秒进行浮点运算并对其进行测量,就像对执行的浮点运算的数量进行计数并除以执行它们所花费的时间一样简单。 Measuring the time is the easy part. 测量时间很容易。 Couting the operations is tricky and is usually depends on the hardware platform and the compiler used. 对操作进行计算很棘手,通常取决于硬件平台和所使用的编译器。 Usually simple operations like addition, subtraction and multiplication are very fast. 通常,简单的运算(例如加法,减法和乘法)非常快。 Division is a bit slower. 除法有点慢。 Taking square root is even slower. 求平方根甚至更慢。 On the slowest part of the spectrum are transcendental functions like sine, cosine, exponentiation and taking logarithm. 频谱中最慢的部分是先验函数,例如正弦,余弦,求幂和取对数。 These are all expanded in series and computed iteratively until convergence is achieved. 这些都将依次扩展并迭代计算,直到实现收敛。 Most current generation CPUs support fused multiplication and addition (FMA) operations, that is A*B+C is performed in a single cycle. 当前大多数CPU支持融合乘法和加法(FMA)操作,即A * B + C在单个周期中执行。

Given all that it is very hard to give an absolute FLOPS value. 考虑到所有这些,给出绝对FLOPS值非常困难。 If your code performs only simple operations then you will get high FLOPS count. 如果您的代码仅执行简单的操作,那么您将获得较高的FLOPS计数。 If it does lots of transcendentals, then FLOPS count will be much lower (up to 100 times lower). 如果它做大量的先验,那么FLOPS计数将低得多(最多低100倍)。 It also depends on the fetch/compute ratio that is how often you access the main memory and how good the compiler is at generating code that can benefit from latency hiding. 它还取决于获取/计算比率,该比率是您访问主内存的频率以及编译器在生成可从延迟隐藏中受益的代码的能力。

The standard FLOPS benchmark is the LINPACK test which solves a dense system of linear equations. 标准的FLOPS基准是LINPACK测试,它可以解决线性方程组的稠密系统。 It only uses simple arithmetic operations (no transcendentals) and although this is no way enough to say how performant the CPU will be with more complex operations, it is still used to rank the supercomputers in Top500 . 它仅使用简单的算术运算(没有先验的运算法则),尽管这还不足以说明CPU在执行更复杂的运算时的性能如何,但仍用于将超级计算机排在Top500中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何测量C#中每一行的执行时间 - How do I measure execution time for each row in C# 如何在c#中测量子进程启动时间? - How do I measure child process launch time in c#? 如何判断我的程序所运行的计算机是否使用超线程? (C#) - How do I tell if the machine my program is running on uses hyperthreading? (C#) 如何编译使用外部依赖项而不将它们包含在库中的 C# 库? - How do I compile my C# library that uses external dependencies without them included in the library? 如何为我的C#应用​​程序创建自定义窗口小部件 - How do I create custom Widget for my c# app 如何添加此Web服务以在我的C#应用​​程序中工作? - How do I add this webservice to work in my C# app? 我该如何在C#中使用对象名称的方法? - How do I make a method that uses the object name in c#? 我如何测量通过C#套接字发送了多少数据 - How do i measure how much data has been sent over a C# socket 如何使用运行我的 Windows App Store 应用程序的 C# 获取当前目录? - How do I get the current directory using C# that my Windows App Store app is running in? 如何设置C#应用程序以将程序文件用于应用程序,并将应用程序数据用于数据库? - how do I set up my C# application to use program files for the app and app data for the DB?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM