Channels ▼

Stephen Blair-chappell

Dr. Dobb's Bloggers

Parallel Execution Advantage on Single Core Intel Atom

August 27, 2009

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.

The Details

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.

#include <omp.h>
static long num_steps = 50000000; double step;
void main ()
{
    int i;
   
double x, pi, sum = 0.0;
   
double start,end;
    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 one.
 

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
1 2.817 1
2 1.911 1.47

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. 

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