[power]二. Dynamic voltage and frequency scaling(DVFS)简单概述

Many systems operate under conditions where their workload is variable. Therefore it is useful to have the ability to reduce or increase the core performance to match the expected core workload. Clocking the core more slowly reduces dynamic power consumption.

Dynamic Voltage and Frequency Scaling (DVFS) is an energy saving technique that exploits:
• The linear relationship between power consumption and operational frequency.
• The quadratic relationship between power consumption and operational voltage.

This relationship is given as:

P = C * V^2 * f

Where:
P is the dynamic power.
C is the switching capacitance of the logic circuit in question.
V is the operational voltage.
f is the operational frequency.

Power savings are achieved by adjusting the frequency of a core clock.

At lower frequencies the core can also operate at lower voltages. The advantage of reducing supply voltage is that it reduces both dynamic and static power.

There is an IMPLEMENTATION SPECIFIC relationship between the operational voltage for a given circuit and the range of frequencies that circuit can safely operate at. A given frequency of operation together with its corresponding operational voltage is expressed as a tuple and is known as an Operating Performance Point (OPP). For a given system, the range of attainable OPPs are collectively termed as the system DVFS curve.

Operating systems use DVFS to save energy and, where necessary, keep within thermal limits. The OS provides DVFS policies to manage the power consumed and the required performance. A policy aimed at high-performance selects higher frequencies and uses more energy. A policy aimed at saving energy selects lower frequencies and therefore results in lower performance.

翻译成中文大概的意思如下:
DVFS是一种节省CPU功耗的技术,怎么来节省功耗呢?

  1. 根据system workload来动态调节CPU频率,直到调节CPU的供电电压,电压越低,功耗越小
  2. CPU的电源消耗大小与CPU所在的频率大小成正比(实际中并不是线性比例,按照当前A75/A76,在高频段,电源消耗明显比低频段消耗的更多.就像一条直线的斜率变的更陡了.).
  3. CPU电源消耗与CPU供电电压成平方关系.
  4. 对于CPU频率的动态调整,现在的kernel中存在大量的策略,比如ondemand/power save/performance/userspace/schedutil等等.
  5. 所以如果系统一旦发现过热现象,就可能会触发thermal动作,限制CPU频率,或者热插拔CPU(或者简单的隔离CPU,热插拔CPU的轻量级操作)来达到降低温度的作用.反之就是降低系统性能了.
  6. 如果你想知道cpu相关信息和相关sys节点怎么创建的可以参考这个:
    sys接口:/sys/devices/system/cpu/目录下所有节点怎么创建的

其实最终节省功耗的方式就是调整core的时钟频率(电压). 这样会同时减少动态功耗和静态功耗.

其实我第一份工作的时候,还一起与CV同事验证过频率点和电压点的组合是否合理,一般的要求如下:

  1. 我们在DVFS中,一般一个频率点对应一个电压点,但是DVFS 驱动完成之前,频率点和电压点对应的table需要多次反复验证其稳定性.不能因为频率与电压不匹配导致系统不稳定.如果不在前提找出合理匹配点,一旦出现问题,会很麻烦去定位root cause
  2. 芯片蚀刻的时候,会有不同体质的芯片.也就会导致类似市面上的旗舰机型的阉割版芯片.需要对这部分芯片重新适配验证.

当然DVFS不仅仅使用在CPU场合,其实很多可以频率条件的硬件都是通用的概念.比如GPU/外设(devfreq)/DRAM等等.

很多时候,如何让CPU处于一个合理的频点,即可以save power,也可以keep performance,其实还是比较难的. 所以很多时候碰到的情况是,某些人为的去限制CPU频率(比如通过上层接口),虽然会节省你锁观察到的场景功耗降低,但是可能影响其他场景的性能.因此现在对于手机端都提倡分场景(智能些的:场景检测,场景匹配,AI技术模型训练,匹配更准确)定制化,是性能优先些还是功耗优先些.

以上供自己备份.

参考文献: ARMV8手册.

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
`tf.contrib.layers.variance_scaling_initializer()` 是 TensorFlow 中的一个初始化器函数,用于初始化神经网络中的权重。该函数采用了一种比较先进的初始化方法,即"Variance Scaling Initialization",可以有效地缓解梯度消失和梯度爆炸的问题,提高神经网络的训练效果。 该函数的语法如下: ``` tf.contrib.layers.variance_scaling_initializer(factor=2.0, mode='FAN_IN', uniform=False, seed=None, dtype=tf.float32) ``` 参数说明: - `factor`:用于缩放输出的标准偏差的因子。默认值为 2.0。 - `mode`:确定使用的缩放方式。可以是 "FAN_IN"(输入节点数量),"FAN_OUT"(输出节点数量)或 "FAN_AVG"(输入和输出节点数量的平均值)。默认值为 "FAN_IN"。 - `uniform`:如果为 True,则从均匀分布中采样,否则从正态分布中采样。默认值为 False。 - `seed`:随机数生成器的种子。默认为 None。 - `dtype`:所需的初始化数据类型。默认为 tf.float32。 使用示例: ```python import tensorflow as tf # 定义一个全连接层,使用 variance scaling 初始化权重 fc1 = tf.layers.dense(inputs=x, units=256, activation=tf.nn.relu, kernel_initializer=tf.contrib.layers.variance_scaling_initializer()) # 定义一个卷积层,使用 variance scaling 初始化卷积核 conv1 = tf.layers.conv2d(inputs=x, filters=32, kernel_size=[3, 3], padding="same", activation=tf.nn.relu, kernel_initializer=tf.contrib.layers.variance_scaling_initializer()) ```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值