Parallel Execution Advantage on Single Core Intel Atom
I've just had 2 weeks vacation in South America. To help me cope with the long flight I bought a Samsung N110 - which has a battery life of over 9 hours. Also I figured the smaller size would be easier to work with whilst sitting in economy class. Irony was I missed my daytime flight, ended up travelling in the evening and so I slept rather than using the Netbook on the plane.
After a couple of days of being in Brazil, I got itchy fingers, and decided to test the Samsung N110 to see how it performed on parallel programs. I built and ran my favourite Pi program using the Intel® Compiler that comes with Intel Parallel Studio, and got a performance boost of 1.47.
The first thing you need to realize is that the processor in the Samsung N110 is an Intel® Atom N270, 1.6GHz processor single core processor. So any performance boost is not because we are running on two cores.
Building the Pi Code
The code was buit using the Intel compiler
icl /Qopenmp p_openmp.c
The compiler reported
pi_openmp.c(14): (col. 2) remark: OpenMP DEFINED LOOP WAS PARALLELIZED.
static long num_steps = 50000000; double step;
void main ()
double x, pi, sum = 0.0;
start = omp_get_wtime();
step = 1.0/(double) num_steps;
#pragma omp parallel for reduction(+:sum) private(x)
for (i=1;i<= num_steps; i++)
x = (i-0.5)*step;
sum = sum + 4.0/(1.0+x*x);
pi = step * sum;
end = omp_get_wtime();
printf("Pi: %02f, in %02f seconds\n",pi,end-start);
Figure 1 - Pi Source Code
Running the Pi Application
I used the environment variable OMP_NUM_THREADS to control how many threads were used.
Figure 2 - Running pi, first with two threads, then with
Parallel Execution Advantage on Intel® Atom Single Core
So how come I got an improvement, when the processor is a single core. Simple Hyperthreading! The higher spec atom processor support Hyperthreading. In this mode the processor supports two execution threads at the same time. Hyperthreading was first introduced with the Pentium 4, and had mixed results. The hyperthreading in the latest processors have had a make-over, and offer much superior results. Internally the processor has duplicate Arithmetic Logic Units and some other clever electronics that allow parallelism on the single core Atom device
|Num Threads||Time Seconds||Speedup|
Figure 3 - Hyperthreading Speedup
The application ran 1.47 faster when two threads were used. So Hyperthreading is really giving a performance boost!
In conclusion, it can be seen that parallel programming can still give a significant boost to an application when running on a processor that supports hyperthreading.