2 REM **************************************** 4 REM * Measuring Power and Energy with PAPI * 6 REM * Vince Weaver * 8 REM * vweaver1@eecs.utk.edu * 9 REM **************************************** 20 HOME 30 P%=0 : TP%=31: ST%=0 100 REM ******************* 101 REM *** slide_title *** 102 REM ******************* 103 GOSUB 10000 104 HGR:POKE -16302,0 105 PRINT CHR$(4);"BLOAD TITLE.HGR,A$2000" 106 GOSUB 9000 107 ON N% GOTO 100,100,200 200 REM ********************** 201 REM *** slide_01_intro *** 202 REM ********************** 203 GOSUB 10000 204 TEXT:VTAB 1 205 PRINT " Power and Energy - Why do We Care?" 206 PRINT 207 PRINT "* New, massive, HPC machines use " 208 PRINT " impressive amounts of power " 209 PRINT 210 PRINT "* When you have 100k+ cores, saving " 211 PRINT " a few Joules per core quickly adds up" 212 PRINT 213 PRINT "* To improve power/energy draw, you " 214 PRINT " need some way of measuring it" 215 GOSUB 9000 216 ON N% GOTO 100,200,300 300 REM ********************** 301 REM *** slide_02_intro *** 302 REM ********************** 303 GOSUB 10000 304 TEXT:VTAB 1 305 PRINT " Energy/Power Measurement is Already " 306 PRINT SPC(16);"Possible" 307 PRINT 308 PRINT "Three common ways of doing this:" 309 PRINT 310 PRINT "* Hand-instrumenting a system by " 311 PRINT " tapping all power inputs to CPU, " 312 PRINT " memory, disk, etc., and using a " 313 PRINT " data logger" 314 PRINT " " 315 PRINT "* Using a pass-through power meter " 316 PRINT " that you plug your server into." 317 PRINT " Often these will log over USB" 318 PRINT " " 319 PRINT "* Estimating power/energy with a " 320 PRINT " software model based on" 321 PRINT " system behavior" 322 GOSUB 9000 323 ON N% GOTO 200,300,400 400 REM ********************** 401 REM *** slide_03_piotr *** 402 REM ********************** 403 GOSUB 10000 404 HGR 405 PRINT CHR$(4);"BLOAD PLASMA_DPOSV.HGR,A$2000" 406 VTAB 21 407 PRINT SPC(9);"Existing Related Work" 408 PRINT SPC(7);"Plasma/dposv results with " 409 PRINT SPC(7);"Virginia Tech's PowerPack" 410 GOSUB 9000 411 ON N% GOTO 300,400,500 500 REM ***************************** 501 REM *** slide_04_shortcomings *** 502 REM ***************************** 503 GOSUB 10000 504 TEXT:VTAB 1 505 PRINT " Shortcomings of Current Methods" 506 PRINT 507 PRINT "* Each measurement platform has a " 508 PRINT " different interface" 509 PRINT 510 PRINT "* Typically data can only be recorded" 511 PRINT " off-line, to a separate logging" 512 PRINT " machine, and analysis is done after " 513 PRINT " the fact" 514 PRINT 515 PRINT "* Correlating energy/power with other " 516 PRINT " performance metrics can be difficult" 517 PRINT 518 GOSUB 9000 519 ON N% GOTO 400,500,600 600 REM ********************* 601 REM *** slide_05_papi *** 602 REM ********************* 603 GOSUB 10000 604 TEXT:VTAB 1 605 PRINT SPC(8);"Can we make this easier?" 606 PRINT 607 PRINT SPC(15);"Use PAPI!" 608 PRINT 609 PRINT "* PAPI (Performance API) is a " 610 PRINT " platform-independent library for" 611 PRINT " gathering performance-related data" 612 PRINT 613 PRINT "* PAPI-C interface makes adding new" 614 PRINT " power measuring components " 615 PRINT " straightforward" 616 PRINT 617 PRINT "* PAPI can provide power/energy " 618 PRINT " results in-line to running programs" 619 GOSUB 9000 620 ON N% GOTO 500,600,700 700 REM ****************************** 701 REM *** slide_06_papi_benefits *** 702 REM ****************************** 703 GOSUB 10000 704 TEXT:VTAB 1 705 PRINT SPC(11);"More PAPI benefits" 706 PRINT 707 PRINT "* One interface for all power " 708 PRINT " measurement devices" 709 PRINT 710 PRINT "* Existing PAPI code and " 711 PRINT " instrumentation can easily be " 712 PRINT " extended to measure power" 713 PRINT 714 PRINT "* Existing high-level tools (Tau, " 715 PRINT " VAMPIR, etc.) can be used with " 716 PRINT " no changes" 717 PRINT 718 PRINT "* Easy to measure other performance " 719 PRINT " metrics at same time" 720 GOSUB 9000 721 ON N% GOTO 600,700,800 800 REM *********************************** 801 REM *** slide_07_current_components *** 802 REM *********************************** 803 GOSUB 10000 804 TEXT:VTAB 1 805 PRINT SPC(8);"Current PAPI Components" 806 PRINT 807 PRINT "* Various components are nearing " 808 PRINT " completion" 809 PRINT 810 PRINT "* Code for many of them already " 811 PRINT " available in papi.git" 812 GOSUB 9000 813 ON N% GOTO 700,800,900 900 REM **************************** 901 REM *** slide_08_wattsup_pic *** 902 REM **************************** 903 GOSUB 10000 904 HGR 905 PRINT CHR$(4);"BLOAD WATTSUP.HGR,A$2000" 906 VTAB 21 907 PRINT SPC(10);"Watt's Up Pro Meter" 908 GOSUB 9000 909 ON N% GOTO 800,900,1000 1000 REM ************************ 1001 REM *** slide_09_wattsup *** 1002 REM ************************ 1003 GOSUB 10000 1004 TEXT:VTAB 1 1005 PRINT SPC(9);"Watt's Up Pro Features" 1006 PRINT 1007 PRINT "* Can measure 18 different values " 1008 PRINT " with 1 second resolution" 1009 PRINT " (Watts, Volts, Amps, etc.)" 1010 PRINT 1011 PRINT "* Values read over USB" 1012 PRINT 1013 PRINT "* Joules can be derived from power" 1014 PRINT " and time" 1015 PRINT 1016 PRINT "* Can only measure system-wide" 1017 PRINT 1018 GOSUB 9000 1019 ON N% GOTO 900,1000,1100 1100 REM ***************************** 1101 REM *** slide_10_wattsup_plot *** 1102 REM ***************************** 1103 GOSUB 10000 1104 IF ST%=1 GOTO 1107 1105 PRINT CHR$(4);"BLOAD NUM.SHAPE,A$1000" 1106 POKE 232,0: POKE 233,16 : ROT=0: SCALE=3: ST%=1 1107 HGR 1108 HCOLOR=3:HPLOT 0,0 TO 0,159: HPLOT 1,1 TO 1,159 1109 HPLOT 0,159 TO 279,159 1110 FOR I=0 TO 279 STEP 70: HPLOT I,155 TO I,159: NEXT I 1111 FOR I=159 TO 0 STEP -40: HPLOT 0,I TO 4,I: NEXT I 1112 XDRAW 2 AT 65,150 : XDRAW 1 AT 75,150 1113 XDRAW 3 AT 135,150 : XDRAW 1 AT 145,150 1114 XDRAW 4 AT 205,150 : XDRAW 1 AT 215,150 1115 XDRAW 7 AT 11,40 : XDRAW 1 AT 21,40 1116 XDRAW 5 AT 11,80 : XDRAW 1 AT 21,80 1117 XDRAW 3 AT 11,120 : XDRAW 1 AT 21,120 1118 HCOLOR=5 1119 HPLOT 0,85 TO 7,86 TO 14,39 TO 21,63 TO 28,10 TO 35,8 1120 HPLOT TO 42,8 TO 49,14 TO 56,8 TO 63,7 TO 70,7 TO 77,5 1121 HPLOT TO 84,5 TO 91,5 TO 98,4 TO 105,14 TO 112,6 TO 119,10 1122 HPLOT TO 126,3 TO 133,3 TO 140,11 TO 147,2 TO 154,6 TO 161,6 1123 HPLOT TO 168,1 TO 175,14 TO 182,4 TO 189,14 TO 196,15 TO 203,9 1124 HPLOT TO 210,13 TO 217,1 TO 224,4 TO 231,12 TO 238,13 TO 245,7 1125 HPLOT TO 252,3 TO 259,28 TO 266,79 TO 273,79 1126 VTAB 21 1127 PRINT " Average Power (W) versus Time (s)" 1128 PRINT 1129 PRINT SPC(5);"PLASMA Cholesky on Intel Core2" 1130 GOSUB 9000 1131 ON N% GOTO 1000,1100,1200 1200 REM *************************** 1201 REM *** slide_11_rapl_intro *** 1202 REM *************************** 1203 GOSUB 10000 1204 TEXT:VTAB 1 1205 PRINT SPC(18);"RAPL" 1206 PRINT 1207 PRINT "* Running Average Power Limit" 1208 PRINT 1209 PRINT "* Part of an infrastructure to allow" 1210 PRINT " setting custom per-package hardware" 1211 PRINT " enforced power limits" 1212 PRINT 1213 PRINT "* User Accessible Energy/Power " 1214 PRINT " readings are a bonus feature" 1215 PRINT " of the interface" 1216 GOSUB 9000 1217 ON N% GOTO 1100,1200,1300 1300 REM *************************** 1301 REM *** slide_12_rapl_works *** 1302 REM *************************** 1303 GOSUB 10000 1304 TEXT:VTAB 1 1305 PRINT SPC(13);"How RAPL Works" 1306 PRINT 1307 PRINT "* RAPL is not an analog power meter" 1308 PRINT 1309 PRINT "* RAPL uses a software power model, " 1310 PRINT " running on a helper controller" 1311 PRINT " on the main chip package" 1312 PRINT 1313 PRINT "* Energy is estimated using various " 1314 PRINT " hardware performance counters, " 1315 PRINT " temperature, leakage models and I/O" 1316 PRINT 1317 PRINT "* The model is used for CPU throttling" 1318 PRINT " and turbo-boost, but the values are " 1319 PRINT " also exposed to users via a " 1320 PRINT " model-specific register (MSR)" 1321 GOSUB 9000 1322 ON N% GOTO 1200,1300,1400 1400 REM ************************** 1401 REM *** slide_13_rapl_more *** 1402 REM ************************** 1403 GOSUB 10000 1404 TEXT:VTAB 1 1405 PRINT SPC(8);"Available RAPL Readings" 1406 PRINT 1407 PRINT "* PACKAGE_ENERGY: total energy used " 1408 PRINT " by entire package" 1409 PRINT 1410 PRINT "* PP0_ENERGY: energy used by " 1411 PRINT " 'Power Plane 0' which includes " 1412 PRINT " all cores and caches" 1413 PRINT 1414 PRINT "* PP1_ENERGY: on original Sandybridge" 1415 PRINT " this includes the on-chip Intel GPU" 1416 PRINT 1417 PRINT "* DRAM_ENERGY: on Sandybridge EP this " 1418 PRINT " measures DRAM energy usage. " 1419 PRINT " It is unclear whether this is just " 1420 PRINT " the interface or if it includes all " 1421 PRINT " power used by all the DIMMs too" 1422 GOSUB 9000 1423 ON N% GOTO 1300,1400,1500 1500 REM *************************** 1501 REM *** slide_14_rapl_valid *** 1502 REM *************************** 1503 GOSUB 10000 1504 HGR 1505 PRINT CHR$(4);"BLOAD RAPL_MICRO.HGR,A$2000" 1506 VTAB 21 1507 PRINT " Rotem at al. (IEEE Micro Mar/Apr 2012)" 1508 PRINT " Validate Against Actual Power Readings" 1509 GOSUB 9000 1510 ON N% GOTO 1400,1500,1600 1600 REM ****************************** 1601 REM *** slide_15_rapl_accuracy *** 1602 REM ****************************** 1603 GOSUB 10000 1604 TEXT:VTAB 1 1605 PRINT SPC(7);"RAPL Measurement Accuracy" 1606 PRINT 1607 PRINT "* Intel Documentation indicates Energy" 1608 PRINT " readings are updated roughly every " 1609 PRINT " millisecond (1kHz)" 1610 PRINT 1611 PRINT "* The hardware also reports measurement" 1612 PRINT " quanta. This can vary among processor" 1613 PRINT " releases. On our Sandybridge EP all " 1614 PRINT " Energy measurements are in multiples " 1615 PRINT " of 15.2nJ" 1616 PRINT 1617 PRINT "* Power and Energy can vary between " 1618 PRINT " identical packages on a system, " 1619 PRINT " even when running identical workloads. " 1620 PRINT " It is unclear whether this is due to " 1621 PRINT " process variation or else calibration" 1622 PRINT 1623 GOSUB 9000 1624 ON N% GOTO 1500,1600,1700 1700 REM ************************** 1701 REM *** slide_16_rapl_papi *** 1702 REM ************************** 1703 GOSUB 10000 1704 TEXT:VTAB 1 1705 PRINT SPC(10);"RAPL PAPI Interface" 1706 PRINT 1707 PRINT "* Access to RAPL data requires reading" 1708 PRINT " a CPU MSR register. " 1709 PRINT " This requires OS support" 1710 PRINT 1711 PRINT "* Linux currently has no driver and " 1712 PRINT " likely won't for the near future" 1713 PRINT 1714 PRINT "* Linux does support an 'MSR' driver. " 1715 PRINT " Given proper read permissions, MSRs " 1716 PRINT " can be accessed via /dev/cpu/*/msr" 1717 PRINT 1718 PRINT "* PAPI uses the 'MSR' driver to gather " 1719 PRINT " RAPL values" 1720 PRINT 1721 GOSUB 9000 1722 ON N% GOTO 1600,1700,1800 1800 REM *************************** 1801 REM *** slide_17_rapl_power *** 1802 REM *************************** 1803 GOSUB 10000 1804 HGR 1805 PRINT CHR$(4);"BLOAD PLASMA_CHOLESKY.HGR,A$2000" 1806 VTAB 21 1807 PRINT SPC(6);"Average Power (W) vs Time(s)" 1808 PRINT SPC(6);"Cholesky N=30000 Threads=16" 1809 PRINT SPC(13);"SandyBridge EP" 1810 GOSUB 9000 1811 ON N% GOTO 1700,1800,1900 1900 REM **************************** 1901 REM *** slide_18_rapl_energy *** 1902 REM **************************** 1903 GOSUB 10000 1904 HGR 1905 PRINT CHR$(4);"BLOAD MKL_PLASMA.HGR,A$2000" 1906 VTAB 21 1907 PRINT SPC(10);"Energy(J) vs Time(s)" 1908 PRINT SPC(6);"Cholesky N=30000 Threads=16" 1909 PRINT SPC(13);"Sandybridge EP" 1910 GOSUB 9000 1911 ON N% GOTO 1800,1900,2000 2000 REM ********************* 2001 REM *** slide_19_nvml *** 2002 REM ********************* 2003 GOSUB 10000 2004 TEXT:VTAB 1 2005 PRINT SPC(18);"NVML" 2006 PRINT 2007 PRINT "* Recent NVIDIA GPUs support reading " 2008 PRINT " power via the NVIDIA Management " 2009 PRINT " Library (NVML)" 2010 PRINT 2011 PRINT "* On Fermi C2075 GPUs it has milliwatt" 2012 PRINT " resolution within +/- 5W and is " 2013 PRINT " updated at roughly 60Hz" 2014 PRINT 2015 PRINT "* The power reported is that for the " 2016 PRINT " entire board, GPU and memory" 2017 GOSUB 9000 2018 ON N% GOTO 1900,2000,2100 2100 REM ************************** 2101 REM *** slide_20_nvml_plot *** 2102 REM ************************** 2103 GOSUB 10000 2104 IF ST%=1 GOTO 2107 2105 PRINT CHR$(4);"BLOAD NUM.SHAPE,A$1000" 2106 POKE 232,0: POKE 233,16 : ROT=0: SCALE=3: ST%=1 2107 HGR 2108 HCOLOR=3:HPLOT 0,0 TO 0,159: HPLOT 1,1 TO 1,159 2109 HPLOT 0,159 TO 279,159 2110 FOR I=0 TO 279 STEP 25: HPLOT I,155 TO I,159: NEXT I 2111 FOR I=159 TO 0 STEP -80: HPLOT 0,I TO 4,I: NEXT I 2112 XDRAW 2 AT 100,150 2113 XDRAW 3 AT 200,150 2114 XDRAW 2 AT 20,80 : XDRAW 1 AT 30,80 : XDRAW 1 AT 40,80 2115 XDRAW 6 AT 20,120 : XDRAW 1 AT 30,120 2116 HCOLOR=5 2117 HPLOT 0,75 TO 1,55 TO 2,66 TO 3,88 TO 4,94 TO 5,94 2118 HPLOT TO 6,89 TO 7,80 TO 8,62 TO 9,40 TO 10,19 TO 11,15 2119 HPLOT TO 12,15 TO 13,15 TO 14,15 TO 15,15 TO 16,15 TO 17,15 2120 HPLOT TO 18,15 TO 19,15 TO 20,15 TO 21,15 TO 22,16 TO 23,16 2121 HPLOT TO 24,27 TO 25,42 TO 26,48 TO 27,37 TO 28,19 TO 28,15 2122 HPLOT TO 30,15 TO 31,15 TO 32,15 TO 33,16 TO 34,16 TO 35,16 2123 HPLOT TO 36,16 TO 37,15 TO 38,16 TO 39,15 TO 40,16 TO 41,16 2124 HPLOT TO 42,24 TO 43,40 TO 44,42 TO 45,25 TO 46,15 TO 47,15 2125 HPLOT TO 48,15 TO 49,15 TO 50,15 TO 51,15 TO 52,15 TO 53,15 2126 HPLOT TO 54,15 TO 55,15 TO 56,15 TO 56,15 TO 57,27 TO 59,44 2127 HPLOT TO 60,48 TO 61,34 TO 62,18 TO 63,15 TO 64,15 TO 65,15 2128 HPLOT TO 66,15 TO 67,15 TO 68,15 TO 68,15 TO 70,15 TO 71,15 2129 HPLOT TO 72,15 TO 73,15 TO 74,28 TO 75,49 TO 76,51 TO 77,32 2130 HPLOT TO 78,17 TO 79,15 TO 80,15 TO 81,15 TO 82,15 TO 83,15 2131 HPLOT TO 84,15 TO 85,15 TO 86,15 TO 87,15 TO 88,15 TO 89,25 2132 HPLOT TO 90,53 TO 91,56 TO 92,29 TO 93,15 TO 94,15 TO 95,15 2133 HPLOT TO 96,15 TO 97,15 TO 98,15 TO 99,15 TO 100,15 TO 101,15 2134 HPLOT TO 102,15 TO 103,23 TO 104,50 TO 105,56 TO 106,30 TO 107,15 2135 HPLOT TO 108,15 TO 109,15 TO 110,15 TO 111,15 TO 112,15 TO 112,15 2136 HPLOT TO 113,15 TO 114,14 TO 115,19 TO 117,32 TO 118,40 TO 119,32 2137 HPLOT TO 120,20 TO 121,15 TO 122,15 TO 123,15 TO 124,15 TO 125,15 2138 HPLOT TO 126,15 TO 127,15 TO 128,15 TO 129,25 TO 130,52 TO 131,52 2139 HPLOT TO 132,26 TO 133,16 TO 134,15 TO 135,15 TO 136,15 TO 137,15 2140 HPLOT TO 137,15 TO 138,15 TO 140,15 TO 141,23 TO 142,52 TO 143,53 2141 HPLOT TO 144,29 TO 145,20 TO 146,15 TO 147,15 TO 148,15 TO 149,15 2142 HPLOT TO 150,15 TO 151,15 TO 152,20 TO 153,36 TO 154,45 TO 155,31 2143 HPLOT TO 156,16 TO 157,15 TO 158,15 TO 159,15 TO 160,15 TO 161,15 2144 HPLOT TO 162,18 TO 162,29 TO 164,37 TO 165,31 TO 166,21 TO 167,16 2145 HPLOT TO 168,15 TO 169,15 TO 170,15 TO 171,15 TO 172,20 TO 173,40 2146 HPLOT TO 174,43 TO 175,27 TO 176,19 TO 177,16 TO 178,15 TO 179,15 2147 HPLOT TO 180,15 TO 181,18 TO 182,29 TO 183,39 TO 184,32 TO 185,21 2148 HPLOT TO 186,16 TO 187,15 TO 188,15 TO 189,15 TO 190,23 TO 191,35 2149 HPLOT TO 192,41 TO 193,31 TO 194,17 TO 195,15 TO 196,15 TO 197,15 2150 HPLOT TO 198,24 TO 199,33 TO 200,38 TO 200,30 TO 202,16 TO 202,15 2151 HPLOT TO 204,15 TO 204,22 TO 206,31 TO 206,34 TO 208,26 TO 208,18 2152 HPLOT TO 210,16 TO 211,15 TO 212,20 TO 213,34 TO 214,40 TO 215,30 2153 HPLOT TO 216,18 TO 217,15 TO 218,18 TO 219,29 TO 220,34 TO 221,26 2154 HPLOT TO 222,18 TO 223,15 TO 224,18 TO 225,32 TO 225,41 TO 227,30 2155 HPLOT TO 227,18 TO 229,15 TO 229,26 TO 231,37 TO 231,29 TO 233,19 2156 HPLOT TO 234,17 TO 235,26 TO 236,36 TO 237,29 TO 238,21 TO 239,24 2157 HPLOT TO 240,31 TO 241,28 TO 242,22 TO 243,28 TO 244,35 TO 245,28 2158 HPLOT TO 246,23 TO 247,28 TO 248,28 TO 249,24 TO 250,25 TO 250,28 2159 HPLOT TO 252,29 TO 252,30 TO 254,34 TO 254,32 TO 256,25 TO 257,31 2160 HPLOT TO 258,37 TO 259,35 TO 260,33 TO 261,36 TO 262,43 TO 263,38 2161 HPLOT TO 264,36 TO 265,49 TO 266,62 TO 267,65 2162 VTAB 21 2163 PRINT " MAGMA LU 10,000, Nvidia Fermi C2075" 2164 GOSUB 9000 2165 ON N% GOTO 2000,2100,2200 2200 REM **************************** 2201 REM *** slide_21_future_papi *** 2202 REM **************************** 2203 GOSUB 10000 2204 TEXT:VTAB 1 2205 PRINT SPC(6);"Near-future PAPI Components" 2206 PRINT 2207 PRINT " These components do not exist yet," 2208 PRINT " but support for them should be " 2209 PRINT SPC(12);"straightforward." 2210 GOSUB 9000 2211 ON N% GOTO 2100,2200,2300 2300 REM ******************** 2301 REM *** slide_22_amd *** 2302 REM ******************** 2303 GOSUB 10000 2304 TEXT:VTAB 1 2305 PRINT " AMD Application Power Management" 2306 PRINT 2307 PRINT "* Recent AMD Family 15h processors " 2308 PRINT " report 'Current Power In Watts' " 2309 PRINT " via Processor Power in the TDP MSR" 2310 PRINT 2311 PRINT "* Support for this can be provided " 2312 PRINT " similar to RAPL" 2313 PRINT 2314 PRINT "* We just need an Interlagos system " 2315 PRINT " where someone gives us read " 2316 PRINT " permissions to /dev/cpu/*/msr" 2317 PRINT 2318 GOSUB 9000 2319 ON N% GOTO 2200,2300,2400 2400 REM ************************* 2401 REM *** slide_23_powermon *** 2402 REM ************************* 2403 GOSUB 10000 2404 TEXT:VTAB 1 2405 PRINT SPC(15);"PowerMon 2" 2406 PRINT 2407 PRINT "* PowerMon 2: a custom board from RENCI" 2408 PRINT 2409 PRINT "* Plugs in-line with ATX power supply" 2410 PRINT 2411 PRINT "* Reports results over USB" 2412 PRINT 2413 PRINT "* 8 channels, 1kHz sample rate" 2414 PRINT " " 2415 PRINT "* We have hardware; still debugging" 2416 GOSUB 9000 2417 ON N% GOTO 2300,2400,2500 2500 REM ********************* 2501 REM *** slide_24_user *** 2502 REM ********************* 2503 GOSUB 10000 2504 TEXT:VTAB 1 2505 PRINT SPC(8);"PAPI-based Power Models" 2506 PRINT 2507 PRINT "* There's a lot of related work on " 2508 PRINT " estimating energy/power using" 2509 PRINT " performance counters" 2510 PRINT 2511 PRINT "* PAPI user-defined events can be " 2512 PRINT " used to create power models using" 2513 PRINT " existing events" 2514 PRINT 2515 PRINT "* Previous work (McKee et al.) shows " 2516 PRINT " accuracy to within 10%%" 2517 PRINT 2518 GOSUB 9000 2519 ON N% GOTO 2400,2500,2600 2600 REM ************************** 2601 REM *** slide_25_measuring *** 2602 REM ************************** 2603 GOSUB 10000 2604 TEXT:VTAB 1 2605 PRINT SPC(10);"Measuring using PAPI" 2606 PRINT 2607 PRINT "* Measuring Energy/Power with PAPI is " 2608 PRINT " done the same as measuring any other " 2609 PRINT " event" 2610 PRINT 2611 GOSUB 9000 2612 ON N% GOTO 2500,2600,2700 2700 REM *********************** 2701 REM *** slide_26_events *** 2702 REM *********************** 2703 GOSUB 10000 2704 TEXT:VTAB 1 2705 PRINT SPC(13);"Listing Events" 2706 PRINT 2707 PRINT "> papi_native_avail" 2708 PRINT "..." 2709 PRINT "====================================" 2710 PRINT " Events in Component: linux-rapl" 2711 PRINT "====================================" 2712 PRINT "------------------------------------" 2713 PRINT "| PACKAGE_ENERGY:PACKAGE0 " 2714 PRINT "| Energy used by chip package 0" 2715 PRINT "------------------------------------" 2716 PRINT "| PACKAGE_ENERGY:PACKAGE1 " 2717 PRINT "| Energy used by chip package 1 " 2718 PRINT "------------------------------------" 2719 PRINT "| DRAM_ENERGY:PACKAGE0 " 2720 PRINT "| Energy used by DRAM on package 0" 2721 PRINT "------------------------------------" 2722 PRINT "..." 2723 GOSUB 9000 2724 ON N% GOTO 2600,2700,2800 2800 REM ************************* 2801 REM *** slide_27_multiple *** 2802 REM ************************* 2803 GOSUB 10000 2804 HGR 2805 PRINT CHR$(4);"BLOAD RAPL_INT_FP.HGR,A$2000" 2806 VTAB 21 2807 PRINT SPC(5);"Measuring Multiple Components" 2808 GOSUB 9000 2809 ON N% GOTO 2700,2800,2900 2900 REM ************************** 2901 REM *** slide_28_questions *** 2902 REM ************************** 2903 GOSUB 10000 2904 TEXT:VTAB 1 2905 PRINT 2906 PRINT 2907 PRINT 2908 PRINT 2909 PRINT 2910 PRINT SPC(6);"Questions before Digressing?" 2911 GOSUB 9000 2912 ON N% GOTO 2800,2900,3000 3000 REM ************************* 3001 REM *** slide_29_appleIIe *** 3002 REM ************************* 3003 GOSUB 10000 3004 TEXT:VTAB 1 3005 PRINT SPC(15);"Apple IIe" 3006 PRINT 3007 PRINT "* Apple II released in 1977" 3008 PRINT 3009 PRINT "* Apple IIe Platinum released in 1987" 3010 PRINT 3011 PRINT "* 1MHz 65C02 Processor, 128kB RAM" 3012 PRINT 3013 PRINT "* 280x192, 6-color graphics " 3014 PRINT " (IIe can do DoubleHiRes)" 3015 PRINT 3016 PRINT "* Power: 18 - 20W" 3017 PRINT 3018 GOSUB 9000 3019 ON N% GOTO 2900,3000,3100 3100 REM ************************ 3101 REM *** slide_30_linpack *** 3102 REM ************************ 3103 GOSUB 10000 3104 TEXT:VTAB 1 3105 PRINT SPC(12);"Linpack Results" 3106 PRINT 3107 PRINT "10x10 Matrix-matrix multiply" 3108 PRINT "START" 3109 PRINT "STOP" 3110 PRINT "HOW MANY SECONDS? 15" 3111 PRINT "133.333333 FLOP/s" 3112 PRINT 3113 PRINT "Yes I know using BASIC is unfair" 3114 PRINT "But I am too lazy to code up a" 3115 PRINT "6502 FP implementation in assembler" 3116 GOSUB 9000 3117 ON N% GOTO 3000,3100,3200 3200 REM ************************** 3201 REM *** slide_31_questions *** 3202 REM ************************** 3203 GOSUB 10000 3204 TEXT:VTAB 1 3205 PRINT 3206 PRINT 3207 PRINT 3208 PRINT 3209 PRINT SPC(15);"QUESTIONS?" 3210 PRINT 3211 GOSUB 9000 3212 ON N% GOTO 3100,3200,3200 9000 REM ****************** 9002 REM * GET KEYPRESSES * 9004 REM ****************** 9006 N%=2 9008 X=PEEK(-16384): IF X < 128 THEN 9008 9010 X=PEEK(-16368)-128 9020 IF X=27 OR X=81 THEN TEXT:HOME:END 9030 IF X=21 OR X=32 THEN P%=P%+1:N%=3 9040 IF X=8 THEN P%=P%-1:N%=1 9050 IF P%>TP% THEN P%=TP% 9060 IF P%<0 THEN P%=0 9070 RETURN 10000 REM **************** 10001 REM * PRINT FOOTER * 10002 REM **************** 10003 HOME: INVERSE : VTAB 24 10005 X$=STR$(P%)+"/":X$=X$+STR$(TP%) 10007 L%=LEN(X$) 10010 PRINT "11 MAY 2012 ICL/UTK"; 10012 FOR I=0 TO 16-L%:PRINT " ";: NEXT I 10014 PRINT LEFT$(X$,L%-1); 10015 TP$=STR$(TP%) : X$=RIGHT$(TP$,1) : X=VAL(X$): POKE 2039,X+48 10020 NORMAL : VTAB 1: PRINT"" 10030 RETURN