News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

OpenMP

Started by JohnF, April 10, 2014, 05:08:56 PM

Previous topic - Next topic

JohnF

I'm ignorant about OpenMP stuff, any good examples? How to deal with a while loop for example.

Anyway, I've noticed that whatever runs here on my dual core seems to share the load nearly equally between the cores. Is that just lucky - do other computers behave differently?

John

CommonTater

Quote from: JohnF on April 10, 2014, 05:08:56 PM
I'm ignorant about OpenMP stuff, any good examples? How to deal with a while loop for example.

Anyway, I've noticed that whatever runs here on my dual core seems to share the load nearly equally between the cores. Is that just lucky - do other computers behave differently?

John

Homepage is here
http://openmp.org/wp/

Wiki Link...
http://en.wikipedia.org/wiki/OpenMP

Microsoft link...
http://msdn.microsoft.com/en-us/library/tt15eb9t.aspx

Basically it's compiler supported multi-threading.


Pelle

Quote from: JohnF on April 10, 2014, 05:08:56 PM
I'm ignorant about OpenMP stuff, any good examples? How to deal with a while loop for example.
The OpenMP code will try to distribute different chunks of a loop (f.e. iteration 1-100, 101-200, ...) to different processors/threads, so a loop where it's hard to figure out the number of iterations doesn't fit well in this model.

Quote from: JohnF on April 10, 2014, 05:08:56 PM
Anyway, I've noticed that whatever runs here on my dual core seems to share the load nearly equally between the cores. Is that just lucky - do other computers behave differently?
Maybe a bit of luck. By default the OpenMP runtime creates a thread for each processor/core and ask the OS to be so kind to run each thread on a separate core. The OS is free to totally ignore this request, because there are more important threads to be run or it simply because likes "thread #2" better. It's much harder to get accurate timings for multi-processor/multi-threaded code.

I have started a new source code branch for OpenMP (that is pretty minimal now, but will grow over time):
http://www.smorgasbordet.com/pellesc/sourcecode.htm
/Pelle

JohnF

Thanks for the answer Pelle and for version 8.

John