OpenMP

Don’t try to learn it while you have this cold that’s going around. It’s bad enough that half the documentation is in Fortran, and the other half assumes you already know how OpenMP works. *Sigh*

5 Comments

Yeah, every time I’ve looked at openmp, knowing that *in principle* it should be so simple, I’ve given up. It’s faster to crank out multithreading using boost::thread (which I know how to do) than figure out Openmp. Which is sort of sad.

OpenMP seems to me to be the sledgehammer approach. Cross-platform systems like that are rarely consistent across platforms. I’m curious why you would use OpenMP rather than making what you need out of a primitive like CompareAndExchange?

I’ve been investigating multithreading for my own project, looking specifically at Intel’s Smoke (http://www.gamasutra.com/view/feature/3941/sponsored_feature_designing_the_.php), wait-free programming (http://www.valvesoftware.com/publications/2007/GDC2007_SourceMulticore.pdf) and lock free algorithms and it seems you can build a lot of small, fast, completely platform agnostic code on top of one CompareAndExchange platform-specific function.

That said, multithreading is not for the faint of heart.

Therein lies the problem – I was trying to evaluate how potentially useful OpenMP might be as a stepping stone. I gave up in the end, between the cold and the abysmal documentation I think I know less about OpenMP now than I did when I started :)

Heh, the cold’s out there too, eh?

“I’m curious why you would use OpenMP rather than making what you need out of a primitive like CompareAndExchange?”

For data-parallel problems, OpenMP should work great. For things that are common in numerical codes, like parallelizing long loops over identical data, you generally don’t have to lock, you just want to chunk up the work and do it in parallel. My impression is that OpenMP was created for those kinds of problems.

It seems to me that the “lock-free” algorithms don’t really do anything fundamentally new over using locks, it’s just that the “lock” is implemented in a different way. That said, it may be much more efficient (and if you’re running on GPUs then you don’t have traditional mutexes, so then it’s your only option).

Leave a Reply

Name and email address are required. Your email address will not be published.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

You may use these HTML tags and attributes:

<a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <pre> <q cite=""> <s> <strike> <strong> 

%d bloggers like this: