Thread: Thoughts on OpenMP

  1. #1
    Malum in se abachler's Avatar
    Join Date
    Apr 2007

    Thoughts on OpenMP

    I am looking at OpenMP and it seems to me that while it is about time they added standardized multithreading capability to the language, that OpenMP is probably not the best solution. I may be biased of course, since I already know how to do everything OpenMP does by using exant Windows procedures. I do see it as having some use in converting existing code over to run faster on multicore systems or for programmers that don't 'get' threads, I do not think it would be the best choice for all/new applications. Another benefit of course would be portability. If it is added to the standard, then theoretically parallel code written for Win32 should also compile for linux.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Farncombe, Surrey, England
    I know some pretty heavy number crunching companies use OpenMP, so I guess it can't be "horrible".

    Like all multithreading, you need to get fairly large independent chunks of data to calculate in each thread - then the overhead of the mechanisms to present the work becomes less of an issue. If you have small chunks of work, no form of multithreading is really that efficient.

    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Join Date
    Oct 2007
    Inside my computer
    There's nothing wrong with it. It can pretty convenient. You could split a for loop into X threads very easily. I've only used it once, though, so I can't exactly say I'm an expert.
    So look forward to someone else's advice too.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    It's very terse. Compare the code overhead for making a computation loop multi-threaded with OpenMP - one line, I think, perhaps two or three - with the overhead from doing it by hand - something on the order of a dozen lines or two, if you consider the final joining. And that doesn't consider that the OpenMP implementation probably has a thread pool for the computation, and a message dispatching mechanism to use it. If you have to implement this yourself, it will be a lot more than just two dozen lines.
    The job object API probably is a good alternative - I wouldn't be surprised if MS's OpenMP implementation used it internally.
    All the buzzt!

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Internals of OPENMP?
    By chiku123 in forum C++ Programming
    Replies: 1
    Last Post: 10-23-2007, 10:19 AM
  2. openmp
    By l2u in forum Tech Board
    Replies: 0
    Last Post: 04-12-2007, 05:40 PM
  3. Replies: 9
    Last Post: 02-27-2006, 04:45 AM
  4. OpenMP parallel threads for matrix multiplier
    By collymitch in forum C Programming
    Replies: 0
    Last Post: 04-07-2005, 04:38 PM
  5. UML and C++: Your Thoughts
    By Mister C in forum C++ Programming
    Replies: 5
    Last Post: 03-16-2003, 12:56 PM