Software Archive
Read-only legacy content
公告
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17060 讨论

how to measure energy consumption on the coprocessor?

King_Crimson
初学者
2,028 次查看

Question: how to determine the amount of energy consumed in Joules for my MPI-OpenMP program running on the coprocessor?

Details: I need to perform power analysis using vtune amplifier, but have just found that what the utility actually allows is "sleep states" and "frequency" profiling. How is the result related to the power dissipation? (P=C*V^2*f? How may the values of C and V be obtained?)

Thanks for your help!

0 项奖励
1 解答
Klaus-Dieter_O_Intel
2,028 次查看

You will find information about power measurements using the MicMgmtAPI (aka MicAccessAPI) of MPSS 3.1 in /usr/share/doc/micmgmt (see examples and libmicmgmt.7.html), for MPSS 2.1 in /opt/intel/mic/mgmt/sdk.

The readme.txt and examples.c sources from the examples sub-directory show how to do power measurements, see the call to do_power_examples(). However, I had to comment other calls to do_pci_config_examples() and do_turbo_util_examples() which did not succeed on my system.

在原帖中查看解决方案

0 项奖励
12 回复数
Frances_R_Intel
2,028 次查看

Good question. You could use the output from micsmc to determine the watts used by the coprocessor at various points while your program is running and estimate from that but I'm suspect you already know that. I will ask around and see if anyone knows how to measure this for real.

0 项奖励
King_Crimson
初学者
2,028 次查看

Frances Roth (Intel) wrote:

Good question. You could use the output from micsmc to determine the watts used by the coprocessor at various points while your program is running and estimate from that but I'm suspect you already know that. I will ask around and see if anyone knows how to measure this for real.

Dear Frances,

Many thanks to your reply. Using micsmc is an effective workaround. From the admin manual and the command-line help information, however, it is unclear to me how to synchronize the utility with my program (ideally, with specific functions executed in parallel). What I've done so far is something like:

running my program &

while ps | grep $!

do
    micsmc --freq >> ${RESULT_FILE}
    sleep ${SAMPLING_INTERVAL}s
done

I'm wondering if there is any canonical way you would recommend of using micsmc.

0 项奖励
McCalpinJohn
名誉分销商 III
2,028 次查看

An alternative to running micsmc on the host is to run a process on the coprocessor that periodically reads the contents of the special file "/sys/class/micras/power".    I launch the following script in the background immediately before launching my job, then after the job is over I send a kill signal to the script.

[bash] #!/bin/sh
# set -vx
# dumps MIC power and temperature data every 5 seconds until killed

tbase=`date +%s`
t=0
while true
do
    echo "ELAPSED TIME = $t seconds"
    cat /sys/class/micras/power
    cat /sys/class/micras/temp
    sleep 5
    tnow=`date +%s`
    t=`expr $tnow - $tbase`
done
[/bash]

0 项奖励
Frances_R_Intel
2,028 次查看

I haven't come up with a good solution. You might collect both power and core utilization from micsmc at the same time. At least then you could see when your program is parallel. I have also been wondering if there isn't some way to use the ganglia monitor daemon to collect what you want but I have never used ganglia and don't know exactly what it is capable of. It would save you the communication back to the host each time you check the power (which Dr. McCalpin's solution does as well.) Perhaps someone else will come up with a better solution, but I'm afraid that is all I have for you.

0 项奖励
jiri
新分销商 I
2,028 次查看

To make it even trickier, it seems to me that if the card enters a low-power state, running micsmc wakes it up.

0 项奖励
King_Crimson
初学者
2,028 次查看

John D. McCalpin wrote:

An alternative to running micsmc on the host is to run a process on the coprocessor that periodically reads the contents of the special file "/sys/class/micras/power".    I launch the following script in the background immediately before launching my job, then after the job is over I send a kill signal to the script.

 

 #!/bin/sh
# set -vx
# dumps MIC power and temperature data every 5 seconds until killed
tbase=`date +%s`
t=0
while true
do
    echo "ELAPSED TIME = $t seconds"
    cat /sys/class/micras/power
    cat /sys/class/micras/temp
    sleep 5
    tnow=`date +%s`
    t=`expr $tnow - $tbase`
done

 

/sys/class/micras/power returns:

92000000
93000000
94000000
155000000
41000000
0
53000000
22000000 0 1002000
31000000 0 1000000
33000000 0 1501000

Is there any official Intel documentation that tells how to interpret these data? I haven't found the related information on the developer's guide, which as a side note, mentions another way "MicAccessAPI".

 

 

 

0 项奖励
Alireza_Majidi
初学者
2,028 次查看

Hi,

I think it will be helpful if you look at PAPI source code for measuring power on MIC:

http://icl.cs.utk.edu/papi/docs/d7/d04/linux-micpower_8c.html

There you can find meaning of power file

 

 
0 项奖励
TaylorIoTKidd
新分销商 I
2,028 次查看

Alireza,

Thank you for your PAPI pointer. You took the wind out of my sails.   :-)

In my next blog series, I will look at measuring power on the coprocessor, including reading and interpreting /sys/class/micras/power.

That series will start after I finish up my turbo and configuration series (in about a month or two).

Regards
---
Taylor
 

0 项奖励
Klaus-Dieter_O_Intel
2,029 次查看

You will find information about power measurements using the MicMgmtAPI (aka MicAccessAPI) of MPSS 3.1 in /usr/share/doc/micmgmt (see examples and libmicmgmt.7.html), for MPSS 2.1 in /opt/intel/mic/mgmt/sdk.

The readme.txt and examples.c sources from the examples sub-directory show how to do power measurements, see the call to do_power_examples(). However, I had to comment other calls to do_pci_config_examples() and do_turbo_util_examples() which did not succeed on my system.

0 项奖励
Qingpeng_N_
初学者
2,028 次查看

http://software.intel.com/en-us/forums/topic/507670

Here is the measurement results with the method provided in this post with /sys/class/micras/power. The GFLOPS/Watt result does not match the result reported on intel documents for DGEMM call. 

Intel MIC 5110P : 59.00 Joules  in 459.843 milliseconds with 156.57 GFLOPS. So the GFLOPS/Watt=156.57/(59.00/(459.843/1000))=1.2202GFLOPS/Watt

Intel(R) Xeon(R) CPU E5-2650 v2 @ 2.60GHz:  60.89 Joules in 798.345 milliseconds with 271.831 GFLOPS. So the GFLOPS/Watt = 271.831/(60.89/(798.345/1000))=3.564 GFLOPS/Watt. Intel(R) Xeon(R) CPU power is measured by PAPI RAPL PACKAGE_ENERGY:PACKAGE0 event.

http://www.intel.com/content/dam/www/public/us/en/documents/performance-... The performance per watt reported on above document on DGEMM call is for MIC is above 4 while for CPU is less than 1.5 GFLOPS/Watt. 

0 项奖励
Mark_L_1
初学者
2,028 次查看

I found useful "documentation" on the /sys/class/micras file structure here:

  https://github.com/pathscale/intel_xeon_phi_kernel_driver/blob/master/ras/micras_main.c

I'm still looking for a C API for scraping this information from the MIC side. The MicMgmt library is only for host side.

 

0 项奖励
King_Crimson
初学者
2,028 次查看

old post got dug out again ...

Mark,

That source code is a very interesting finding. As to implementation in C, I just used popen() to create a pipe, invoked the ``cat pseudo-file'' command, and extracted the power information from the resulting stream. I guess that's what you're looking for.

0 项奖励
回复