Difference between revisions of "OpenMP"

From SourceWiki
Jump to navigation Jump to search
 
Line 4: Line 4:
 
=Introduction=
 
=Introduction=
  
Multi-core chipsClusters of computersKey difference is shared versus distributed memoryNumber of 'parallel programming models'One of which is the use of '''threads'''.
+
I'd rather have a computer that not.  They're handy for email and buying stuff from Amazon.  Definitely.  Indeed, for people of a certain mindset--people like you and me--we can do all sorts of interesting things like simulating the natural world, and in the process look at questions like, "will Greenland melt?" and "what would happen if it did?".
 +
 
 +
Sometimes it's handy to have more than one computer.  Let's say that we have a new whizz-bang weather model that takes 26 hours to work out what the weather will do tomorrow.  "All very well", you say, "but about as much use as a chocolate teapot." In order for the model to be of any use, we need it to run fasterWe need to divide up the work it does and run it over two, or more computersWe need to enter the world of parallel programming.
 +
 
 +
"Hippee!" we cry, but a word of cautionGetting models to work in parallel is a lot, I say it again, '''a lot''' harder than getting them to work on a single processor.  Before setting out down the road, it is well worth checking that you really do need your model to run faster, and that you've explored all avenues in that regard.
 +
 
 +
You still with us?  OK, let's get stuck in.
  
 
=OpneMP=
 
=OpneMP=

Revision as of 14:07, 6 November 2008

'Parallel: Using more than one processor at a time'

Introduction

I'd rather have a computer that not. They're handy for email and buying stuff from Amazon. Definitely. Indeed, for people of a certain mindset--people like you and me--we can do all sorts of interesting things like simulating the natural world, and in the process look at questions like, "will Greenland melt?" and "what would happen if it did?".

Sometimes it's handy to have more than one computer. Let's say that we have a new whizz-bang weather model that takes 26 hours to work out what the weather will do tomorrow. "All very well", you say, "but about as much use as a chocolate teapot." In order for the model to be of any use, we need it to run faster. We need to divide up the work it does and run it over two, or more computers. We need to enter the world of parallel programming.

"Hippee!" we cry, but a word of caution. Getting models to work in parallel is a lot, I say it again, a lot harder than getting them to work on a single processor. Before setting out down the road, it is well worth checking that you really do need your model to run faster, and that you've explored all avenues in that regard.

You still with us? OK, let's get stuck in.

OpneMP

A very useful and relatively simple way to get started with parallel programming. Useful for getting your model to run faster on a multi-core machine.

Threaded programming model. Most of the details of the threads are handled the runtime environment.

svn co http://source.ggy.bris.ac.uk/subversion-open/parallel ./parallel

Hello, world

A time-honoured starting point, except this time we'll get many hellos!

Work Sharing inside Loops

Reductions

A more Realistic Example

Comparing Fortran and C