1

I am trying to calculate the power consumption of a tensorRT script written in Python. With CUDA there is nvprof cuda_script, but couldn't find something like that for my Python script.

Is there something similar for Python? How are people calculating the power consumption of p100/v100?

Something like this for Nvidia GPUs - How to profile CPU usage of a Python script?

Nyla Worker
  • 123
  • 1
  • 11

1 Answers1

0

Turns out that running this process within one python file in a threaded way is very complicated. The solution is to run them in concurrently with bash and then make the power script check if the other process is running. Sample code bellow:

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
Nyla Worker
  • 123
  • 1
  • 11