Trading Functionality for Power within Applications
description
Transcript of Trading Functionality for Power within Applications
![Page 1: Trading Functionality for Power within Applications](https://reader036.fdocuments.net/reader036/viewer/2022062517/56813b29550346895da3ebb5/html5/thumbnails/1.jpg)
Trading Functionality for Power within Applications
Melanie Kambadur and Martha A. Kim{melanie | martha}@cs.columbia.eduColumbia University, New York, NYAPPROX @ PLDI 2014
![Page 2: Trading Functionality for Power within Applications](https://reader036.fdocuments.net/reader036/viewer/2022062517/56813b29550346895da3ebb5/html5/thumbnails/2.jpg)
2
Mobile Phone Application
Running on a power constrained system; app should consume <=80W at a time.
![Page 3: Trading Functionality for Power within Applications](https://reader036.fdocuments.net/reader036/viewer/2022062517/56813b29550346895da3ebb5/html5/thumbnails/3.jpg)
3
0 2 4 6 8 10 12 140
20
40
60
80
100 Total
Time (s)
Pow
er
(W)
Mobile Phone Application
![Page 4: Trading Functionality for Power within Applications](https://reader036.fdocuments.net/reader036/viewer/2022062517/56813b29550346895da3ebb5/html5/thumbnails/4.jpg)
0 2 4 6 8 10 12 140
20
40
60
80
100 Total
Time (s)
Pow
er
(W)
4
Too much power!
Mobile Phone Application
![Page 5: Trading Functionality for Power within Applications](https://reader036.fdocuments.net/reader036/viewer/2022062517/56813b29550346895da3ebb5/html5/thumbnails/5.jpg)
0 2 4 6 8 10 120
20
40
60
80
100 Total
Time (s)
Pow
er
(W)
5
Could handle with HW DVFS (Dynamic Voltage and Frequency Scaling), but you get a slowdown
25% Increase
Power ok now.
![Page 6: Trading Functionality for Power within Applications](https://reader036.fdocuments.net/reader036/viewer/2022062517/56813b29550346895da3ebb5/html5/thumbnails/6.jpg)
0 2 4 6 8 10 120
20
40
60
80
100 Total
Time (s)
Pow
er
(W)
6
Smart DVFS (with OS/ Compiler/ language help) might decrease slowdown
10% Increase
![Page 7: Trading Functionality for Power within Applications](https://reader036.fdocuments.net/reader036/viewer/2022062517/56813b29550346895da3ebb5/html5/thumbnails/7.jpg)
0 2 4 6 8 10 120
20
40
60
80
100 Total
Time (s)
Pow
er
(W)
7
Smart DVFS (with OS/ Compiler/ language help) might decrease slowdown
10% Increase
Majority of existing techniques trade power for runtime (and only save energy when there’s no work to do)
![Page 8: Trading Functionality for Power within Applications](https://reader036.fdocuments.net/reader036/viewer/2022062517/56813b29550346895da3ebb5/html5/thumbnails/8.jpg)
8
Why not trade functionality instead of time?
Mobile Phone Application
Third PartyAdvertisement
0 2 4 6 8 10 12 140
20
40
60
80
100 Total Advertisement
Time (s)
Pow
er
(W)
![Page 9: Trading Functionality for Power within Applications](https://reader036.fdocuments.net/reader036/viewer/2022062517/56813b29550346895da3ebb5/html5/thumbnails/9.jpg)
0 2 4 6 8 10 120
20
40
60
80
100 Total Advertisement
Time (s)
Pow
er
(W)
9
Why not trade functionality instead of time?
Temporarily kill ad, and save energy as well as power!
0% Increase
![Page 10: Trading Functionality for Power within Applications](https://reader036.fdocuments.net/reader036/viewer/2022062517/56813b29550346895da3ebb5/html5/thumbnails/10.jpg)
Use dynamic feedback to decide if and when to make functionality tradeoffs.
10
Profile power
if (too much power), then:
else, resume…
Start ad
Mobile Phone App
Kill ad
![Page 11: Trading Functionality for Power within Applications](https://reader036.fdocuments.net/reader036/viewer/2022062517/56813b29550346895da3ebb5/html5/thumbnails/11.jpg)
Specifically, use Energy Exchanges
11
audit { ……
} record(usage_t *u)
Start ad
Mobile Phone App
Kill adif (u->power >= 80): else continue
![Page 12: Trading Functionality for Power within Applications](https://reader036.fdocuments.net/reader036/viewer/2022062517/56813b29550346895da3ebb5/html5/thumbnails/12.jpg)
Challenges to address
• Accuracy / Precision
• Efficiency of the profiling itself
• Interoperability with existing power tools
• Programmability / Usability
12
![Page 13: Trading Functionality for Power within Applications](https://reader036.fdocuments.net/reader036/viewer/2022062517/56813b29550346895da3ebb5/html5/thumbnails/13.jpg)
Challenges to address
• Accuracy / Precision
• Efficiency
• Interoperability power saving tools
• Programmability13
Could handle w/ HW, but need to deal with new limitations: - too few counters
- counter overflow- security
![Page 14: Trading Functionality for Power within Applications](https://reader036.fdocuments.net/reader036/viewer/2022062517/56813b29550346895da3ebb5/html5/thumbnails/14.jpg)
Energy Exchanges made possible by C++ Library: NRGX.h
14
• Built on Intel RAPL counters
• Primitives to wrap code in power, energy, and
runtime called “audits”
• Efficiently handles multiple audits
• Attempts to overcome HW limitations
![Page 15: Trading Functionality for Power within Applications](https://reader036.fdocuments.net/reader036/viewer/2022062517/56813b29550346895da3ebb5/html5/thumbnails/15.jpg)
Example: bodytrack
15
for (int i=0; i < frames; i=i+1) {
// DO FRAME PROCESSING
}
Goal: keep program’s entire execution within a predetermined energy budget
![Page 16: Trading Functionality for Power within Applications](https://reader036.fdocuments.net/reader036/viewer/2022062517/56813b29550346895da3ebb5/html5/thumbnails/16.jpg)
Example: bodytrack
16
for (int i=0; i < frames; i=i+1) {
// DO FRAME PROCESSING
}
Goal: keep program’s entire execution within a predetermined energy budget
![Page 17: Trading Functionality for Power within Applications](https://reader036.fdocuments.net/reader036/viewer/2022062517/56813b29550346895da3ebb5/html5/thumbnails/17.jpg)
17
#define BUDGET 2000 // in Joules or relative to system
double per_frame = BUDGET/frames;
int framestep = 1;
for (int i=0; i < frames; i=i+framestep) {
audit {
// DO FRAME PROCESSING
} record (usage_t *this_frame);
double energy = this_frame->energy;
ALLOCATION -= energy;
// if frame didn’t take 90-100% of allocation, reset framestep
if ((energy > per_frame) || (energy < 0.9*per_frame)) {
per_frame = (ALLOCATION/(frames-I));
framestep = (int) ceil(energy/per_frame);
}
}
Allocate a total budget for the program, divide into per frame budget
![Page 18: Trading Functionality for Power within Applications](https://reader036.fdocuments.net/reader036/viewer/2022062517/56813b29550346895da3ebb5/html5/thumbnails/18.jpg)
18
#define BUDGET 2000 // in Joules or relative to system
double per_frame = BUDGET/frames;
int framestep = 1;
for (int i=0; i < frames; i=i+framestep) {
audit {
// DO FRAME PROCESSING
} record (usage_t *this_frame);
double energy = this_frame->energy;
ALLOCATION -= energy;
// if frame didn’t take 90-100% of allocation, reset framestep
if ((energy > per_frame) || (energy < 0.9*per_frame)) {
per_frame = (ALLOCATION/(frames-I));
framestep = (int) ceil(energy/per_frame);
}
}
Dynamically adjust framestep to approximate the frame processing (by skipping frames)
![Page 19: Trading Functionality for Power within Applications](https://reader036.fdocuments.net/reader036/viewer/2022062517/56813b29550346895da3ebb5/html5/thumbnails/19.jpg)
19
#define BUDGET 2000 // in Joules or relative to system
double per_frame = BUDGET/frames;
int framestep = 1;
for (int i=0; i < frames; i=i+framestep) {
audit {
// DO FRAME PROCESSING
} record (usage_t *this_frame);
double energy = this_frame->energy;
ALLOCATION -= energy;
// if frame didn’t take 90-100% of allocation, reset framestep
if ((energy > per_frame) || (energy < 0.9*per_frame)) {
per_frame = (ALLOCATION/(frames-i));
framestep = (int) ceil(energy/per_frame);
}
}
Start profiling.
Stop profiling, collect usage.
Access usage record.
![Page 20: Trading Functionality for Power within Applications](https://reader036.fdocuments.net/reader036/viewer/2022062517/56813b29550346895da3ebb5/html5/thumbnails/20.jpg)
20
#define BUDGET 2000 // in Joules or relative to system
double per_frame = BUDGET/frames;
int framestep = 1;
for (int i=0; i < frames; i=i+framestep) {
audit {
// DO FRAME PROCESSING
} record (usage_t *this_frame);
double energy = this_frame->energy;
BUDGET -= energy;
// if frame didn’t take 90-100% of allocation, reset framestep
if ((energy > per_frame) || (energy < 0.9 * per_frame)) {
per_frame = (BUDGET / (frames - i));
framestep = (int) ceil(energy / per_frame);
}
}
Adjust framestep if we’re not using 90-100% of per_frame budget.
![Page 21: Trading Functionality for Power within Applications](https://reader036.fdocuments.net/reader036/viewer/2022062517/56813b29550346895da3ebb5/html5/thumbnails/21.jpg)
Result: energy stays within any budget
21BUDGET
BUDGET
![Page 22: Trading Functionality for Power within Applications](https://reader036.fdocuments.net/reader036/viewer/2022062517/56813b29550346895da3ebb5/html5/thumbnails/22.jpg)
Questions?
22
Tech Report (more examples, implementation details) @
http://arcade.cs.columbia.edu/nrgx-tr14.pdf
Email: [email protected]
![Page 23: Trading Functionality for Power within Applications](https://reader036.fdocuments.net/reader036/viewer/2022062517/56813b29550346895da3ebb5/html5/thumbnails/23.jpg)