如何计算flops

这里FLOPs (FLoating-point Operations Per Second)是衡量浮点性能的常用单位,即每秒做的浮点运算次数。它常被用来估算电脑的执行效能,尤其是在使用到大量浮点运算的科学计算领域中。

  • cpu个数计算

CPUs = (Threads per core) x (cores per socket) (sockets​​​​​​​)

即cpu数目与节点数、核数和单核的线程数有关。详见关于节点数和核数的定义。linux系统中这三个指标可通过如下命令查询。

lscpu | grep -E '^Thread|^Core|^Socket|^CPU\('

CPU(s):                40
Thread(s) per core:    2
Core(s) per socket:    10
Socket(s):             2
  • flops计算

performance in GFlops = (CPU speed in GHz) x (CPU instruction per cycle) x (number of CPU cores) x  (number of CPUs per node)

  • multithread vs hyperthread

多线程是在一个cpu核上运行的软件处理技术,需要cpu完成线程之间的调度工作。超线程是在一个cpu核上虚拟出多个cpu核的硬件处理技术,每个虚拟核都是独立的运行单元(processor),查看processor的命令为 ‘cat /proc/cpuinfo’。

如何计算flops_第1张图片 图片来自 这里

 

参考文献:

  1. http://www.novatte.com/our-blog/197-how-to-calculate-peak-theoretical-performance-of-a-cpu-based-hpc-system
  2. basic definition: node, socket, core
  3. CPU Basics: Multiple CPUs, Cores, and Hyper-Threading Explained
  4. How to know number of cores of a system in Linux?
  5. How to calculate peak theoretical performance of a CPU-based HPC system?

  6. 计算能力​​​​​​​
  7. What Are Threads in a Processor?

  8. What is hyper-threading? How does it different from multithreading?

你可能感兴趣的:(开发周边)