Channels ▼

Gaston Hillar

Dr. Dobb's Bloggers

Parallelized Algorithms Are Very Useful for Battery Powered Devices

January 18, 2011

Parallelized algorithms aren't just for desktop computers or servers. If you parallelize your code to take advantage of mobile multicore CPUs, you can create more responsive software without consuming excessive battery life.

Multicore CPUs are becoming part of any modern device with a CPU. However, some developers have doubts about the advantages of running parallelized algorithms on battery powered devices. Modern mobile multicore CPUs have many power states. If your algorithm uses all the CPU power, the CPU will run on the highest power state. However, if your parallelized algorithm uses all the CPU power in an efficient way, the algorithm will require less time to finish. If you consume more power but you require less time, you can even save battery life when you take advantage of multicore. In addition, the existence of turbo modes, such as Intel Turbo Boost, makes some single-threaded applications consume almost the same power as multithreaded applications. This situation happens because Intel Turbo Boost overclocks certain cores on demand, as explained in "Measuring Speedup is Challenging with Intel Turbo Boost Technology."

When Intel Turbo Boost overclocks certain cores, the CPU increases its power consumption. Thus, this overclocked CPU might consume almost the same power as the CPU running code in many non-overclocked cores.

I ran many tests with the Silverlight 4 application explained in "Silverlight 4 Makes it Easy to Count Logical Cores." I ran these tests on an Intel Core i7 820QM CPU and I've used Microsoft Windows 7 Ultimate 64-bit edition. This CPU has four physical cores and eight hardware threads. The Silverlight 4 application doesn't represent the most efficient parallelized algorithm because it uses static partitioning. However, the application provides an interesting workload and allowed me to compare a sequential version with its parallelized version. The test starts with a fully charged battery and then measures the total remaining battery charge when the Silverlight 4 application runs the algorithm five times. In addition, the test considers the total time required to run the algorithm five times.

These were the results when Intel Turbo Boost was enabled:

  • Sequential version. Time to complete: 408 seconds. Total battery charge: 92%
  • Parallelized version. Time to complete: 220 seconds. Total battery charge: 95%

These were the results when Intel Turbo Boost was disabled:

  • Sequential version. Time to complete: 665 seconds. Total battery charge: 91%
  • Parallelized version. Time to complete: 240 seconds. Total battery charge: 95%

The parallelized version with Intel Turbo Boost enabled took 220 seconds to complete and left the battery with a total charge of 95%. Remember that the parallelized version can use even more efficient code. The sequential version with Intel Turbo Boost enabled required more time to complete and left the battery with a total charge of 92%. The sequential version with Intel Turbo Boost disabled provided the worst results. Which version would you choose to achieve the best performance while maximizing battery life? I would choose the parallelized version, and I would leave Turbo Boost enabled. You can run these test by yourself and draw your own conclusions. This simple example allows you to understand the importance of parallelized algorithms for battery-powered devices. The results are even better when you take full advantage of the underlying hardware architecture and its advanced capabilities.

You can also maximize battery life when you have code that doesn't require a long time to run. If you run code in different tasks or threads, you can make the CPU run in low power states to process the same workload that would require a higher power state for the sequential version. Remember that asynchronous programming is very important to provide the user with a responsive UI while taking advantage of multiple cores.

When you want to compare battery consumption of a serial algorithm versus its parallelized version, it is very important to consider the time required by each version. If the parallelized version requires less time, you will save battery life. Thus, the user will be very happy with both performance and battery consumption.

For more information, you can read the paper entitled "The Benefits of Multiple CPU Cores in Mobile Devices." In this white paper, NVIDIA explains the battery life benefits of multicore architectures for mobile devices, such as smartphones and tablets.

Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.
 


Video