Very simple question, probably difficult answer:
Does using SSE instructions for example for parallel sum/min/max/average operations consume more power than doing any other instructions (e.g. a single sum)?
For example, on Wikipedia I couldn't find any information in this respect.
The only hint of an answer I could find is here, but it's a little bit generic and there is no reference to any published material in this respect.
Advantages. An application that may take advantage of SIMD is one where the same value is being added to (or subtracted from) a large number of data points, a common operation in many multimedia applications. One example would be changing the brightness of an image.
NumPy comes with a flexible working mechanism that allows it to harness the SIMD features that CPUs own, in order to provide faster and more stable performance on all popular platforms. Currently, NumPy supports the X86, IBM/Power, ARM7 and ARM8 architectures.
With Advanced Vector Extensions (AVX), a specialized parallelized instruction set in the x86 architecture, copying gets a lot faster. I mean a LOT faster. 2000% faster.
I actually did a study on this a few years ago. The answer depends on what exactly your question is:
In today's processors, power consumption is not much determined by the type of instruction (scalar vs. SIMD), but rather everything else such as:
So if the question is:
All other things being equal: Does a SIMD instruction consume more power than a scalar instruction.
For this, I dare to say yes.
One of my graduate school projects eventually became this answer: A side-by-side comparison of SSE2 (2-way SIMD) and AVX (4-way SIMD) did in fact show that AVX had a noticably higher power consumption and higher processor temperatures. (I don't remember the exact numbers though.)
This is because the code is identical between the SSE and the AVX. Only the width of the instruction was different. And the AVX version did double the work.
But if the question is:
Will vectorizing my code to use SIMD consume more power than a scalar implementation.
There's numerous factors involved here so I'll avoid a direct answer:
Factors that reduce power consumption:
We need to remember that the point of SIMD is to improve performance. And if you can improve performance, your app will take less time to run thus saving you power.
Depending on the application and the implementation, SIMD will reduce the number instructions that are needed to do a certain task. That's because you're doing several operations per instruction.
Factors that increase power consumption:
Breaking it down:
So SIMD saves you power by making your app take less time. But while its running, it consumes more power per unit time. Who wins depends on the situation.
From my experience, for applications that get a worthwhile speedup from SIMD (or anything other method), the former usually wins and the power consumption goes down.
That's because run-time tends to be the dominant factor in power consumption for modern PCs (laptops, desktops, servers). The reason being that most of the power consumption is not in the CPU, but rather in everything else: motherboard, ram, hard drives, monitors, idle video cards, etc... most of which have a relatively fixed power draw.
For my computer, just keeping it on (idle) already draws more than half of what it can draw under an all-core SIMD load such as prime95 or Linpack. So if I can make an app 2x faster by means of SIMD/parallelization, I've almost certainly saved power.
As Mystical's answer suggests, SIMD code tends to take slightly more power, but if the problem is amenable to vectorization, well-written SIMD code will run significantly faster; the speedup is almost always larger than the increase in power, which results in a decrease in the amount of energy (the integral of power over time) consumed.
This is broadly true not only for SIMD vectorization, but for nearly all optimization. Faster code is not just faster, but (almost universally) more energy efficient.
A nit about terminology: people frequently about "power" when they really want to talk about "energy". Power consumption in computing is really only relevant if you are engineering power supplies (obvious reasons) or engineering enclosures (because you want to know how much power you need to be able to disperse as heat). 99.999% of people aren't engaged in either one of those activities, and thus they really want to be keeping energy in mind (as computation / energy is the correct measure of how efficient a program is).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With