Measure power usage of K20c by PAPI nvml component

Measure power usage of K20c by PAPI nvml component

Postby egg183729 » Mon Nov 25, 2013 3:57 am

Hello,

Did PAPI nvml component support K20c for getting power usage?
Because I nvml API "nvmlDeviceGetPowerUsage" is available on K20c, but when I use "papi_native_avail" to show available events, Power usage event does not contain in the list, only contain 5 event showing below
Image

Does there any feature or configuration should I set?

Here is the system environment
OS: Ubuntu 12.04.2 LTS (64bit Server)
Kernel: 3.8.0-33-generic
CPU: Intel(R) Xeon(R) CPU E5-2620 2.00GHz (6C12T)*2
Mem: DDR3 1333 8G*2 (16G)
PAPI version: 5.2.0.0
GCC version: 4.4.7
CUDA version: 5.5
NVIDIA driver: 331.20
NVML version: 331.20


Thanks,
Po-Ting
egg183729
 
Posts: 3
Joined: Mon Nov 25, 2013 3:28 am

Re: Measure power usage of K20c by PAPI nvml component

Postby James Ralph » Mon Nov 25, 2013 11:52 am

Hi Po-ting,

It looks like the feature checks in the component were off.
Updated code is in our git repository. Alternatively you can
apply the following as a patch and rebuild.

Hope that helps,
James

Code: Select all
diff --git a/src/components/nvml/linux-nvml.c b/src/components/nvml/linux-nvml.c
index 3a510a0..65cfcc8 100644
--- a/src/components/nvml/linux-nvml.c
+++ b/src/components/nvml/linux-nvml.c
@@ -591,18 +591,21 @@ detectDevices( )
                                                        requires NVML_INFOROM_ECC 2.0 or higher for location-based counts
                                                        requires NVML_INFOROM_ECC 1.0 or higher for all other ECC counts
                                                        requires ECC mode to be enabled. */
-                                               if ( isFermi ) {
-                                                               ret = (*nvmlDeviceGetEccModePtr)( devices[i], &mode, NULL );
-                                                               if ( NVML_FEATURE_ENABLED == mode) {
-                                                                               if ( ecc_version >= 2.0 ) {
-                                                                                               features[i] |= FEATURE_ECC_LOCAL_ERRORS;
-                                                                                               num_events += 8; /* {single bit, two bit errors} x { reg, l1, l2, memory } */
-                                                                               }
-                                                                               if ( ecc_version >= 1.0 ) {
-                                                                                               features[i] |= FEATURE_ECC_TOTAL_ERRORS;
-                                                                                               num_events += 2; /* single bit errors, double bit errors */
-                                                                               }
-                                                               }       
+                                               ret = (*nvmlDeviceGetEccModePtr)( devices[i], &mode, NULL );
+                                               if ( NVML_SUCCESS == ret ) {
+                                                   if ( NVML_FEATURE_ENABLED == mode) {
+                                                       if ( ecc_version >= 2.0 ) {
+                                                           features[i] |= FEATURE_ECC_LOCAL_ERRORS;
+                                                           num_events += 8; /* {single bit, two bit errors} x { reg, l1, l2, memory } */
+                                                       }
+                                                       if ( ecc_version >= 1.0 ) {
+                                                           features[i] |= FEATURE_ECC_TOTAL_ERRORS;
+                                                           num_events += 2; /* single bit errors, double bit errors */
+                                                       }
+                                                   }
+                                               } else {
+                                                   SUBDBG("nvmlDeviceGetEccMode does not appear to be supported. (nvml\
+return code %d)\n", ret);
                                                }

                                                /* For all discrete products with dedicated fans */
@@ -629,13 +632,14 @@ detectDevices( )
                                                        requires NVML_INFOROM_POWER 3.0 or higher
                                                        For Tesla and Quadro products from the Kepler family
                                                        does not require NVML_INFOROM_POWER */
-                                               if ( isFermi ) {
-                                                               ret = (*nvmlDeviceGetPowerUsagePtr)( devices[i], &temp);
-                                                               if ( NVML_SUCCESS == ret ) {
-                                                                               features[i] |= FEATURE_POWER;
-                                                                               num_events++;
-                                                               }
-                                               }
+                                               /* Just try reading power, if it works, enable it*/
+                                               ret = (*nvmlDeviceGetPowerUsagePtr)( devices[i], &temp);
+                                               if ( NVML_SUCCESS == ret ) {
+                                                   features[i] |= FEATURE_POWER;
+                                                   num_events++;
+                                               } else {
+                                                   SUBDBG("nvmlDeviceGetPowerUsage does not appear to be supported on\
+this card. (nvml return code %d)\n", ret );

                                                /* For all discrete and S-class products. */
                                                features[i] |= FEATURE_TEMP;
James Ralph
 
Posts: 18
Joined: Tue Aug 25, 2009 2:43 pm

Re: Measure power usage of K20c by PAPI nvml component

Postby egg183729 » Tue Nov 26, 2013 1:40 am

Hi James,

Thanks for your reply.

I have used git command to get latest version of PAPI.
Code: Select all
git clone https://icl.cs.utk.edu/git/papi.git


When I build PAPI, I got an error below
Code: Select all
components/nvml/linux-nvml.c: In function ‘detectDevices’:
components/nvml/linux-nvml.c:663: error: invalid storage class for function ‘createNativeEvents’
components/nvml/linux-nvml.c:992: error: invalid storage class for function ‘linkCudaLibraries’
components/nvml/linux-nvml.c:1572: error: expected declaration or statement at end of input
components/nvml/linux-nvml.c:1494: warning: unused variable ‘_nvml_vector’
make[1]: *** [linux-nvml.o] Error 1
make[1]: *** Waiting for unfinished jobs....
ar  rv libtestlib.a do_loops.o test_utils.o dummy.o clockcore.o ftests_util.o
ar: creating libtestlib.a
a - do_loops.o
a - test_utils.o
a - dummy.o
a - clockcore.o
a - ftests_util.o
make[2]: Leaving directory `/home/ptliu/PerformanceTool/PAPI/papi/src/testlib'
components/nvml/linux-nvml.c: In function ‘detectDevices’:
components/nvml/linux-nvml.c:663: error: invalid storage class for function ‘createNativeEvents’
components/nvml/linux-nvml.c:992: error: invalid storage class for function ‘linkCudaLibraries’
components/nvml/linux-nvml.c:1572: error: expected declaration or statement at end of input
components/nvml/linux-nvml.c:1494: warning: unused variable ‘_nvml_vector’
make[1]: *** [libpapi.so.5.3.0.0] Error 1
make[1]: Leaving directory `/home/ptliu/PerformanceTool/PAPI/papi/src'
make: *** [/home/ptliu/PerformanceTool/PAPI/papi/src/libpfm4/lib/libpfm.a] Error 2


Best Regards,
Po-Ting.
egg183729
 
Posts: 3
Joined: Mon Nov 25, 2013 3:28 am

Re: Measure power usage of K20c by PAPI nvml component

Postby egg183729 » Tue Nov 26, 2013 4:55 am

Hi,

I found the error due to the code of "linux-nvml.c" missing "}" at line 643.

I tried to fill in "}", and I can build PAPI successfully. But the output of "papi_native_avail" is a little strange.
Image

But the event "nvml:::Tesla_K20c:power" can work with no error.

-

An other question,
Does "nvml:::Tesla_K20c:power" measure the power usage between PAPI_start and PAPI_read?
Or just read instance power usage in a sample period?

Thanks,
Po-Ting.
egg183729
 
Posts: 3
Joined: Mon Nov 25, 2013 3:28 am


Return to Component PAPI (PAPI-C)

Who is online

Users browsing this forum: No registered users and 1 guest