【问题标题】:TensorFlow: Determine tensorRT power consumption with PythonTensorFlow:使用 Python 确定 tensorRT 功耗
【发布时间】:2018-07-19 15:20:27
【问题描述】:

我正在尝试计算用 Python 编写的 tensorRT 脚本的功耗。使用 CUDA 有 nvprof cuda_script,但在我的 Python 脚本中找不到类似的东西。

Python 有类似的东西吗?人们如何计算p100/v100的功耗?

类似这样的 Nvidia GPU - How to profile CPU usage of a Python script?

【问题讨论】:

    标签: python tensorflow gpu tensorrt


    【解决方案1】:

    事实证明,以线程方式在一个 python 文件中运行此过程非常复杂。解决方案是将它们与 bash 同时运行,然后让电源脚本检查其他进程是否正在运行。示例代码如下:

    def measurePower():
    
        tmp = os.popen("ps -Af").read()
        process_name = "PROCESSTOBEMEASURED.PY"
        power_measurement = []
    
        '''One checks if the other process is still running, if yes it measures power again.'''
        while(process_name in tmp[:]):
            measurementPower = os.popen("nvidia-smi -i 0 -q").read()
            tmp = os.popen("ps -Af").read()
            power_measurement.append(nvidiaSmiParser(measurementPower, ["Power Draw"],num))
    
        return power_measurement
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-05-11
      • 2017-04-29
      • 1970-01-01
      • 2020-10-17
      • 1970-01-01
      • 1970-01-01
      • 2014-07-10
      相关资源
      最近更新 更多