Parallel Programming – Where I should start?

One of the frequently asked questions about parallel programming is – Where I should start? Couple of similar questions one can have is –

  • Which is – very easy to learn – parallel programming language?
  • Which of the parallel programming language I can use with the given computer/workstation/server/cluster?
  • What is the quickest way of parallelizing my code?
  • How much additional work we will have to do – in terms of number of lines of code?

So, in my honest opinion the answer is OpenMP! Why? Well, we have full article for answering this question!

In simple terms, code parallelization using OpenMP means add couple of lines in your code – just compile the code and your code runs in parallel! It is that simple. So, people who are not so much fan of Parallel Computing but wants to utilize their multicore processor – OpenMP is the best option! And – most important point – you cannot run away from multicore processors – not for atleast 8-10(?) yrs. So, you cannot expect your serial code performance to increase significantly (of course without vectorization!). The only way forward is to use your remaining cores. So, for those who are still not sure if they want to invest time in parallel programming, I suggest them to try OpenMP. It will not take a lot of time for you to pick up OpenMP.

Let me list out couple of reasons –

  • Easy to convert serial code into parallel code: It’s really very easy! You will have to insert “#pragma” in your code – mostly above “for loops”. And your code will execute for loop iterations in parallel!
  • Little code modification: If you see the number of lines added to your serial code – it’s negligible. And whenever you do not compile the code without any OpenMP flag, the compiler will just ignore “#pragma” statements.
  • Managed by consortium: Almost all major software and hardware vendors are part of this consortium and hence widely implemented across different platforms.
  • People are using it for ages: A lot of code is already developed and is being used for a long time. Also compilers / development tools are pretty much matured.
  • Lot of help / tutorials available on the web: You can find large number of tutorials / discussion forums on the web. It makes developer’s life easier. Many times I find that most of the issues, I find, are already answered on one of the online resources. So, community resources are always available.

I hope this discussion motivates you to start using OpenMP. Or if you have better option for OpenMP – please let me know as well!

Leave a Reply